[tex4ht-commits] [SCM] tex4ht updated: r169 - trunk/protex
karl at gnu.org.ua
karl at gnu.org.ua
Mon Jun 6 20:02:49 CEST 2016
Author: karl
Date: 2016-06-06 21:02:49 +0300 (Mon, 06 Jun 2016)
New Revision: 169
Added:
trunk/protex/ChangeLog
Modified:
trunk/protex/AlProTex.sty
trunk/protex/ProTex.sty
Log:
new protex option CodeLineNo for #line in C and similar; https://puszcza.gnu.org.ua/bugs/?136
Modified: trunk/protex/AlProTex.sty
===================================================================
--- trunk/protex/AlProTex.sty 2016-06-05 22:55:02 UTC (rev 168)
+++ trunk/protex/AlProTex.sty 2016-06-06 18:02:49 UTC (rev 169)
@@ -953,6 +953,21 @@
\:temp}}
\fi
\fi
+
+%% Set source line numbers in the output
+%% \srclineBOL{symbol} - to change a beginning-of-line symbol
+%% \CodeInputLine - to change all the string.
+%%
+\:CheckOption{CodeLineNo}
+\if:Option
+ %% Set beginning-of-line symbol to #
+ %% if extension is c (case sensitive)
+ \if\:InitAlProTex c\relax
+ \srclineBOL{\#}
+ \fi
+ \SetOutputWithLineNo
+\fi
+
\:CheckOption{eline}
\catcode`\%=12
\if:Option
Modified: trunk/protex/ProTex.sty
===================================================================
--- trunk/protex/ProTex.sty 2016-06-05 22:55:02 UTC (rev 168)
+++ trunk/protex/ProTex.sty 2016-06-06 18:02:49 UTC (rev 169)
@@ -67,13 +67,29 @@
\newtoks\:tokens
\def\:ExpandDef#1#2#3{%
\:tokens=\expandafter{#1#2}%
- \xdef#1{\the\:tokens #3}}\def\:defaultcats{%
+ \xdef#1{\the\:tokens #3}}
+
+\def\:defaultcats{%
\:NoSpecials{12}{0}{255}%
\:NoSpecials{11}{65}{90}%
\:NoSpecials{11}{97}{122}%
\catcode`\\=0 \catcode`\{=1 \catcode`\}=2
\catcode`\ =13 \catcode`\^^M=13 \catcode`\^^I=13 }
+\newtoks\:tokensi
+\newtoks\:tokensii
+\def\:ExpandDefSrcLineNo#1#2#3{%
+ \:tokens=\expandafter{#1}%
+ \:tokensii={#2}%
+ \edef\@a@{\noexpand\:tokensi={\CodeInputLine}}\@a@
+ \xdef#1{\the\:tokens\the\:tokensi\the\:tokensii #3}}
+\def\:srclinebol{\%}
+\def\srclineBOL#1{\gdef\:srclinebol{#1}}
+\def\CodeInputLine{%
+ ^^J\:srclinebol line \CodeInputLineNo\space "./\jobname.tex"^^J}%
+\def\SetOutputWithLineNo{\let\:ExpandDef\:ExpandDefSrcLineNo}
+\let\CodeLineNo\SetOutputWithLineNo
+
\def\:NoSpecials#1#2#3{\edef\:temp{\the\:CodeNumber}%
\global\:CodeNumber=#3
\def\:next{\catcode\:CodeNumber=#1
More information about the tex4ht-commits
mailing list