diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/svn-multi/svn-multi.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/svn-multi/svn-multi.dtx | 204 |
1 files changed, 147 insertions, 57 deletions
diff --git a/Master/texmf-dist/source/latex/svn-multi/svn-multi.dtx b/Master/texmf-dist/source/latex/svn-multi/svn-multi.dtx index 192804000a8..ab2eed42c31 100644 --- a/Master/texmf-dist/source/latex/svn-multi/svn-multi.dtx +++ b/Master/texmf-dist/source/latex/svn-multi/svn-multi.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % Copyright (C) 2006-2009 by Martin Scharrer <martin@scharrer-online.de> -% http://www.scharrer-online.de/latex/ +% http://latex.scharrer-online.de/svn-multi/ % ----------------------------------------------------------------- % % This work may be distributed and/or modified under the @@ -24,19 +24,21 @@ % \fi % \iffalse %<*package|driver> -% $Id: svn-multi.dtx 1448 2009-10-19 21:28:41Z martin $ +% $Id: svn-multi.dtx 1866 2010-07-19 11:17:15Z martin $ % -\def\svnmulti@version{v2.2} +\def\svnmulti@version{v2.3} \RequirePackage{svn-prov} %</package|driver> %<*driver> -\ProvidesFileSVN{$Id: svn-multi.dtx 1448 2009-10-19 21:28:41Z martin $} +\ProvidesFileSVN{$Id: svn-multi.dtx 1866 2010-07-19 11:17:15Z martin $} [\svnmulti@version\space SVN Keywords for multi-file LaTeX documents] \GetFileInfoSVN* \let\svnmulti@date\filedate \let\svnmulti@rev\filerev \documentclass{ltxdoc} +\usepackage[english]{babel} +\dateenglish \def\svnmulti@today#1/#2/#3\relax{% \begingroup @@ -92,13 +94,13 @@ \let\origStopEventually\StopEventually \let\origPrintDescribeMacro\PrintDescribeMacro \usepackage{xcolor} -\definecolor{darkred}{rgb}{0.333.0.0,0.0} +\definecolor{darkred}{rgb}{0.333,0.0,0.0} \hypersetup{colorlinks=true,linkcolor=darkred,urlcolor=darkred} \definecolor{macrodesccolor}{rgb}{0.0,0.0,0.8} \definecolor{macroimplcolor}{rgb}{0.0,0.0,0.4} \definecolor{metacolor}{rgb}{0.0,0.4,0.4} \definecolor{scriptcolor}{rgb}{0.2,0.6,0.2} -\definecolor{optioncolor}{rgb}{0.3.0.2,0} +\definecolor{optioncolor}{rgb}{0.3,0.2,0} \let\macroline\\ \newlength{\macrosep} @@ -291,7 +293,7 @@ %<*package> % \fi % -% \CheckSum{2728} +% \CheckSum{2847} % % {\makeatother % \CharacterTable @@ -336,6 +338,7 @@ % Subversion 'entries' file: 'autokw' option} % \changes{v2.2}{2009/10/19}{Added \css{ifsvnmodified} and % \css{ifsvnfilemodified} macros. Some bug fixes.} +% \changes{v2.3-dev}{2010/03/30}{Changed \css{svnidlong} to ignore all comments between verbatim arguments.} % % ^^A \GetFileInfo{svn-multi.dtx} % @@ -369,7 +372,7 @@ % \title{The \textsf{svn-multi} Package \\\large formerly known as % \textsf{svnkw}} % \author{Martin Scharrer \\ \url{martin@scharrer-online.de} \\ -% \url{http://www.scharrer-online.de/latex/svn-multi}\\ +% \url{http://latex.scharrer-online.de/svn-multi/}\\ % CTAN: \url{http://tug.ctan.org/pkg/svn-multi}} % \date{Version \expandafter\@gobble\svnmulti@version\\[0.5ex]\svnmulti@today} % @@ -575,7 +578,10 @@ % manually to ensure that the file-local macros are reset to empty values at % the begin of each input file. This prevents the keyword from leaking over % from one file to the next. After every subfile the file-local keyword macros -% are also restored to the value of the parent file. +% are also restored to the value of the parent file. A \cs{clearpage} should be +% added at the very end of \cs{include}d files to ensure the last page is flushed +% out by \TeX\ before the keyword macros are restored. Otherwise the last page +% might display the mainfile keyword values. % % \DescribeOption{autokw} % This experimental feature allows the automatically extraction of the keyword @@ -1192,7 +1198,7 @@ % `|/|' as directory separator and should end with a `|/|'. Windows users should % just replace all `|\|' with `|/|', \eg `|C:\My dir|' gets `|{C:/My dir/}|'. % -% \subsection*{Script \hypertarget{script@svn-multi.pl}{\texttt{svn-multi.pl}}} +% \subsection*{Script \protect\hypertarget{script@svn-multi.pl}{\texttt{svn-multi.pl}}} % The file \scr{svn-multi.pl} which comes with the \svnmulti package is an % external Perl script which has to be run in the command line or by a \LaTeX\ % development environment/editor like other tools like |Bib|\TeX\ or @@ -1296,6 +1302,8 @@ % detect any side effects or other issues causes by this package. % % \subsection{Packet \texttt{listings} uses \cs{input}} +% \textbf{Update:} Newer versions of \svnmulti avoid this issue by changing the catcodes +% back to normal while reading the |.svx| file. % If a file \meta{basename}.\meta{extension} is typeset verbatim using % |\lstinputlisting|, which uses |\input| to read the file, an existing % \meta{basename}|.svx| file is also included as part of the listing. This can @@ -1405,7 +1413,7 @@ % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackageSVN - {$Id: svn-multi.dtx 1448 2009-10-19 21:28:41Z martin $} + {$Id: svn-multi.dtx 1866 2010-07-19 11:17:15Z martin $} [\svnmulti@version\space SVN Keywords for multi-file LaTeX documents] % \end{macrocode} @@ -1674,15 +1682,43 @@ % \begin{macro}{\svn@inputsvx}[1]{file name/path without extension} % Used to save and restore file keywords when reading |.svx| files. +% The normal catcodes are restored to avoid issues in special situations +% regarding input of verbatim files +% (e.g.\ \cs{lstinputlisting} from the \pkg{listings} package) or other +% cases where catcodes might have changes (e.g.\ `|%|' in |.dtx| files). % \begin{macrocode} \def\svn@inputsvx#1{% \svn@pushfilestack + \begingroup + \svn@normalcatcodes \svn@input{#1.svx}% + \endgroup \svn@popfilestack } % \end{macrocode} % \end{macro} +% \begin{macro}{\svn@normalcatcodes} +% Sets the default catcodes. +% \begin{macrocode} +\def\svn@normalcatcodes{% + \catcode`\\=0\relax + \catcode`\{=1\relax + \catcode`\}=2\relax + \catcode`\$=3\relax + \catcode`\&=4\relax + \catcode`\^^M=5\relax + \catcode`\#=6\relax + \catcode`\^=7\relax + \catcode`\_=8\relax + \catcode`\ =10\relax + \catcode`\@=12\relax + \catcode`\~=13\relax + \catcode`\%=14\relax +} +% \end{macrocode} +% \end{macro} + % \subsection{Definition of init values} % Initialisation of at least the revision to a numeric value is necessary to not % break the |\ifnum| tests later in this package. The revision is initialised to @@ -1774,9 +1810,9 @@ % \begin{macrocode} \newcommand*{\svne@catcodes}{% \let\do\@makeother - \endlinechar=-1 + \endlinechar=-1% \dospecials - \do\- \do\: \do\. \do\^^L + \do\-\do\:\do\.\do\^^L% } % \end{macrocode} % \end{macro} @@ -1829,12 +1865,16 @@ \begingroup \let\next\relax % \end{macrocode} -% Open the format file to read the version number: +% Open the format file to read the version number. If this file does not exists +% (true for recent svn versions) a valid default value is used and the true +% version number is read from the |entries| file. % \begin{macrocode} + \def\svne@version{8}% \openin\svne@read=#1format\relax \ifeof\svne@read\else \svne@readline\svne@version \closein\svne@read + \fi % \end{macrocode} % Check the format version: % \begin{macrocode} @@ -1850,14 +1890,13 @@ % Check the version and call the parse macros if OK: % \begin{macrocode} \ifnum\svne@version>7\relax - \def\next{\svne@parsedirentry% - \svne@parseentries} + \def\next{\svne@parsedirentry + \svne@parseentries}% \else \closein\svne@read \fi \fi \fi - \fi \next \endgroup } @@ -1898,12 +1937,12 @@ \@makeother\. \gdef\svne@scandate#1{% - \expandafter\svne@scandate@#1\relax - 0000-00-00T00:00:00.00000Z\relax\relax + \expandafter\svne@scandate@#1\empty + 0000-00-00T00:00:00.00000Z\empty\empty } -\gdef\svne@scandate@#1-#2-#3T#4:#5:#6.#7\relax#8\relax{% - \gdef\svnfileyear{#1}% +\gdef\svne@scandate@#1-#2-#3T#4:#5:#6.#7\empty#8\empty{% + \xdef\svnfileyear{#1}% \gdef\svnfilemonth{#2}% \gdef\svnfileday{#3}% \gdef\svnfilehour{#4}% @@ -1966,8 +2005,20 @@ % used to stop the file reading. % \begin{macrocode} \def\svne@handleentry{% + \ifx\svne@rev\empty + \let\svne@rev\svn@revinit + \fi \svn@ifequal{\svne@name}{\svnfilefname}% {% + \message{^^J% + Read from '.svn/entries' file:^^J% + Filename: \svne@name^^J% + Date: \svne@date^^J% + Revision: \svne@rev^^J% + Author: \svne@author^^J% + HeadURL: \svne@url^^J% + ^^J% + }% \svnkwdef{Filename}{\svne@name}% \svnkwdef{Date}{\svne@date}% \svnkwdef{Revision}{\svne@rev}% @@ -2204,19 +2255,80 @@ \svnkwdef{Revision}{0}% \svnkwdef{Author}{}% % \end{macrocode} -% The catcodes are changed by \cs{svn@catcodes} to allow \TeX-special characters -% inside the keywords. The braces |{ }| are changed to allow comments between -% the arguments. \cs{svnidlong@readargsfull} is called to read the arguments. +% Read arguments verbatim or non-verbatim. +% \begin{macrocode} + \if@svnmulti@verbatim + \expandafter\svnidlong@readverb + \else + \expandafter\svnidlong@readargs + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\svnidlong@readverb} +% The following macros read the four arguments of |\svnidlong| one-by-one with +% verbatim mode deactivated between them to ignore all comments. The macro +% |\@ifnextchar| is used to get rid of all spaces (and therefore comments) between +% the arguments. An error message is printed if a wrong syntax is discovered. +% \begin{macrocode} +\def\svnidlong@readverb{% + \@ifnextchar\bgroup + {\svnidlong@readverb@\svnidlong@readverb@a}% + {\PackageError{svn-multi}{Wrong syntax for \string\svnidlong}{}}% +} +% \end{macrocode} +% Sets up verbatim mode and calls the macro given as an argument. % \begin{macrocode} +\def\svnidlong@readverb@#1{% \begingroup - \if@svnmulti@verbatim - \svn@catcodes - \catcode`\{=12 - \catcode`\}=12 - \else - \def\svnidlong@readargsfull{\svnidlong@readargs}% - \fi - \svnidlong@readargsfull + \svn@catcodes + \catcode`\{=1\relax + \catcode`\}=2\relax + #1% +} +% \end{macrocode} +% Reads first argument, ignores spaces and comments and calls next macro. +% \begin{macrocode} +\def\svnidlong@readverb@a#1{% + \endgroup + \svnkwsave@read #1\relax + \@ifnextchar\bgroup + {\svnidlong@readverb@\svnidlong@readverb@b}% + {\PackageError{svn-multi}{Wrong syntax for \string\svnidlong}{}}% +} +% \end{macrocode} +% Reads second argument, ignores spaces and comments and calls next macro. +% \begin{macrocode} +\def\svnidlong@readverb@b#1{% + \endgroup + \svnkwsave@read #1\relax + \@ifnextchar\bgroup + {\svnidlong@readverb@\svnidlong@readverb@c}% + {\PackageError{svn-multi}{Wrong syntax for \string\svnidlong}{}}% +} +% \end{macrocode} +% Reads third argument, ignores spaces and comments and calls next macro. +% \begin{macrocode} +\def\svnidlong@readverb@c#1{% + \endgroup + \svnkwsave@read #1\relax + \@ifnextchar\bgroup + {\svnidlong@readverb@\svnidlong@readverb@d}% + {\PackageError{svn-multi}{Wrong syntax for \string\svnidlong}{}}% +} +% \end{macrocode} +% Reads last argument, scans date if not empty and calls the Id update macro. +% \begin{macrocode} +\def\svnidlong@readverb@d#1{% + \endgroup + \svnkwsave@read #1\relax + \ifx\svnkwDate\empty\else + \@svn@scanlongdate{\svnkwDate}% + \fi + \@svn@updateid{\svnkw{Revision}}{\svnkw{Date}}% + {\svnkw{Author}}{\svnkw{URL}}% + \ignorespaces } % \end{macrocode} % \end{macro} @@ -2240,32 +2352,7 @@ \fi % \end{macrocode} % \end{macro} - -% \begin{macro}{\svnidlong@readargsfull}[8] -% {some text, ignored}{Keyword 1} -% {some text, ignored}{Keyword 2} -% {some text, ignored}{Keyword 3} -% {some text, ignored}{Keyword 4} -% Reads all four arguments of \cs{svnidlong} and passes them to -% \cs{svnidlong@readargs}. The normal argument braces are changed to category -% ``other'' and put into the macros parameter text to remove all code between -% them. This is done to avoid problems with comments direct after one of the -% arguments. Because the braces are now non-special the parentheses are made to -% a local replacement. % -% \begin{macrocode} -\if@svnmulti@verbatim -\begingroup -\catcode`\{=12\catcode`\}=12 -\catcode`\(=1\catcode`\)=2 -\gdef\svnidlong@readargsfull#1{#2}#3{#4}#5{#6}#7{#8}(% - \svnidlong@readargs(#2)(#4)(#6)(#8)% -) -\endgroup -\fi -% \end{macrocode} -% \end{macro} - % \begin{macro}{\svnidlong@readargs}[4]{Keyword 1}{Keyword 2}{Keyword 3} % {Keyword 4} % Calls sub macro for all four arguments and ends the catcode changes made @@ -3774,6 +3861,9 @@ patch generated macros '\string\pgf@image@<name>!' from the 'pgf' package!}% % |\csname| to avoid \TeX{} if-parsing errors when they are not defined. % \begin{macrocode} \AtBeginDocument{% +\ifx\chapter\relax + \let\chapter\@undefined +\fi \ifx\chapter\@undefined %% Adapted from the \tableofcontents macro, LaTeX `article' class [2005/09/16] |