diff options
author | Karl Berry <karl@freefriends.org> | 2010-10-25 23:07:02 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-10-25 23:07:02 +0000 |
commit | 7df33fd1a4e61f23710ae0167ae14e4a01c1d483 (patch) | |
tree | cd84819c8b0a3db635563f7a6deced9726216c8c /Master/texmf-dist/tex/latex | |
parent | 8e702cd6feaf0a000bfa3a3cdb0bcd66c114a0fe (diff) |
new latex package catchfilebetweentags (25oct10)
git-svn-id: svn://tug.org/texlive/trunk@20204 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/catchfilebetweentags/catchfilebetweentags.sty | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/catchfilebetweentags/catchfilebetweentags.sty b/Master/texmf-dist/tex/latex/catchfilebetweentags/catchfilebetweentags.sty new file mode 100644 index 00000000000..e201739d3f7 --- /dev/null +++ b/Master/texmf-dist/tex/latex/catchfilebetweentags/catchfilebetweentags.sty @@ -0,0 +1,111 @@ +%% +%% This is file `catchfilebetweentags.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% catchfilebetweentags.dtx (with options: `package') +%% +%% This is a generated file. +%% +%% catchfilebetweentags : 2010/06/20 v1.0 - catchfilebetweentags : catch file between delimiters or tags +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3 of this license or (at your option) any later +%% version. The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% +%% This work consists of the main source file catchfilebetweentags.dtx +%% and the derived files +%% catchfilebetweentags.sty, catchfilebetweentags.pdf, catchfilebetweentags.ins, +%% +%% catchfilebetweentags : catchfilebetweentags : a new dimen corresponding to the remainder of the line +%% Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr> +%% +\NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX) + [2005/12/01]% LaTeX must be 2005/12/01 or younger +\ProvidesPackage{catchfilebetweentags} + [2010/06/20 v1.0 - Catch file between tags (FOC)] +\RequirePackage{etex,etoolbox,ltxcmds} +\RequirePackage{catchfile} +\globtoks\CatchFBT@tok +\newrobustcmd*\CatchFileBetweenDelims[4]{% + \begingroup + \edef\CatchFileBetweenDelims{\endgroup + \noexpand\@testopt + {\CatchFBT@Work{\noexpand#1}{#2}{#3}{#4}} + {\noexpand\makeatletter}% + }\CatchFileBetweenDelims +}% \CatchFileBetweenDelims +\newcommand\CatchFileBetweenTags{} +\begingroup +\@makeother\<% +\@makeother\>% +\@makeother\*% +\catcode`\: 14% +\@makeother\%: +\gdef\CatchFileBetweenTags#1#2#3{: + \CatchFileBetweenDelims\CatchFBT@tok{#2}{%<*#3>}{%</#3>}[\CatchFBT@sanitize]: + \CatchFBT@Final{#1}: +}:% \CatchFileBetweenTags +\endgroup +\newrobustcmd*\ExecuteMetaData[2][\jobname]{% + \CatchFileBetweenTags\CatchFBT@tok{#1}{#2}% + \global\expandafter\CatchFBT@tok\expandafter{% + \expandafter}\the\CatchFBT@tok +}% \ExecuteMetaData +\long\protected\def\CatchFBT@Work#1#2#3#4[#5]{% + \def\CatchFBT@setup{#5% + \long\def\CatchFile@Do####1#3{\CatchFBT@catchthepart}% discard before start-delim + \long\edef\CatchFBT@catchthepart####1#4{% capture until end-delim + \CatchFBT@tok{\endgroup + \CatchFBT@IsAToken#1 + {\global\noexpand#1{####1}} + {\xdef\noexpand#1{\noexpand\unexpanded{####1}}}}% + \noexpand\CatchFBT@discardtherest}% + \long\expandafter\def + \expandafter\CatchFBT@discardtherest + \expandafter####\expandafter1\CatchFile@EOF{}% + \everyeof{#3#4}% + \everyeof\expandafter\expandafter\expandafter{% + \expandafter\the\expandafter\everyeof\CatchFile@EOF + \expandafter\the\expandafter\CatchFBT@tok\noexpand}}% + \CatchFileDef#1{#2}\CatchFBT@setup +}% \CatchFBT@Work +\def\CatchFBT@sanitize{% + \@sanitize + \@makeother\{% + \@makeother\}% + \endlinechar=`\^^J% +}% \CatchFBT@sanitize +\newrobustcmd*\CatchFBT@Final[1]{\@testopt + {\CatchFBT@Fin@l{#1}}{}% +}% \CatchFBT@Final +\def\CatchFBT@Fin@l#1[#2]{% + \begingroup + \endlinechar\m@ne \makeatletter #2% + \scantokens\expandafter{% + \expandafter\CatchFBT@tok\expandafter{\the\CatchFBT@tok}}% + \CatchFBT@IsAToken{#1} + {\global#1\expandafter{\the\CatchFBT@tok}} + {\xdef#1{\the\CatchFBT@tok}}% + \ifx\CatchFBT@tok#1\else\global\CatchFBT@tok{}\fi + \endgroup +}% \CatchFBT@Final +\def\CatchFBT@IsAToken#1{% + \expandafter\expandafter + \expandafter\CatchFBT@Is@Token + \expandafter\meaning\expandafter#1\string\toks + \\\\{first}{second}\\\\% +}% \CatchFBT@IsAToken +\expandafter\def\expandafter\CatchFBT@Is@Token + \expandafter#\expandafter1\string\toks#2#3\\#4#5#6\\\\{% + \csname ltx@% + \if\relax\detokenize{#1}\relax#5% + \else second\fi oftwo% + \endcsname +}% \CatchFBT@Is@Token +\endinput +%% +%% End of file `catchfilebetweentags.sty'. |