From 081b1c0da58e16ccc2583b2417048d1849508606 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 30 Nov 2011 23:02:47 +0000 Subject: ydoc (19nov11) git-svn-id: svn://tug.org/texlive/trunk@24709 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/latex/ydoc/ydoc.dtx | 172 ++++++++++++++++++++++++--- 1 file changed, 153 insertions(+), 19 deletions(-) (limited to 'Master/texmf-dist/source/latex/ydoc') diff --git a/Master/texmf-dist/source/latex/ydoc/ydoc.dtx b/Master/texmf-dist/source/latex/ydoc/ydoc.dtx index 406e1277337..8f96314275b 100644 --- a/Master/texmf-dist/source/latex/ydoc/ydoc.dtx +++ b/Master/texmf-dist/source/latex/ydoc/ydoc.dtx @@ -1,9 +1,13 @@ % \iffalse %<*driver> -\expandafter\ifx\csname NeedsTeXFormat\endcsname\relax\else \begingroup +\def\latexfmt{LaTeX2e} +\ifx\latexfmt\fmtname \long\def\skip#1\NeedsTeXFormat{\endgroup\NeedsTeXFormat} \expandafter\skip +\else +\endgroup +\let\NeedsTeXFormat\end \fi % % \fi @@ -13,8 +17,9 @@ % \fi % % \iffalse +% \begin{macrocode} \expandafter\ifx\csname ydocstripversion\endcsname\relax\else - \noindent + \endinput \fi \chardef\ydocstripversion=1 @@ -87,7 +92,7 @@ \fi \endgroup } - +% \end{macrocode} % \fi % \iffalse % @@ -130,6 +135,7 @@ \generate{% \file{ydocstrip.tex}{\from{ydoc.dtx}{ydocstrip.tex}}% + \file{ydocincl.tex} {\from{ydoc.dtx}{ydocincl.tex}}% \file{ydoc.ins} {\from{ydoc.dtx}{ydoc.ins}}% \file{ydoc.cls} {\from{ydoc.dtx}{ydoc.cls}}% \file{ydoc.sty} {\from{ydoc.dtx}{ydoc.sty}}% @@ -154,6 +160,7 @@ \Msg{* ydoc-expl.sty *}% \Msg{* ydoc-doc.sty *}% \Msg{* ydocstrip.tex *}% +\Msg{* ydocincl.tex *}% \Msg{* *}% \Msg{* To produce the documentation run the file ydoc.dtx *}% \Msg{* through LaTeX. *}% @@ -175,15 +182,15 @@ \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesFile{ydoc.dtx}[% %<=*DATE> - 2011/08/11 + 2011/11/19 %<=/DATE> %<=*VERSION> - v0.5alpha + v0.6alpha %<=/VERSION> DTX file of ydoc] \message{^^JRun this DTX file using 'tex' to extract all files!^^J} -\documentclass{ydoc}[2011/08/11] +\documentclass{ydoc} \newdimen\tempskip @@ -229,9 +236,9 @@ % \GetFileInfoSVN{ydoc.dtx} % % \title{The \textsf{\textbf{ydoc}} Class and Packages} -% \author{Martin Scharrer \\ \href{mailto:martin@scharrer-online.de}{martin@scharrer-online.de} \\ -% \url{http://latex.scharrer-online.de/ydoc/}\\ -% CTAN: \url{http://tug.ctan.org/pkg/ydoc}} +% \author{Martin Scharrer} +% \repository{https://bitbucket.org/martin_scharrer/ydoc/} +% \email{martin@scharrer.de} % \makeatletter % \date{Version \expandafter\@gobble\fileversion\\[0.5ex]\filedate} % \makeatother @@ -298,7 +305,7 @@ % The implementation of macros can be documented using this environment. The actual \meta{macro code} must be placed in a \env{macrocode} environment. % Longer macro definition can be split using multiple \env{macrocode} environments with interleaved documentation texts. % -% The \pkg{ydoc} definition of the \env{macro} environment has an additional feature compare to \pkg{doc}. The arguments of the macro (|#1|, |#2|, \ldots) can be +% The \pkg{ydoc} definition of the \env{macro} environment has an additional feature compare to \pkg{doc}. The arguments of the macro (|#1|, |#2|, \ldots) can be % documented in a vertical list. The environment has an optional argument to declare the \meta{number of arguments} the macro implementation has. % The descriptions of this macro arguments are read from the next arguments of the environment. If the \meta{number of arguments} is not given or zero (or less) % no further arguments are read by the \env{macro} environment. @@ -409,7 +416,7 @@ % The \env{DescribeEnv} can be used to describe environments in the same way the \cs{DescribeMacro} macro describes macros. % Supported \meta{arguments} are shown in Table~\ref{tab:macroargs}. % Potential \meta{body content} can be placed between the begin and end of the environment description to explain the user what kind of material -% should be placed inside it. +% should be placed inside it. % The environment also exists in macro form as \cs{DescribeEnv}, which allows to provide small \meta{body content} as an optional argument. % Please note that for this optional argument a \cs{MacroArgs} is automatically inserted, but not for the \cs{DescribeEnv} environment content. % @@ -487,7 +494,7 @@ % This macros are used to define the style in which the corresponding macros above are being formatted. % They are used like \MacroArgs '{'<\textbackslash stylemacro>{}'}' to allow the styles to % use macros like |\ttfamily| or |\texttt|\marg{material}. By default the optional argument and the also optional star are -% printed in the color `|optional|' which is a 65\% gray. +% printed in the color `|optional|' which is a 65\% gray. % % \subsection{Settings} % The following macro and dimensions can be redefined by the user to adjust the layout of the package documentation. @@ -511,7 +518,6 @@ % \clearpage % \section{Implementation} % -% % \iffalse %<*ydoc.cls> % \fi @@ -1004,7 +1010,7 @@ % % %<*DRIVER> - 2011/08/11 develop + 2099/01/01 develop % ydoc package to provide 'doc' macros] % \end{macrocode} @@ -1244,6 +1250,10 @@ \def\package{\def\@package} \package{\jobname} +\def\bundle{\def\@bundle} +\let\@bundle\@empty + + \def\ctanlocation{\def\@ctanlocation##1} \ctanlocation{http://www.ctan.org/pkg/#1} @@ -1253,12 +1263,15 @@ \begingroup \edef\@tempa{% \endgroup + CTAN: \noexpand\url - {\@ctanlocation{\@package}}% + {\@ctanlocation{\ifx\@bundle\@empty\@package\else\@bundle\fi}}% }% \@tempa } +\let\@repository\@empty +\protected\def\repository{\urldef\@repository\url} \protected\def\homepage{\urldef\@homepage\url} \protected\def\email{\hyper@normalise\email@} \def\email@#1{\def\@plainemail{#1}\def\@email{\hyper@linkurl{\Hurl{#1}}{mailto:#1}}} @@ -1267,17 +1280,23 @@ \let\@plainemail\empty \title{The \texorpdfstring{\pkgtitle{\@package}}{\@package} Package} +\def\@bundlesubtitle{Part of the \texorpdfstring{\pkgtitle{\@bundle}}{\@bundle} bundle} \protected\def\pkgtitle#1{% \texorpdfstring{\textsf{#1}}{#1}% } + + \def\@maketitle{% \newpage \null\vskip 2em \begin{center}% \let\footnote\thanks {\LARGE \@title \par }\vskip 1.5em% + \ifx\@bundle\@empty\else + {\large \@bundlesubtitle \par }\vskip 1.5em% + \fi {\large \lineskip .5em% \begin{tabular}[t]{c}% \@author @@ -1297,6 +1316,14 @@ \end{tabular}% \par}% \vskip 1em + \ifx\@repository\@empty\else + {\large \lineskip .5em% + \begin{tabular}[t]{c}% + VC: \@repository + \end{tabular}% + \par}% + \fi + \vskip 1em {\large \@date }% \end{center}% \par\vskip 1.5em @@ -1338,7 +1365,7 @@ % % %<*DRIVER> - 2011/08/11 develop + 2099/01/01 develop % ydoc package to describe macros, environments, options etc.] % \end{macrocode} @@ -1726,7 +1753,7 @@ % % \begin{macro}{\handle@Macro@arg} % Checks if next token is the begin of a valid macro argument and calls -% the appropriate read macro or the end macro otherwise. +% the appropriate read macro or the end macro otherwise. % \begin{macrocode} \def\handle@Macro@arg{% \expandafter\let\expandafter\handler\csname handle@Macro@token@\meaning\@let@token\endcsname @@ -1758,7 +1785,7 @@ % \end{macro} % % \begin{macro}{\end@Macro@args} -% Closes box as calls hook. Might be locally redefined by some +% Closes box as calls hook. Might be locally redefined by some % macros calling \cs{read@Macro@arg}. % \begin{macrocode} \def\end@Macro@args{% @@ -2108,6 +2135,7 @@ \define@Macro@handler\AlsoMacro{} \define@Macro@handler\DescribeMacro{} \define@Macro@handler\DescribeKey{} +\define@Macro@handler\DescribeScript{} % \end{macrocode} % % \begin{macro}{\MacroArgs} @@ -2249,7 +2277,7 @@ % % Sets after-macro-arguments hook. % First checks if the environment or macro version was used. -% The environment starts a new line only if the next token isn't |\end|, +% The environment starts a new line only if the next token isn't |\end|, % which is taken as end of the environment. % \begin{macrocode} \ifx\@currenvir\DescribeEnv@string @@ -2719,5 +2747,111 @@ % % \fi % +% \iffalse +%<*ydocincl.tex> +% \fi +% +% \begin{macrocode} +\expandafter\ifx\csname ydocinclversion\endcsname\relax\else + \endinput +\fi + +\chardef\ydocinclversion=1 + +\newread\inFile +\newread\subFile +\newwrite\outFile +\newif\ifContinue +\newlinechar=`^^J + +\def\makeOther#1{\catcode`#1=12\relax} + +\let\inLine\relax +\let\lastLine\relax + +\def\includefiles#1#2{% + \begingroup + \immediate\openin\inFile#1\relax + \immediate\openout\outFile#2\relax + \makeOther\@% + \makeOther\ \makeOther\\\makeOther\$% + \makeOther\#\makeOther\^\makeOther\^^K% + \makeOther\_\makeOther\^^A\makeOther\%% + \makeOther\~\makeOther\{\makeOther\}\makeOther\&% + \endlinechar-1\relax + \Continuetrue + \loop + \let\lastLine\inLine + \read\inFile to\inLine + \ifeof\inFile + \Continuefalse + \else + \expandafter\checkLine\inLine\empty\empty\empty\endLine + \fi + \ifContinue + \repeat + \immediate\closein\inFile + \immediate\closeout\outFile + \endgroup + \end +} + +\def\copyline{% + \immediate\write\outFile{\inLine}% +} + +\chardef\percentcharnum=`\% + +\begingroup +\makeOther\%\makeOther\@\relax +\gdef\SubFileOptionString{%<@}\relax +\gdef\CommentChar{%}\relax +\catcode`\|=0 +\makeOther\ \makeOther\\|relax +|gdef|IfFalseString{% \iffalse}|relax +|gdef|FiString{% \fi}|relax +|endgroup + +\def\checkLine#1#2#3#4\endLine{% + \def\firstthree{#1#2#3}% + \ifx\firstthree\SubFileOptionString + \readSubFile#4\endLine + \else + \copyline + \fi +} + +\def\readSubFile#1>#2\endLine{% + \immediate\openin\subFile=#1\relax + \ifeof\subFile + % File not found + \else + \message{^^JIncluding subfile '#1'^^J}% + \immediate\write\outFile{\CommentChar<*#1>}% + \ifx\lastLine\IfFalseString + \immediate\write\outFile{\FiString}% + \fi + \copySubFile + \ifx\lastLine\IfFalseString + \immediate\write\outFile{\IfFalseString}% + \fi + \immediate\write\outFile{\CommentChar}% + \fi + \immediate\closein\subFile +} + +\def\copySubFile{% + \read\subFile to\subLine + \ifeof\subFile\else + \immediate\write\outFile{\subLine}% + \expandafter\copySubFile + \fi +} +% \end{macrocode} +% +% \iffalse +% +% \fi +% % \Finale % \endinput -- cgit v1.2.3