diff options
author | Karl Berry <karl@freefriends.org> | 2010-12-10 00:13:16 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-12-10 00:13:16 +0000 |
commit | 51c770a8e01958bb18c9be9426a459a0c076e7ae (patch) | |
tree | abd47d3b6c209ad35602e2ccfd2fb7d60805239b /Master/texmf-dist/source/latex/svn-multi | |
parent | 4a3dacbf99dd46514cee178e616c31d1fe44ed58 (diff) |
svn-multi 2.4 (10dec10)
git-svn-id: svn://tug.org/texlive/trunk@20703 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/svn-multi')
3 files changed, 210 insertions, 255 deletions
diff --git a/Master/texmf-dist/source/latex/svn-multi/svn-multi-pl.dtx b/Master/texmf-dist/source/latex/svn-multi/svn-multi-pl.dtx index 5cdb5a67b97..83d26da4a30 100644 --- a/Master/texmf-dist/source/latex/svn-multi/svn-multi-pl.dtx +++ b/Master/texmf-dist/source/latex/svn-multi/svn-multi-pl.dtx @@ -12,7 +12,7 @@ # E-mail: martin@scharrer-online.de # WWW: http://latex.scharrer-online.de/svn-multi/ # -# $Id: svn-multi-pl.dtx 1866 2010-07-19 11:17:15Z martin $ +# $Id: svn-multi-pl.dtx 1873 2010-07-26 15:31:45Z martin $ # # This program works only in combination with the LaTeX package 'svn-multi' and # generates .svx files with '\svnidlong' macros holding Subversion keywords for @@ -59,15 +59,15 @@ %<*driver> \fi \makeatletter -% $Id: svn-multi-pl.dtx 1866 2010-07-19 11:17:15Z martin $ +% $Id: svn-multi-pl.dtx 1873 2010-07-26 15:31:45Z martin $ \def\svnmultipl@version {v0.1a} \def\svnmultipl@rev $#1: #2 ${\def\svnmultipl@rev{#2}} \def\svnmultipl@date $#1: #2-#3-#4 #5 ${% \def\svnmultipl@today{{\year#2\month#3\day#4\today}}% \def\svnmultipl@date{#2/#3/#4}% } -\svnmultipl@rev $Rev: 1866 $ -\svnmultipl@date $Date: 2010-07-19 12:17:15 +0100 (Mon, 19 Jul 2010) $ +\svnmultipl@rev $Rev: 1873 $ +\svnmultipl@date $Date: 2010-07-26 16:31:45 +0100 (Mon, 26 Jul 2010) $ \ProvidesFile{svn-multi-pl.dtx} [\svnmultipl@date\space\svnmultipl@version\space SVN Keywords extractor for svn-multi] @@ -166,7 +166,7 @@ use File::Basename; % \begin{macrocode} my $VERSION = "0.2"; my ($REV,$DATE) = - (split ' ','$Id: svn-multi-pl.dtx 1866 2010-07-19 11:17:15Z martin $')[2,3]; + (split ' ','$Id: svn-multi-pl.dtx 1873 2010-07-26 15:31:45Z martin $')[2,3]; % \end{macrocode} % Declaration of other global constants and variables: @@ -200,7 +200,7 @@ print STDOUT "This is svn-multi.pl, Version $VERSION-$REV, $DATE\n"; my ($jobname, $dir, $suffix) = fileparse(shift @ARGV, qr/\.(tex|ltx|dtx|svn)$/); % \end{macrocode} % If a directory was specified this program is changing into it because the -% file paths in the |.svn| file are relative to it. +% file paths in the |.aux| file are relative to it. % \begin{macrocode} if ($dir && $dir ne './') { printf STDOUT "Main directory is '$dir'.\n"; @@ -217,7 +217,7 @@ my $outfile = "$jobname.svx"; my %external; % \end{macrocode} -% Regular expressions to read the |.svn| file: +% Regular expressions to read the |.aux| file: % \paragraph{svnexternalpath:} The format is:\\ % \hspace*{2em}|\@svnexternalpath{{patha}{pathb}{...}{pathd}}| % \begin{macrocode} @@ -275,8 +275,8 @@ my $resvnexternal = qr/ % \end{macrocode} % \begin{macrocode} -if (-e "$jobname.svn" and open( my $svnfh, '<', "$jobname.svn")) { - print STDOUT "Reading '$jobname.svn'.\n"; +if (-e "$jobname.aux" and open( my $svnfh, '<', "$jobname.aux")) { + print STDOUT "Reading '$jobname.aux'.\n"; while (<$svnfh>) { chomp; if (/$resvnexternalpath/) { @@ -291,7 +291,7 @@ if (-e "$jobname.svn" and open( my $svnfh, '<', "$jobname.svn")) { close ($svnfh); } else { - warn "No .svn file found for '$jobname'!\n"; + warn "No .aux file found for '$jobname'!\n"; } # Add TEXINPUTS to path @@ -515,7 +515,7 @@ Usage: Description: This LaTeX helper script collects Subversion keywords from non-(La)TeX files and provides it to the 'svn-multi' package using '.svx' files. It will first - scan the file '<jobname>.svn' for files declared by the '\svnextern' macro but + scan the file '<jobname>.aux' for files declared by the '\svnextern' macro but also allows to provide additional files including the corresponding groups. The keywords for the additional files will be written in the file '<jobname>.svx'. 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 ab2eed42c31..7783d57cf0c 100644 --- a/Master/texmf-dist/source/latex/svn-multi/svn-multi.dtx +++ b/Master/texmf-dist/source/latex/svn-multi/svn-multi.dtx @@ -24,32 +24,21 @@ % \fi % \iffalse %<*package|driver> -% $Id: svn-multi.dtx 1866 2010-07-19 11:17:15Z martin $ +% $Id: svn-multi.dtx 1914 2010-12-08 19:43:23Z martin $ % -\def\svnmulti@version{v2.3} -\RequirePackage{svn-prov} +\def\svnmulti@version{v2.4} +\RequirePackage{svn-prov}[2010/04/14] %</package|driver> %<*driver> -\ProvidesFileSVN{$Id: svn-multi.dtx 1866 2010-07-19 11:17:15Z martin $} +\ProvidesFileSVN{$Id: svn-multi.dtx 1914 2010-12-08 19:43:23Z martin $} [\svnmulti@version\space SVN Keywords for multi-file LaTeX documents] +\DefineFileInfoSVN[svnmulti] \GetFileInfoSVN* -\let\svnmulti@date\filedate -\let\svnmulti@rev\filerev \documentclass{ltxdoc} \usepackage[english]{babel} \dateenglish -\def\svnmulti@today#1/#2/#3\relax{% - \begingroup - \year#1\relax - \month#2\relax - \day#3\relax - \xdef\svnmulti@today{\today} - \endgroup -} -\expandafter\svnmulti@today\svnmulti@date\relax - \usepackage{svn-multi}[\svnmulti@date] \usepackage{booktabs} \usepackage{ifpdf} @@ -80,7 +69,7 @@ % URL footnote (for print-out) on first appearance: \@ifundefined{seen@package@#1}{% \footnote{CTAN: \url{http://tug.ctan.org/pkg/#1}}% - \@namedef{seen@package@#1}{1}% + \global\@namedef{seen@package@#1}{1}% }{}% \xspace } @@ -293,7 +282,7 @@ %<*package> % \fi % -% \CheckSum{2847} +% \CheckSum{2849} % % {\makeatother % \CharacterTable @@ -338,7 +327,27 @@ % 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.} +% \changes{v2.3}{2010/03/30}{Changed \css{svnidlong} to ignore all comments between verbatim arguments.} +% \changes{v2.3}{2010/07/19}{ +% Fixed `autokw` to work with newer versions (1.6.x) of +% Subversion where the `format` file is not in the `.svn` +% directory anymore. +% Added debug output for `autokw` option. +% svn entries parser: fixed bugs with empty date and +% revision values. +% Fixed problem with `\cs{chapter}` defined as `\cs{relax}` in +% `\cs{tableofrevisions}`. +% Fixed unwanted spaces. +% Changed `\cs{svnidlong}` to allow comments with braces +% between arguments. This avoids problems with latexdiff. +% Changed catcodes to normal of reading `.svx` files. +% Updated code documentation. +% Updated user documentation. +% } +% \changes{v2.4}{2010/12/08}{ +% Persistent data is now written to the '.aux' file, not to the '.svn' file to save a file handle. +% The 'fink' package usage got replaced by the 'currfile' and 'filehook' packages. +% } % % ^^A \GetFileInfo{svn-multi.dtx} % @@ -357,8 +366,8 @@ % \DoNotIndex{\futurelet,\g@addto@macro,\global,\@gobbletwo,\hline} % \DoNotIndex{\hspace,\if@restonecol,\if@twocolumn,\ignorespaces} % \DoNotIndex{\makeatletter,\MakeUppercase,\@mkboth,\month,\@namedef} -% \DoNotIndex{\NeedsTeXFormat,\newif,\onecolumn,\orig@fink@prepare} -% \DoNotIndex{\orig@fink@restore,\PackageError,\ProcessOptions} +% \DoNotIndex{\NeedsTeXFormat,\newif,\onecolumn} +% \DoNotIndex{\PackageError,\ProcessOptions} % \DoNotIndex{\ProvidesPackage,\renewcommand,\RequirePackage} % \DoNotIndex{\@restonecolfalse,\@restonecoltrue,\section,\strut} % \DoNotIndex{\tableofcontents,\tableofrevisions,\texttt,\today} @@ -402,7 +411,7 @@ % % This package reads the keywords of all files and provides the VC information % of of the most recent changed file of the document to the user through a set -% of macros. This information is written to an auxiliary |.svn| file during the +% of macros. This information is written to an auxiliary |.aux| file during the % first \LaTeX\ run and read back at the next which introduces the same delay % known from the table of contents. The standard \LaTeX{} switch |\nofiles| can % be used to suppress the file generation. @@ -572,7 +581,7 @@ % section~\ref{sec:table} for more information. % % \DescribeOption{filehooks} -% This option loads the \pkg{fink} package and installs at-begin-input-file and +% This option loads the \pkg{filehook} package and installs at-begin-input-file and % at-end-input-file hooks which are needed for many of the options above. While % this option is enabled automatically if needed it can be also enabled % manually to ensure that the file-local macros are reset to empty values at @@ -645,11 +654,12 @@ % revision is not higher (but identical) than the revision of the \cs{svnidlong} % macro it does not override its values. This way both the full time zone from % the long and the file name from the short id macro can be accessed. Please -% note that all features from the 2.0 version load the \pkg{fink} package which +% note that all features from the 2.x version load the \pkg{currfile} package which % lets you typeset the current file name anyway using -% |\finkbase.\finkext|\footnote{The file name in \texttt{\${}Id\$} is always the -% original Subversion file name while the one given by the \pkg{fink} package is -% the current file name. Both could differ if the file got renamed.}. +% |\currfilename|\footnote{The file name in \texttt{\${}Id\$} is always the +% original Subversion file name while the one given by the \pkg{currfile} package is +% the current file name. Both could differ if the file got renamed.}. Before v2.3 +% the \pkg{fink} package was used to provide the file names. % % This macro must be written like seen above while the order of arguments is not % meaningfull. The Subversion property |svn:keywords| must be set on all source @@ -796,7 +806,7 @@ % These macros hold the keyword values of the current \LaTeX{} file, but only if % it contains a \cs{svnid} or \cs{svnidlong} macro. Otherwise the macros hold % either zero values or the values of the last file dependent on whether an -% option is enabled which enabled the \pkg{fink} package. Please see +% option is enabled which enabled the \pkg{currfile} package. Please see % section~\ref{sec:date} how to typeset parts of the date. See \cs{svnkw} below % for all other keywords. % @@ -1177,7 +1187,7 @@ % enclosed by |{ }|. The files must be under version control by Subversion, of % course. Use \cs{svnexternalpath} to specify paths to be scanned for this % files if they are not located relative to the main file. The requested -% filenames are written into the |.svn| auxiliary file and then processed by the +% filenames are written into the |.aux| auxiliary file and then processed by the % external script \scr{svn-multi.pl} which must be executed like described % below. The appropriate keywords are then written in \meta{source file}|.svx| % files (|x| like eXternal) which are read in by the same \cs{svnexternal} macro @@ -1207,7 +1217,7 @@ % major operating systems.\par % The script should be run inside the document folder in the following order: % \begin{enumerate} -% \item Compile \LaTeX\ document, |.svn| file is generated. +% \item Compile \LaTeX\ document, |.aux| file is generated. % \item Run \scr{svn-multi.pl} script, |.svx| files are generated. % \item Compile \LaTeX\ document, |.svx| files are read in. % \end{enumerate} @@ -1218,7 +1228,7 @@ % % \DescribeScript{svn-multi.pl}{\meta{jobname}} % As already mentioned in the \cs{svnexternal} description above this script -% reads the requested external filename from the \meta{jobname}|.svn| file. The +% reads the requested external filename from the \meta{jobname}|.aux| file. The % Subversion command line client |svn| is then used to fetch the needed keywords % which are placed in a \cs{svnidlong} macro inside a \meta{source file}|.svx| % file. Every single source file which uses \cs{svnexternal} will become its own @@ -1258,9 +1268,9 @@ % % \subsection*{Basic Features -- Global and Group Keywords} % \begin{enumerate} -% \item Compile document with \LaTeX. The |.svn| file is generated. Document +% \item Compile document with \LaTeX. The |.aux| file is generated. Document % global and group keyword macros are not valid yet. -% \item Compile document again with \LaTeX. The |.svn| file is read by +% \item Compile document again with \LaTeX. The |.aux| file is read by % \svnmulti. Document global and group keyword macros are now valid. % \end{enumerate} % @@ -1274,7 +1284,7 @@ % % \subsection*{External Files} % \begin{enumerate} -% \item Compile document with \LaTeX. The |.svn| file is generated with +% \item Compile document with \LaTeX. The |.aux| file is generated with % references to the external files. Document global and group keyword macros % are not valid yet. External files are not taken into account. % \item Run \scr{svn-multi.pl} with the main base name (main file name without @@ -1282,10 +1292,10 @@ % which used \cs{svnexternal}. This files contain the keywords of the % external files. % \item Compile document again with \LaTeX. The |.svx| files are read by -% \svnmulti and the |.svn| file is updated to take the new keywords into +% \svnmulti and the |.aux| file is updated to take the new keywords into % account. Document global and group keywords macros only hold % internal values. -% \item Compile document again with \LaTeX. The |.svn| file is read by +% \item Compile document again with \LaTeX. The |.aux| file is read by % \svnmulti. Document global and group keyword macros are now fully valid. % \end{enumerate} % @@ -1334,6 +1344,9 @@ % {\infoline{Location:} CTAN: \url% % {http://tug.ctan.org/pkg/\thedeppackage}} % +% Since v2.3 the authors packages \pkg{currfile} and \pkg{filehook} replacing the +% previous used (and patched) package \pkg{fink}. +% % \begin{DepPackage}{hyperref} % The macro \cs{svnnolinkurl} is resembling the \pkg{hyperref} macro % |\nolinkurl| and uses some its internal macros from the |\url| macro @@ -1344,19 +1357,6 @@ % \infoline{Authors/Maintainers:} Sebastian Rahtz, Heiko Oberdiek % \end{DepPackage} % -% \begin{DepPackage}{fink} -% The FiNK (File Name Keeper) package is used to get the file name and path of -% the input files. Two macros are patched to install hooks to execute own macros -% before and after each input file. This is only done if needed for an enabled -% option and therefore can be disabled using the option \op{old}. -% \infoline{Used internal macros:} |\fink@file|, |\fink@nextdir|, -% |\fink@nextext|, |\fink@nextbase| -% \infoline{Patched internal macros:} |\fink@prepare|, |\fink@restore| -% \infoline{Version used:} 2008/02/27 v2.1.1 -% \infoline{Licence:} LPPL, any version -% \infoline{Author/Maintainer:} Didier Verna -% \end{DepPackage} -% % \begin{DepPackage}{graphics} % If the \op{graphics} option is enabled the following macro is patched to % record the file name and path of the included graphic. @@ -1388,6 +1388,17 @@ % \infoline{Authors/Maintainers:} \LaTeX3 Project % \end{DepPackage} % +% \begin{DepPackage}{currfile} +% The file name and path information are taken from the macros of this package. +% It is from the same author and with the same license as \svnmulti\ itself. +% \infoline{Version used:} 2010/12/06 v0.2 +% \end{DepPackage} +% +% \begin{DepPackage}{filehook} +% This package is used to install file hooks to update subversion macros for subfiles etc. +% It is from the same author and with the same license as \svnmulti\ itself. +% \infoline{Version used:} 2010/12/06 v0.2 +% \end{DepPackage} % % \section{Further Reading} % The \textsf{svn-multi} package (in version 1.3) and its usage got discussed in @@ -1413,7 +1424,7 @@ % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackageSVN - {$Id: svn-multi.dtx 1866 2010-07-19 11:17:15Z martin $} + {$Id: svn-multi.dtx 1914 2010-12-08 19:43:23Z martin $} [\svnmulti@version\space SVN Keywords for multi-file LaTeX documents] % \end{macrocode} @@ -1668,7 +1679,7 @@ % Macro to load |.svx| and |.svt| files. The current keyword group is saved % away and restored after the |.svx| file is loaded. The macros |\IfFileExists| % with |\@@input| are used because |\InputIfFileExists| got redefined by the -% \pkg{fink} package and there is no need to use \pkg{fink} for this files. +% \pkg{filehook} package and there is no need to use \pkg{filehook} for this files. % \begin{macrocode} \def\svn@input#1{% \begingroup @@ -1726,15 +1737,15 @@ % it can be tested if a file had any keyword macros or not.\par % Note that there a two different macros for the document global keywords:\par % The user level |\svn|\meta{kw} macros hold the global value and are only valid -% after a \LaTeX\ run. They are initialised here and defined in the |.svn| +% after a \LaTeX\ run. They are initialised here and defined in the |.aux| % file which is read at the end of the package if it exists and written at the % end of the document.\par % The internal macros |\@svn@|\meta{kw} store the oldest (i.e. highest revision) % keywords read so far from the \cs{svnid} and \cs{svnidlong} macros. They % change during the document and are used to produce the values of the -% |\svn|\meta{kw} macros when the |.svn| file is written.\par +% |\svn|\meta{kw} macros when the |.aux| file is written.\par % Group wide macros are initialised when the group is first defined and have -% three different macros: |\svng@|\meta{group}|@|\meta{kw} (defined in |.svn|), +% three different macros: |\svng@|\meta{group}|@|\meta{kw} (defined in |.aux|), % |\@svng@|\meta{group}|@|\meta{kw} (accumulator) and also an access % macro |\svncg|\meta{group} which uses % |\svn@g|\meta{current group}|@|\meta{kw}. @@ -1812,7 +1823,20 @@ \let\do\@makeother \endlinechar=-1% \dospecials - \do\-\do\:\do\.\do\^^L% + \do0\do1\do2\do3\do4% + \do5\do6\do7\do8\do9% + \do\:\do\^^L% + \do\<\do\>\do\*\do\.\do\-% + \do\/\do\[\do\]\do\`\do\'\do\"% + \def\do##1{\catcode`##1=11\relax}% + \do\A\do\B\do\C\do\D\do\E\do\F + \do\G\do\H\do\I\do\J\do\K\do\L + \do\M\do\N\do\O\do\P\do\Q\do\R + \do\S\do\T\do\U\do\V\do\X\do\Y\do\Z + \do\a\do\b\do\c\do\d\do\e\do\f + \do\g\do\h\do\i\do\j\do\k\do\l + \do\m\do\n\do\o\do\p\do\q\do\r + \do\s\do\t\do\u\do\v\do\x\do\y\do\z } % \end{macrocode} % \end{macro} @@ -1884,7 +1908,6 @@ % \begin{macrocode} \openin\svne@read=#1entries\relax \ifeof\svne@read\else - \svne@catcodes \svne@readline\svne@version % \end{macrocode} % Check the version and call the parse macros if OK: @@ -2038,6 +2061,7 @@ \svn@getfilename{#1}% \edef\svnfilefname{\svnfilefname}% \@onelevel@sanitize\svnfilefname + \svne@catcodes \svne@parseentriesfile{\svnfiledir .svn/}% \svne@parseentriesfile{\svnfiledir _svn/}% \endgroup @@ -2050,7 +2074,7 @@ % \begin{macrocode} \if@svnmulti@autokwall \AtBeginDocument{% - \svnegetfile{\jobname.\svn@mainext}% + \svnegetfile{\jobname.\currfile@mainext}% } \fi % \end{macrocode} @@ -2166,14 +2190,35 @@ % \end{macro} % -% \begin{macro}{\svn@scanId}[5]{file name}{revision}{date (YYYY-MM-DD)}{time +% \begin{macro}{\svn@scanId}[2]{file name}{rest of id line} +% Ensures proper behaviour also for copied but not yet committed files which have +% no date, time and author name. The revision is set to -1. So \meta{rest} is simply +% compared to `|-1|' and a fall-back text is supplied if needed. +% \begin{macrocode} +\def\svn@scanId#1 #2\relax{% + \begingroup + \def\@tempa{#2}% + \def\@tempb{-1}% + \ifx\@tempa\@tempb + \endgroup + \svn@scanId@#1 -1 0000-00-00 00:00:00Z (uncommited)\relax + \else + \endgroup + \svn@scanId@#1 #2\relax + \fi +} +% \end{macrocode} +% \end{macro} +% + +% \begin{macro}{\svn@scanId@}[5]{file name}{revision}{date (YYYY-MM-DD)}{time % (HH:MM:SSZ)}{author (username)} % Scans svn Id (after it got parsed by \cs{svnkwsave}). Awaits only Id value % without leading `|Id:|' and a trailing |\relax| as end marker. It calls % \cs{@svn@scandate} to extract the date information and \cs{@svn@updateid} to % update global Id values and also sets the appropriate keywords. % \begin{macrocode} -\def\svn@scanId#1 #2 #3 #4 #5\relax{% +\def\svn@scanId@#1 #2 #3 #4 #5\relax{% \@svn@scandate{#3 #4}% \@svn@updateid{#2}{#3 #4}{#5}{#1}% \svnkwdef{Filename}{#1}% @@ -2204,7 +2249,7 @@ % \end{macrocode} % Then we check if the revision is non-empty (not yet expanded by subversion?) % and larger then the current maximum value |\@svn@rev|. If yes we save all -% value to save them in the .svn-file later. +% value to save them in the |.aux|-file later. % \begin{macrocode} \ifx\svnfilerev\empty\else \ifnum\@svn@rev<\svnfilerev @@ -2230,7 +2275,7 @@ \fi \if@svnmulti@subgroups \ifsvnsubgroups - \svn@updategroup{\svn@filedir\svn@filebase}% + \svn@updategroup{\currfiledir\currfilebase}% \fi \fi \fi @@ -2845,136 +2890,67 @@ % \end{macro} % \subsection{Input File Name} -% The \pkg{fink} package is used to get the input file names. AtBegin/AtEnd +% The \pkg{currfile} package is used to get the input file names. AtBegin/AtEnd % hooks are installed which will be used later. % \begin{macrocode} \if@svnmulti@filehooks % \end{macrocode} -% Load \pkg{fink} package and check if all needed macros are provided. +% Load \pkg{filehook} and \pkg{currfile} packages. % \begin{macrocode} -\RequirePackage{fink}[2008/02/27] -\begingroup -\def\svn@finkerror{% -\PackageError{svn-multi}{Your installed version of the 'fink' package does not -provide the needed macros. It is either too old or too new. -Try a different version, e.g. v2.1.1 from 2008/02/27}{}% -\let\svn@finkerror\relax -} -\@ifundefined{finkpath}{\svn@finkerror}{}% -\@ifundefined{finkdir}{\svn@finkerror}{}% -\@ifundefined{finkbase}{\svn@finkerror}{}% -\@ifundefined{fink@prepare}{\svn@finkerror}{}% -\@ifundefined{fink@restore}{\svn@finkerror}{}% -\@ifundefined{fnk@maindir}{\svn@finkerror}{}% -\@ifundefined{fnk@mainext}{\svn@finkerror}{}% -\endgroup +\RequirePackage{filehook}[2010/12/08] +\RequirePackage{currfile}[2010/12/08] % \end{macrocode} -% \begin{macro}{\svn@removedotslash}[1]{string (\eg file path) which might start -% with \texttt{./}} -% Removes leading './' from given macro (holding a directory path). Awaits a -% macro as argument which is redefined inside the current group! -% \begin{macrocode} -\def\svn@removedotslash#1{% - \def\svn@removedotslash@##1##2##3\relax{% - \svn@ifequal{./}{##1##2}% - {\def\next{\svn@removedotslash@##3\empty\empty\empty\relax}}% - {\xdef#1{##1##2##3}\let\next\relax}% - \next - }% - \expandafter\svn@removedotslash@#1\empty\empty\empty\relax -} -% \end{macrocode} -% \end{macro} - -% Init values for file name macros. -% \begin{macrocode} -\let\svn@mainext\fnk@mainext -\let\svn@maindir\fnk@maindir -\svn@removedotslash\svn@maindir -\edef\svn@filebase{\jobname}% -\edef\svn@fileext{\svn@mainext}% -\edef\svn@filedir{\svn@maindir}% -% \end{macrocode} -% Filename and -path are build using the other macros: -% \begin{macrocode} -\def\svn@filename{\fink@file\svn@filebase\svn@fileext}% -\def\svn@filepath{\svn@filedir\svn@filename}% -% \end{macrocode} - -% \begin{macro}{\svnmulti@begininputfilehook} -% This hook is installed in the |\fink@prepare| macro from the \pkg{fink} -% package which will be executed at the begin of a input file. The file name and -% path are not yet in |\finkpath| etc. but in |\fink@nextpath|. +% The following code installs the necessary hooks for input files. +% It installs an own file stack \pkg{currfile} does. +% The macro \cs{svn@pg} for the parent group needs to be set before +% \cs{currfilepath} etc. is updated, so the internal \pkg{filehook} +% macros are used to install the code before the \pkg{currfile} code. +% This means that the file name macros below still hold the values of the +% parent file. +% % \begin{macrocode} -\def\svnmulti@begininputfilehook{} -\message{Package svn-multi: patching macro '\string\fink@prepare' from the -'fink' package!}% -\let\svnmulti@fink@prepare\fink@prepare -\renewcommand*{\fink@prepare}[1]{% - \svnmulti@fink@prepare{#1}% +\filehook@prefixwarg\filehook@atbegin{% \svn@pushfilestack \if@svnmulti@groups - \svn@ifequal{\svn@filepath}{\jobname.\svn@mainext}% + \svn@ifequal{\currfilepath}{\jobname.\currfile@mainext}% {\xdef\svn@pg{\svn@g}}% - {\xdef\svn@pg{\svn@filedir\svn@filebase}}% + {\xdef\svn@pg{\currfiledir\currfilebase}}% \fi - \xdef\svn@filebase{\fink@nextbase}% - \xdef\svn@fileext{\fink@nextext}% - \xdef\svn@filedir{\fink@nextdir}% - \svn@removedotslash\svn@filedir - \svnmulti@begininputfilehook -}% -% \end{macrocode} -% \end{macro} - -% \begin{macro}{\svnmulti@endinputfilehook} -% This hook is installed in the |\fink@restore| macro from the \pkg{fink} -% package which will be executed at the end of a input file. The file path -% |\finkpath| etc. is still valid. -% \begin{macrocode} -\def\svnmulti@endinputfilehook{} -\message{Package svn-multi: patching macro '\string\fink@restore' from the -'fink' package!}% -\let\svnmulti@fink@restore\fink@restore -\def\fink@restore#1{% - \svnmulti@endinputfilehook - \svnmulti@fink@restore{#1}% +} +\AtEndOfFiles{% \svn@popfilestack - \xdef\svn@filebase{\finkbase}% - \xdef\svn@fileext{\finkext}% - \xdef\svn@filedir{\finkdir}% - \svn@removedotslash\svn@filedir -}% -% \end{macrocode} -% \end{macro} - -% \begin{macro}{\svnmulti@atbegininputfile} -% This macro adds the argument to the end of the \cs{svnmulti@begininputfilehook}. -% \begin{macrocode} -\def\svnmulti@atbegininputfile{% - \g@addto@macro\svnmulti@begininputfilehook } % \end{macrocode} -% \end{macro} - -% \begin{macro}{\svnmulti@atendinputfile} -% This macro adds the argument to the \emph{begin} of the -% \cs{svnmulti@endinputfilehook}. This ensures that code added first is more at -% the end than code added later. -% The code below was adapted from the definition of the \LaTeX2e macro -% |\g@addto@macro| which was used above. +% Special care is taken for include files, where the svn file macros +% must be kept valid until the implied \cs{clearpage}, so that they can +% be used in page headers and footers. Please note that \cs{include} uses +% \cs{InputIfFileExists} internally where the normal filehooks are +% installed. +% +% There is no simple way to exclude this hooks for \cs{include} files, +% so the stack is pushed and popped twice for these files. +% This causes an issue for subgroups because then that files are +% declared to be there own parent group. +% To fix this the current subgroup is added to correct +% parent group explicitly and the \cs{svn@addfiletogroup} macro was updated +% to not add (sub-)groups to themselves. +% +% Please note that this hook is executed \emph{after} the \pkg{currfile} +% macros are updated and therefore hold the file macros of the include +% file, not the parent file. % \begin{macrocode} -\long\def\svnmulti@atendinputfile#1{% - \begingroup - \@temptokena\expandafter{\svnmulti@endinputfilehook}% - \toks@{#1}% - \xdef\svnmulti@endinputfilehook{\the\toks@\the\@temptokena}% - \endgroup +\AtBeginOfIncludes{% + \svn@pushfilestack + \if@svnmulti@groups + \svn@addfiletogroup{\currfiledir\currfilebase}{\svn@pg}% + \fi +} +\AtEndOfIncludes{% + \svn@popfilestack } % \end{macrocode} -% \end{macro} % \begin{macrocode} \def\svn@filestack{{}} @@ -3191,6 +3167,7 @@ Try a different version, e.g. v2.1.1 from 2008/02/27}{}% % This is an internal macro so no `|*|' substitution for the group name. % \begin{macrocode} \def\svn@addfiletogroup#1#2{% + \svn@ifequal{#1}{#2}{}{% \expandafter \ifx\csname @svng@#2@files@#1\endcsname\relax% \expandafter\gdef\csname @svng@#2@files@#1\endcsname{1}% @@ -3202,6 +3179,7 @@ Try a different version, e.g. v2.1.1 from 2008/02/27}{}% }% }% \fi + }% } % \end{macrocode} % \end{macro} @@ -3211,17 +3189,17 @@ Try a different version, e.g. v2.1.1 from 2008/02/27}{}% % Special care is taken to not re-initialise the main file which could happen in % some special cases (\eg |\lstinputlisting{\jobname .tex}|). % \begin{macrocode} -\svnmulti@atbegininputfile{% - \svn@ifequal{\svn@filepath}{\svn@maindir\jobname.\svn@mainext}% +\AtBeginOfFiles{% + \svn@ifequal{\currfilepath}{\jobname.\currfile@mainext}% {}% {\svn@initfile}% - \svn@ifequal{\svn@fileext}{\svn@mainext}% - {\svn@addfiletogroup{\svn@filedir\svn@filebase}{\svn@pg}}{}% - \svn@ifequal{\svn@fileext}{sty}% - {\svn@addfiletogroup{\svn@filedir\svn@filebase}{\svn@pg}}{}% - \svn@ifequal{\svn@fileext}{cls}% - {\svn@addfiletogroup{\svn@filedir\svn@filebase}{\svn@pg}}{}% - \svn@addfiletogroup{\svn@filepath}{\svn@filedir\svn@filebase}% + \svn@ifequal{\currfileext}{\currfile@mainext}% + {\svn@addfiletogroup{\currfiledir\currfilebase}{\svn@pg}}{}% + \svn@ifequal{\currfileext}{sty}% + {\svn@addfiletogroup{\currfiledir\currfilebase}{\svn@pg}}{}% + \svn@ifequal{\currfileext}{cls}% + {\svn@addfiletogroup{\currfiledir\currfilebase}{\svn@pg}}{}% + \svn@addfiletogroup{\currfilepath}{\currfiledir\currfilebase}% } % \end{macrocode} @@ -3231,7 +3209,7 @@ Try a different version, e.g. v2.1.1 from 2008/02/27}{}% \def\svn@writegroup#1{% \def\svn@writekw##1{% \immediate\write\svn@write{% - \noexpand\@namedef{svng@#1@##1}{\csname @svng@#1@##1\endcsname}% + \string\global\string\@namedef{svng@#1@##1}{\csname @svng@#1@##1\endcsname}% }% }% \svn@writekw{rev}% @@ -3431,17 +3409,16 @@ Try a different version, e.g. v2.1.1 from 2008/02/27}{}% % \begin{macrocode} \def\svnsubgroup{% \begingroup - \svn@removedotslash\svn@filedir - \svn@subgroup{\svn@filedir\svn@filebase}% - \svn@subgroup{\svn@filepath}% + \svn@subgroup{\currfiledir\currfilebase}% + \svn@subgroup{\currfilepath}% \endgroup } % \end{macrocode} % \end{macro} % \begin{macro}{\svn@subgroup}[1]{file name} -% Macro to write a file as group to |.svn| file. After checking if the filename -% was not already written, the |.svn| file is checked if it is open and then the +% Macro to write a file as group to |.aux| file. After checking if the filename +% was not already written, the |.aux| file is checked if it is open and then the % file keyword information is written. % \begin{macrocode} \def\svn@subgroup#1{% @@ -3491,10 +3468,10 @@ lof,log,lot,out,svn,svt,svx,toc} % Check at the end of every input file if files should be extra groups and % declare this file as group if its extension is not configured to be ignored. % \begin{macrocode} -\svnmulti@atendinputfile{% +\AtEndOfFiles{% \if@svnmulti@subgroups \ifsvnsubgroups - \expandafter\ifx\csname svn@ignore@ext@\svn@fileext\endcsname\relax + \expandafter\ifx\csname svn@ignore@ext@\currfileext\endcsname\relax \svnsubgroup \fi \fi @@ -3508,7 +3485,7 @@ lof,log,lot,out,svn,svt,svx,toc} % \begin{macrocode} \if@svnmulti@subgroups \ifsvnsubgroups - \svn@addfiletogroup{\jobname .\svn@mainext}{\jobname}% + \svn@addfiletogroup{\jobname .\currfile@mainext}{\jobname}% \svnsubgroup \fi \fi @@ -3596,11 +3573,10 @@ lof,log,lot,out,svn,svt,svx,toc} \else % \end{macrocode} % Writes the current input file path and its argument as arguments of -% \cs{@svnexternal} into the |.svn| file. +% \cs{@svnexternal} into the |.aux| file. % \begin{macrocode} \newcommand*\svnexternal[2][]{% \if@filesw - \svn@checkwrite \begingroup \svn@ifequal{#1}{*}% {\def\svn@temp{\svn@pg}}% @@ -3609,11 +3585,11 @@ lof,log,lot,out,svn,svt,svx,toc} {\def\svn@temp{#1}}% }% \immediate\write\svn@write{% - \noexpand\@svnexternal[\svn@temp]{\svn@filepath}{#2}% + \noexpand\@svnexternal[\svn@temp]{\currfilepath}{#2}% }% \endgroup \fi - \svn@inputsvx{\svn@filedir\svn@filebase}% + \svn@inputsvx{\currfiledir\currfilebase}% } % \end{macrocode} % \begin{macrocode} @@ -3622,11 +3598,10 @@ lof,log,lot,out,svn,svt,svx,toc} % \end{macro} % \begin{macro}{\svnexternalpath}[1]{list of paths in \texttt{\{ \}}} -% Writes its argument as argument of \cs{@svnexternalpath} into the |.svn| file. +% Writes its argument as argument of \cs{@svnexternalpath} into the |.aux| file. % \begin{macrocode} \def\svnexternalpath#1{% \if@filesw - \svn@checkwrite \immediate\write\svn@write{% \noexpand\@svnexternalpath{#1}% }% @@ -3653,7 +3628,7 @@ lof,log,lot,out,svn,svt,svx,toc} % the \cs{svn@externalfile} is called to read the file name. Otherwise the % argument is simply removed. % \begin{macrocode} -\newcommand*\svnexternalfile[1][\svn@filedir\svn@filebase]{% +\newcommand*\svnexternalfile[1][\currfiledir\currfilebase]{% \begingroup % TODO: maybe use \svn@catcodes \catcode`\_=12 \catcode`\&=12 @@ -3674,7 +3649,7 @@ lof,log,lot,out,svn,svt,svx,toc} \if@svnmulti@subgroups \ifsvnsubgroups \svn@ifequal{#1}{\svn@rg}% - {\svn@addfiletogroup{#2}{\svn@filedir\svn@filebase}}% + {\svn@addfiletogroup{#2}{\currfiledir\currfilebase}}% {\svn@addfiletogroup{#2}{#1}}% \svn@subgroup{#2}% \fi @@ -3694,15 +3669,15 @@ lof,log,lot,out,svn,svt,svx,toc} % \subsection{Auto loading of \texttt{.svx} files} % Auto loading of |.svx| files at the begin of |\input| or |\include| files -% using the \cs{svnmulti@atbegininputfile} macro. +% using the \cs{AtBeginOfFiles} hook. % The macros \cs{svn@addfiletogroup} and \cs{svnsubgroup} are used to do the % actual work. % \begin{macrocode} \if@svnmulti@autoload -\svnmulti@atbegininputfile{% - \svn@ifequal{\svn@fileext}{tex}% - {\svn@inputsvx{\svn@filedir\svn@filebase}}% +\AtBeginOfFiles{% + \svn@ifequal{\currfileext}{tex}% + {\svn@inputsvx{\currfiledir\currfilebase}}% {}% } % \end{macrocode} @@ -4213,32 +4188,17 @@ patch generated macros '\string\pgf@image@<name>!' from the 'pgf' package!}% % \end{macrocode} % \end{macro} -% \subsection{Auxiliary file generation and read-back} -% -% Reread output from last compile run if it exists. -% \begin{macrocode} -\@input{\jobname .svn} -% \end{macrocode} +% \subsection{Write to Auxiliary File} -% \begin{macro}{\svn@checkwrite} -% Checks if .svn file is already open and if not opens it. This makes sure that -% the file is only created if really needed. The macro is only needed once, so -% it's redefines itself to |\relax| at the end. +% \begin{macro}{\svn@write} +% Simply an alias for the main aux file write handle. % \begin{macrocode} -\def\svn@checkwrite{% - \@ifundefined{svn@write}{% - \newwrite\svn@write - \immediate\openout\svn@write=\jobname.svn\relax% - \immediate\write\svn@write{\@percentchar\space SVN Keyword cache}% - %\immediate\write\svn@write{\noexpand\makeatletter}% - }{}% - \let\svn@checkwrite=\relax -} +\let\svn@write\@mainaux % \end{macrocode} % \end{macro} % % \begin{macro}{\svn@writesvn} -% This macro writes the |.svn| auxiliary file and is called from a +% This macro writes the |.aux| auxiliary file and is called from a % |\AtEndDocument| macro later on. % \begin{macrocode} {\catcode`\&=12 @@ -4253,21 +4213,20 @@ patch generated macros '\string\pgf@image@<name>!' from the 'pgf' package!}% % \end{macrocode} % Write document global values: % \begin{macrocode} - \svn@checkwrite \immediate\write\svn@write{^^J% \@percentchar\space Global values:^^J% - \noexpand\def\noexpand\svnrev{\@svn@rev}^^J% - \noexpand\let\noexpand\ifsvnmodified\@backslashchar\@svn@modified^^J% - \noexpand\def\noexpand\svndate{\@svn@date}^^J% - \noexpand\def\noexpand\svnauthor{\@svn@author}^^J% - \noexpand\def\noexpand\svnyear{\@svn@year}^^J% - \noexpand\def\noexpand\svnmonth{\@svn@month}^^J% - \noexpand\def\noexpand\svnday{\@svn@day}^^J% - \noexpand\def\noexpand\svnhour{\@svn@hour}^^J% - \noexpand\def\noexpand\svnminute{\@svn@minute}^^J% - \noexpand\def\noexpand\svnsecond{\@svn@second}^^J% - \noexpand\def\noexpand\svntimezonehour{\@svn@timezonehour}^^J% - \noexpand\def\noexpand\svntimezoneminute{\@svn@timezoneminute}^^J% + \noexpand\gdef\noexpand\svnrev{\@svn@rev}^^J% + \noexpand\global\noexpand\let\noexpand\ifsvnmodified\@backslashchar\@svn@modified^^J% + \noexpand\gdef\noexpand\svndate{\@svn@date}^^J% + \noexpand\gdef\noexpand\svnauthor{\@svn@author}^^J% + \noexpand\gdef\noexpand\svnyear{\@svn@year}^^J% + \noexpand\gdef\noexpand\svnmonth{\@svn@month}^^J% + \noexpand\gdef\noexpand\svnday{\@svn@day}^^J% + \noexpand\gdef\noexpand\svnhour{\@svn@hour}^^J% + \noexpand\gdef\noexpand\svnminute{\@svn@minute}^^J% + \noexpand\gdef\noexpand\svnsecond{\@svn@second}^^J% + \noexpand\gdef\noexpand\svntimezonehour{\@svn@timezonehour}^^J% + \noexpand\gdef\noexpand\svntimezoneminute{\@svn@timezoneminute}^^J% \noexpand\svn@gdefverb\noexpand\svnurl{\@svn@url}^^J% \noexpand\svn@gdefverb\noexpand\svnfname{\@svn@fname}^^J% }% @@ -4278,7 +4237,7 @@ patch generated macros '\string\pgf@image@<name>!' from the 'pgf' package!}% \if@svnmulti@groups \svn@cleanfilelist\@svng@@files \immediate\write\svn@write{% - \noexpand\def\noexpand\svng@@files{\@svng@@files}^^J% + \noexpand\gdef\noexpand\svng@@files{\@svng@@files}^^J% }% \svn@writeallgroups\@svng@@files % \end{macrocode} @@ -4295,10 +4254,6 @@ patch generated macros '\string\pgf@image@<name>!' from the 'pgf' package!}% \else \immediate\write\svn@write{^^J}% \fi -% \end{macrocode} -% Finally close output file: -% \begin{macrocode} - \immediate\closeout\svn@write% } % \end{macrocode} % \end{macro} @@ -4413,10 +4368,10 @@ patch generated macros '\string\pgf@image@<name>!' from the 'pgf' package!}% % \begin{macrocode} \if@svnmulti@autokwall -\svnmulti@atbegininputfile{% +\AtBeginOfFiles{% \expandafter - \ifx\csname svn@ignore@ext@\svn@fileext\endcsname\relax - \svnegetfile{\svn@filepath}% + \ifx\csname svn@ignore@ext@\currfileext\endcsname\relax + \svnegetfile{\currfilepath}% \fi } diff --git a/Master/texmf-dist/source/latex/svn-multi/svn-multi.ins b/Master/texmf-dist/source/latex/svn-multi/svn-multi.ins index 6d120c55696..9ae4d53330e 100644 --- a/Master/texmf-dist/source/latex/svn-multi/svn-multi.ins +++ b/Master/texmf-dist/source/latex/svn-multi/svn-multi.ins @@ -15,7 +15,7 @@ %% This work consists of the files svn-multi.dtx, svn-multi-pl.dtx, svn-multi.ins %% and the derived files svn-multi.sty, svnkw.sty and svn-multi.pl. %% -%% $Id: svn-multi.ins 1866 2010-07-19 11:17:15Z martin $ +%% $Id: svn-multi.ins 622 2009-03-23 12:27:16Z martin $ \input docstrip.tex |