diff options
author | Karl Berry <karl@freefriends.org> | 2011-12-29 23:02:47 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-12-29 23:02:47 +0000 |
commit | 56ecd0d3d0de54cebdeb29cc8a056001ee93b02e (patch) | |
tree | 04502c1a012256ad6d34c6150c8812f4dc1a663c /Master/texmf-dist/tex/lualatex | |
parent | 1ff96ce12187f58bcdc638d5b3187f8a270b23ca (diff) |
luacode 1.2 (29dec11)
git-svn-id: svn://tug.org/texlive/trunk@24969 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/lualatex')
-rw-r--r-- | Master/texmf-dist/tex/lualatex/luacode/luacode.sty | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/Master/texmf-dist/tex/lualatex/luacode/luacode.sty b/Master/texmf-dist/tex/lualatex/luacode/luacode.sty index 68f281f425f..6acca9a7149 100644 --- a/Master/texmf-dist/tex/lualatex/luacode/luacode.sty +++ b/Master/texmf-dist/tex/lualatex/luacode/luacode.sty @@ -42,7 +42,7 @@ \noexpand\else \noexpand\expandafter\noexpand\endinput% \noexpand\fi}% \expandafter\y\csname luacode@sty@endinput\endcsname% -\ProvidesPackage{luacode}[2011/05/24 v1.0 lua-in-tex helpers (mpg)] +\ProvidesPackage{luacode}[2011/12/29 v1.2 lua-in-tex helpers (mpg)] \RequirePackage{ifluatex} \ifluatex\else \PackageError{luacode}{LuaTeX is required for this package. Aborting.}{% @@ -52,9 +52,22 @@ \expandafter\luacode@sty@endinput \fi \RequirePackage{luatexbase} +\newcommand \luacode@printdbg [1] {% + texio.write_nl('log', + '-- BEGIN luacode debug (on input line \the\inputlineno)') + texio.write_nl('log', "\luatexluaescapestring{#1}") + texio.write_nl('log', + '-- END luacode debug (on input line \the\inputlineno)') +} +\newcommand \luacode@dbg@exec [1] {% + \directlua { + \luacode@maybe@printdbg{#1} + #1 + }% +} \begingroup \catcode`\~\active \expandafter\endgroup \@firstofone{% - \newcommand*\luacode@execute [1] {% + \newcommand \luacode@execute [1] {% \begingroup \escapechar92 \newlinechar10 @@ -63,7 +76,7 @@ \let\%=\luacode@percentchar \let\#=\luacode@sharpchar \expandafter\expandafter\expandafter\endgroup - \luatexbase@directlua{#1}} + \luacode@dbg@exec{#1}} } \begingroup \escapechar\m@ne \edef\aux{\endgroup \unexpanded{\newcommand\luacode@percentchar}{\string\%}% @@ -85,8 +98,8 @@ \luacode@next} \newtoks\luacode@lines \newcommand*\luacode@addline [1] {% - \luacode@lines\expandafter{\the\luacode@lines^^J#1}} -\newcommand \luacode@grab@body { + \luacode@lines\expandafter{\the\luacode@lines#1^^J}} +\newcommand \luacode@grab@body [1] { \luacode@lines{}% \endlinechar10 \luacode@grab@lines} @@ -133,12 +146,18 @@ \SetCatcodeRange {97}{122}{11} } \endgroup -\@ifdefinable\luadirect {\let\luadirect\luatexbase@directlua} +\newcommand \LuaCodeDebugOn {\let \luacode@maybe@printdbg \luacode@printdbg} +\newcommand \LuaCodeDebugOff {\let \luacode@maybe@printdbg \@gobble} +\LuaCodeDebugOff +\@ifdefinable\luadirect {\let\luadirect\luacode@dbg@exec} \newcommand*\luaexec [1] {\luacode@execute{#1}} \newenvironment {luacode} {\luacode@begin\luacode@table@soft} {} \newenvironment {luacode*} {\luacode@begin\CatcodeTableOther} {} \newcommand \luacodestar {\@nameuse{luacode*}} \def \endluacodestar {\@nameuse{endluacode*}} +\newcommand \luastring [1] {"\luatexluaescapestring{#1}"} +\newcommand \luastringO [1] {\luastring{\unexpanded\expandafter{#1}}} +\newcommand \luastringN [1] {\luastring{\unexpanded{#1}}} \luacode@sty@endinput \endinput %% |