diff options
author | Karl Berry <karl@freefriends.org> | 2011-05-24 23:30:42 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-05-24 23:30:42 +0000 |
commit | 326e706a1aab60c8759d18732d105d26d3879352 (patch) | |
tree | 51043e1582d04678ad5e8786d3fef644c29f23d2 /Master/texmf-dist/source/lualatex/luacode | |
parent | c2e2309fda3600a470a0026ef17f98b44dfb3f40 (diff) |
luacode (24may11)
git-svn-id: svn://tug.org/texlive/trunk@22605 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/lualatex/luacode')
-rw-r--r-- | Master/texmf-dist/source/lualatex/luacode/Makefile | 4 | ||||
-rw-r--r-- | Master/texmf-dist/source/lualatex/luacode/luacode.dtx | 80 |
2 files changed, 46 insertions, 38 deletions
diff --git a/Master/texmf-dist/source/lualatex/luacode/Makefile b/Master/texmf-dist/source/lualatex/luacode/Makefile index ba571fd3225..86534b2bad9 100644 --- a/Master/texmf-dist/source/lualatex/luacode/Makefile +++ b/Master/texmf-dist/source/lualatex/luacode/Makefile @@ -34,7 +34,7 @@ world: ctan .PHONY: all doc unpack ctan tds check world %.pdf: %.dtx - latexmk -silent $< >/dev/null + latexmk -pdf -silent $< >/dev/null $(UNPACKED): $(DTX) tex -interaction=batchmode $< >/dev/null @@ -70,7 +70,7 @@ install: check $(ALL) clean: @latexmk -silent -c $(DTX) >/dev/null - @rm -f -- *.log + @rm -f -- test-*.log test-*.aux test-*.pdf mrproper: clean @rm -f -- $(GENERATED) $(ZIPS) diff --git a/Master/texmf-dist/source/lualatex/luacode/luacode.dtx b/Master/texmf-dist/source/lualatex/luacode/luacode.dtx index 0f78f04753c..498d5840768 100644 --- a/Master/texmf-dist/source/lualatex/luacode/luacode.dtx +++ b/Master/texmf-dist/source/lualatex/luacode/luacode.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment (by the way, this file is contains UTF-8) % -% Written in 2010 by Manuel Pégourié-Gonnard <mpg@elzevir.fr> +% Written in 2010, 2011 by Manuel Pégourié-Gonnard <mpg@elzevir.fr> % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -140,29 +140,29 @@ See the source file for author and licensing information. % % For an introduction to the most important gotchas of |\directlua|, see % \file{lualatex-doc.pdf}. Before presenting the tools in this package, let me -% insist that the most robust way to manage a non-trivial piece of Lua code is -% to use an external file and source it from Lua, as explained in the cited -% document. +% insist that the best way to manage a non-trivial piece of Lua code is +% probably to use an external file and source it from Lua, as explained in the +% cited document. % % \medskip % % First, the exact syntax of |\directlua| has changed along version of % Lua\TeX, so this package provides a |\luadirect| command which is an exact % synonym of |\directlua| except that it doesn't have the funny, changing -% parts of its syntax.\footnote{And also, it expands in two steps instead of -% one. If you don't known what it means, then you probably don't need to.} +% parts of its syntax.\footnote{And it expands in two steps If you don't known +% what it means, then you hopefully don't need to.} % % The problems with |\directlua| (or |\luadirect|) are mainly with \TeX\ % special characters. Actually, things are not that bad, since most special % characters do work, namely: |_|, |^|, |&|, \verb+$+, |{|, |}|. Three are a % bit tricky but they can be managed with |\string|: |\| and |~|. Only |%| is % really hard to obtain. Also, \TeX\ macros are expanded, which is good since -% it allows to pass information from \TeX\ to Lua, but you must be carefull +% it allows to pass information from \TeX\ to Lua, but you must be careful % and use only purely expandable macros. % % The |\luaexec| command is similar to |\luadirect| but with a few additional % features:\footnote{And one major drawback: it is not purely expandable. See -% above.} |\\| gives a double blackslash (convenient in Lua strings), |\%| a +% above.} |\\| gives a double backslash (convenient in Lua strings), |\%| a % percent character, and |~| just works. If you happen to need a single % backslash, you can still use a construct like |\string\n| just as with % |\luadirect|. Also, \TeX\ macros are expanded. @@ -217,44 +217,46 @@ See the source file for author and licensing information. % Catcode defenses. % % \begin{macrocode} -\begingroup +\begingroup\catcode61\catcode48\catcode32=10\relax% = and space \catcode123 1 % { \catcode125 2 % } \catcode 35 6 % # - \toks0{}% - \def\x{}% + \toks0{\endlinechar\the\endlinechar}% + \edef\x{\endlinechar13}% \def\y#1 #2 {% \toks0\expandafter{\the\toks0 \catcode#1 \the\catcode#1}% \edef\x{\x \catcode#1 #2}}% - \y 123 1 % { - \y 125 2 % } - \y 35 6 % # - \y 10 12 % ^^J - \y 34 12 % " - \y 36 3 % $ $ + \y 13 5 % carriage return + \y 61 12 % = + \y 32 10 % space + \y 123 1 % { + \y 125 2 % } + \y 35 6 % # + \y 64 11 % @ (letter) \y 39 12 % ' \y 40 12 % ( \y 41 12 % ) \y 42 12 % * - \y 43 12 % + - \y 44 12 % , \y 45 12 % - \y 46 12 % . \y 47 12 % / - \y 60 12 % < - \y 61 12 % = - \y 64 11 % @ (letter) - \y 62 12 % > - \y 95 12 % _ (other!) + \y 91 12 % [ + \y 93 12 % ] + \y 94 7 % ^ \y 96 12 % ` - \edef\y#1{\endgroup\edef#1{\the\toks0\relax}\x}% -\expandafter\y\csname luacode@AtEnd\endcsname + \y 126 13 % ~ + \toks0\expandafter{\the\toks0 \relax\noexpand\endinput}% + \edef\y#1{\noexpand\expandafter\endgroup% + \noexpand\ifx#1\relax \edef#1{\the\toks0}\x\relax% + \noexpand\else \noexpand\expandafter\noexpand\endinput% + \noexpand\fi}% +\expandafter\y\csname luacode@sty@endinput\endcsname% % \end{macrocode} % % Package declaration. % % \begin{macrocode} -\ProvidesPackage{luacode}[2010/11/08 v1.0 lua-in-tex helpers (mpg)] +\ProvidesPackage{luacode}[2011/05/24 v1.0 lua-in-tex helpers (mpg)] % \end{macrocode} % % Make sure Lua\TeX\ is used. @@ -266,17 +268,14 @@ See the source file for author and licensing information. This package can only be used with the LuaTeX engine\MessageBreak (command `lualatex'). Package loading has been stopped\MessageBreak to prevent additional errors.} - \lltxb@core@AtEnd - \expandafter\endinput + \expandafter\luacode@sty@endinput \fi % \end{macrocode} % -% Use \pk{luatexbase} for catcode tables, and ensure we have the primitives -% we need. +% Use \pk{luatexbase} for catcode tables. % % \begin{macrocode} \RequirePackage{luatexbase} -\luatexbase@ensure@primitive{scantextokens}% % \end{macrocode} % % \subsection{Internal code} @@ -344,7 +343,7 @@ See the source file for author and licensing information. % depending on the current catcode regime. So we collect it linewise and % check each line against the end marker. % -% Sotrage for lines. +% Storage for lines. % % \begin{macrocode} \newtoks\luacode@lines @@ -407,16 +406,25 @@ See the source file for author and licensing information. % everything other, except backslash, braces and letters which retain their % natural catcodes. % +% Be carefull about the name of the macro for setting catcode ranges which +% is currently changing in luatexbase. The group here doesn't matter since +% catcode table settings are always global. +% % \begin{macrocode} \newluatexcatcodetable \luacode@table@soft +\begingroup +\ifdefined\SetCatcodeRange \else + \let\SetCatcodeRange\setcatcoderange +\fi \setluatexcatcodetable \luacode@table@soft {% \luatexcatcodetable\CatcodeTableOther \catcode 92 0 \catcode 123 1 \catcode 125 2 - \setcatcoderange {65}{90} {11} - \setcatcoderange {97}{122}{11} + \SetCatcodeRange {65}{90} {11} + \SetCatcodeRange {97}{122}{11} } +\endgroup % \end{macrocode} % % \subsection{Public macros and environments} @@ -440,7 +448,7 @@ See the source file for author and licensing information. % We're already done! % % \begin{macrocode} -\luacode@AtEnd +\luacode@sty@endinput %</texpackage> % \end{macrocode} % |