diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/nicetext/makedoc.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/nicetext/makedoc.sty | 94 |
1 files changed, 61 insertions, 33 deletions
diff --git a/Master/texmf-dist/tex/latex/nicetext/makedoc.sty b/Master/texmf-dist/tex/latex/nicetext/makedoc.sty index 67658845ab3..f09a891434e 100644 --- a/Master/texmf-dist/tex/latex/nicetext/makedoc.sty +++ b/Master/texmf-dist/tex/latex/nicetext/makedoc.sty @@ -1,10 +1,10 @@ %% Macro package `makedoc.sty' for LaTeX2e, -%% copyright (C) 2009-2011 Uwe L\"uck, +%% copyright (C) 2009-2012 Uwe L\"uck, %% http://www.contact-ednotes.sty.de.vu %% -- author-maintained in the sense of LPPL below -- %% for preparing documentations from packages. -\def\fileversion{0.42} \def\filedate{2011/11/19} +\def\fileversion{0.5} \def\filedate{2012/03/18} %% This file can be redistributed and/or modified under %% the terms of the LaTeX Project Public License; either @@ -49,6 +49,7 @@ \catcode`\_=11 %% underscore used in control words %% %% \subsection{&\MakeDocCorrectHook\ (\dqtd{`txt2TeX'})} +%% \label{sec:mdoccorr} %% 2012/03/17 %% |\MakeDocCorrectHook| is predefined to leave its argument without %% the enclosing braces, otherwise unchanged: \let\MakeDocCorrectHook\@firstofone @@ -342,7 +343,7 @@ % \let\maybe_result_empty_line\empty } %% -%% \subsection{Dealing with empty input lines} %% TODO use!? 2010/03/09 +%% \subsection{Dealing with empty input lines} %% TODO use!? 2010/03/09 %% \label{sec:emptylines} %% |\OnEmptyInputLine| is a default setting (or hook) for what to do %% with empty lines in the input file. The default is to insert an @@ -377,26 +378,43 @@ %% \subsubsection{Choose input file and run!} %% |\MakeDoc{<input>}| preprocesses <input> to render input for %% \LaTeX, considering what is typical for a \LaTeX\ package as the -%% <input> one here: -\newcommand*{\MakeDoc}[1]{% - \input{mdoccorr.cfg}% %% 2011/11/05 -%% ... added for what `makedoc.tex' says about it. -%% See `\make_doc_job' for TODOs about it. -%% Now also wondering: \ (i)~there are other ways to get the -%% correcting hook, so why forcing this here? \ -%% (ii)~different correcting hooks for different input files?---% -%% In case of a ``header" (see below) we change into ``code mode": +%% <input> one here. It reads 'mdoccorr.cfg' (Sec.~\ref{sec:mdoccorr}) +%% automatically. +%% % [`input{mdoccorr.cfg}'] added for what `makedoc.tex' says about it. +%% % See `\make_job_doc' for TODOs about it. +%% % Now also wondering: \ (i)~there are other ways to get the +%% % correcting hook, so why forcing this here? \ +%% % (ii)~different correcting hooks for different input files?---% +%% % In case of a ``header" (see below) we change into ``code mode": +%% |\MakeDoc*{<input>}| \emph{avoids} inputting 'mdoccorr.cfg' +%% (e.g., for allowing replacements specific for the single package). +%% All similar commands (including those invoking `\MakeDoc') +%% get this ``my way" feature as of v0.5: +\newif\if_makedoc_autocorr_ +\newcommand*{\makedoc_maybe_autocorr}{% + \if_makedoc_autocorr_ \input{mdoccorr.cfg}% + \else \_makedoc_autocorr_true \fi} +%% <- TODO warning if one from `TEXMF/' used inadvertently!? +%% avoid reading twice!? %% 2010/03/11 +%% % or read it from 'makedoc' already? %% 2010/03/13 +%% +%% |\makedoc_star<next-cmd>| abbreviates star version definitions: +\newcommand*{\makedoc_star}[1]{% + \@ifstar{\_makedoc_autocorr_false#1}#1} +\newcommand*{\MakeDoc}{\makedoc_star\make_doc_arg} +\newcommand*{\make_doc_arg}[1]{% + \makedoc_maybe_autocorr \ifnum\header_lines>\z@ \WriteResult{\string\begin{mdPackageCode}}% \PackageCodeTrue %% TODO both lines makedoc command!? %% 2009/04/08 \else \PackageCodeFalse \fi -%% The loop follows. There is a placeholder `\makd_doc_line_body' +%% The loop follows. There is a placeholder `\makedoc_line_body' %% that is predefined below and can be changed while processing the %% <input> file. \ProcessFileWith{#1}{% \CountInputLines %% stepping line counter is standard - \make_doc_line_body + \makedoc_line_body \process_line_message}% %% Currently the ``VERSION HISTORY" or, more generally, %% a final part of the <input> file is typeset verbatim @@ -416,8 +434,11 @@ %% is a kind of shorthand for %% \[`\MakeDoc{<input>}\CloseResultFile'\] %% was MakeClose 2011/10/12 %% where `\CloseResultFile' is from 'fifinddo'. -\newcommand*{\MakeCloseDoc}[1]{\MakeDoc{#1}\CloseResultFile} -%% Reimplementation using 'fifinddo' v0.5 failed: %% 2011/11/19 +%% The star version \[|\MakeCloseDoc*{<input>}|\] %% 2012/03/18 +%% \emph{avoids} reading 'mdoccorr.cfg': +\newcommand*{\MakeCloseDoc} {\makedoc_star\make_close_doc} +\newcommand*{\make_close_doc}[1]{\MakeDoc{#1}\CloseResultFile} +%% Reimplementation using 'fifinddo' v0.5 failed 2011/11/19: % \newcommand*{\MakeCloseDoc}{\FinalInputFiletrue\MakeDoc} %% `\MakeDoc' and `\MakeCloseDoc' actually \emph{process} %% the <input> file, @@ -430,8 +451,13 @@ %% using settings like `\MakeDoc'. The default for <out-ext> is `doc'. %% `\MakeSingleDoc' combines `\LaTeXresultFile' %% and `\MakeCloseDoc' with appropriate arguments. +%% The star version %% 2012/03/18 +%% \[|\MakeSingleDoc*[<out-ext>]{<in-output>.<in-ext>}|\] +%% \emph{avoids} reading 'mdoccorr.cfg'. %% (TODO: not so sure about dot vs.\ optional <in-ext>.) -\newcommand*{\MakeSingleDoc}[2][doc]{\make_single_doc[#1]#2\@nil} +\newcommand*{\MakeSingleDoc}{\makedoc_star\make_single_doc_args} +\newcommand*{\make_single_doc_args}[2][doc]{% + \make_single_doc[#1]#2\@nil} \def\make_single_doc[#1]#2.#3\@nil{% \LaTeXresultFile{#2.#1}\MakeCloseDoc{#2.#3}} %% @@ -462,10 +488,10 @@ %% (general dividing into code and comments). \MainDocParser{\SectionLevelThreeParseInput} %% Here is how `\HeaderLines' and `\MainDocParser' act: -\def\make_doc_line_body{% +\newcommand*{\makedoc_line_body}{% \IfInputLine{>\header_lines}% - {\let\make_doc_line_body\main_doc_parser - \make_doc_line_body}% %% switch to deciding + {\let\makedoc_line_body\main_doc_parser + \makedoc_line_body}% %% switch to deciding {\TreatAsCode{\fdInputLine}}} %% header verbatim %% \subsubsection{Screen messages} %% |\ProcessLineMessage{<command>}| is designed to choose a screen @@ -493,7 +519,7 @@ %% |\MakeInputJobDoc{<header-lines>}{<main-parser>}| %% by default produces a file %% \[`\jobname.doc' \mbox{\quad from\quad } `\jobname.sty'\] -%% with some standard settings.\footnote{This command is new with v0.3.} +%% with some standard settings. %%% \footnote{This command is new with v0.3.} %% 'mdoccorr.cfg' (for `.txt'$\to$\LaTeX\ functionality) is read, %% `\HeaderLines{<header-lines>}' %% and `\MainDocParser{<main-parser>}' and finally @@ -519,6 +545,8 @@ %% |\MakeJobDoc| does the same as `\MakeInputJobDoc' apart from %% typesetting the <created> file, so the latter needs an additional %% `\input{<created>}'. +%% The star forms |\MakeInputJobDoc*| and %% 2012/03/18 +%% |\MakeJobDoc*| \emph{avoid} reading 'mdoccorr.cfg'. %% %% My original idea was that all preprocessing of package files %% to be documented should <happen> \emph{before} @@ -534,11 +562,11 @@ %% This is the code for both `\MakeJobDoc' and `\MakeInputJobDoc': \@ifdefinable{\mdJobName}{\let\mdJobName\jobname} \newif\if_makedoc_input_ -\newcommand*{\MakeInputJobDoc}{\_makedoc_input_true - \make_job_doc_read} -\newcommand*{\MakeJobDoc} {\_makedoc_input_false - \make_job_doc_read} -\newcommand*{\make_job_doc_read}[1][sty] +\newcommand*{\MakeInputJobDoc}{% + \_makedoc_input_true \makedoc_star\make_job_doc_arg} +\newcommand*{\MakeJobDoc} {% + \_makedoc_input_false \makedoc_star\make_job_doc_arg} +\newcommand*{\make_job_doc_arg}[1][sty] {\@testopt{\make_job_doc[#1]}{doc}} %% Reading files as follows would fail with active 'niceverb' settings, %% so we issue `\noNiceVerb' if it is defined. We do it inside a group @@ -547,12 +575,8 @@ \begingroup \@ifundefined{noNiceVerb}{}% {\let\MakeNormal\MakeNormalHere \noNiceVerb}% - \input{mdoccorr.cfg}% - %% <- TODO warning if not found!? - %% or if one from TEXMF/ used inadvertently!? - %% avoid reading twice!? 2010/03/11 - %% <- TODO stack danger in group!? 2010/03/13 - %% <- TODO or read it from 'makedoc' already! 2010/03/13 + \makedoc_maybe_autocorr %% 2012/03/17 +%% <- TODO stack danger in group!? 2010/03/13 \LaTeXresultFile{\mdJobName.#2}% \HeaderLines{#3}% \MainDocParser{#4}% @@ -564,7 +588,7 @@ } %% This feature may \emph{change}. %% -%% \subsection{Leave the package} +%% \subsection{Leaving the package} %% mod. 2012/03/18 \catcode`\_=8 %% restores underscore use for subscripts \endinput %% @@ -613,3 +637,7 @@ v0.41a 2011/08/22 doc.: makedoc.cfg -> mdoccorr.cfg v0.41b 2011/10/12 doc.: MakeClose -> MakeDoc v0.42 2011/11/05 \MakeDoc reads mdoccorr.cfg, \MakeSingleDoc 2011/11/19 failing reimplementation of \MakeCloseDoc +v0.5 2012/03/17 removing 1 \make_job_doc TODO; star versions; + a few make_doc -> makedoc + 2012/03/18 star variants completed, copyright updated, + doc. "Leaving" |