| 1 |
\def\inputluafile#1 {\directlua{dofile(kpse.find_file("#1"))}} |
| 2 |
|
| 3 |
\inputluafile base.ptxlua |
| 4 |
|
| 5 |
\def\ptx@lua{\directlua name {Internal PiTeX chunk}} |
| 6 |
|
| 7 |
\newcatcodetable\luacatcodes{\#\%\^^M\~=12} |
| 8 |
\newtoks\ptx@luacode_list |
| 9 |
\newif\ifptx@luacode_store |
| 10 |
% Mimicks a block (\newblock isn't defined yet |
| 11 |
% and anyway it wouldn't be very useful). |
| 12 |
\def\luacode{% |
| 13 |
\begingroup |
| 14 |
\catcodetable\luacatcodes |
| 15 |
\ifnext[ |
| 16 |
{\ptx@luacode_store} |
| 17 |
{\ptx@luacode_store[]}} |
| 18 |
\bgroup |
| 19 |
\setcatcodes{\^^M=12}% |
| 20 |
\long\gdef\ptx@luacode_store[#1]^^M#2\luacode/{% So line count is right. |
| 21 |
\endgroup% |
| 22 |
\ifemptystring{#1}% |
| 23 |
{\ptx@lua{#2}}% |
| 24 |
{\def#1{#2}}% |
| 25 |
}% |
| 26 |
\egroup |