[tex4ht-commits] [SCM] tex4ht updated: r1325 - trunk/lit
Michal Hoftich
INVALID.NOREPLY at gnu.org.ua
Fri Apr 21 15:23:47 CEST 2023
Author: michal_h21
Date: 2023-04-21 13:23:46 +0000 (Fri, 21 Apr 2023)
New Revision: 1325
Modified:
trunk/lit/ChangeLog
trunk/lit/mktex4ht-cnf.tex
trunk/lit/tex4ht-4ht.tex
trunk/lit/tex4ht-html4.tex
Log:
added support for the piton package
Modified: trunk/lit/ChangeLog
===================================================================
--- trunk/lit/ChangeLog 2023-04-16 14:49:41 UTC (rev 1324)
+++ trunk/lit/ChangeLog 2023-04-21 13:23:46 UTC (rev 1325)
@@ -1,3 +1,9 @@
+2023-04-21 Michal Hoftich <michal.h21 at gmail.com>
+
+ * tex4ht-4ht.tex (piton.4ht)
+ * tex4ht-html4.tex (html4.4ht): added support for the Piton package.
+ https://github.com/michal-h21/make4ht/issues/118
+
2023-04-16 Karl Berry <karl at freefriends.org>
* tex4ht-4ht.tex (JHEP.4ht, memhfixc.4ht):
Modified: trunk/lit/mktex4ht-cnf.tex
===================================================================
--- trunk/lit/mktex4ht-cnf.tex 2023-04-16 14:49:41 UTC (rev 1324)
+++ trunk/lit/mktex4ht-cnf.tex 2023-04-21 13:23:46 UTC (rev 1325)
@@ -177,6 +177,7 @@
\AddFile{7}{moreverb}
\AddFile{7}{fancyvrb}
\AddFile{9}{minted}
+\AddFile{9}{piton}
\AddFile{9}{pythontex}
\AddFile{9}{prosper}
\AddFile{9}{prosper-a}
Modified: trunk/lit/tex4ht-4ht.tex
===================================================================
--- trunk/lit/tex4ht-4ht.tex 2023-04-16 14:49:41 UTC (rev 1324)
+++ trunk/lit/tex4ht-4ht.tex 2023-04-21 13:23:46 UTC (rev 1325)
@@ -25904,7 +25904,134 @@
\:minted at def@opt at switch{breaklines}
>>>
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\Section{piton}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\<piton.4ht\><<<
+% piton.4ht (|version), generated from |jobname.tex
+% Copyright 2023 TeX Users Group
+|<TeX4ht license text|>
+
+\ExplSyntaxOn
+|<piton env|>
+|<piton inlines|>
+\ExplSyntaxOff
+\Hinput{piton}
+\endinput
+>>> \AddFile{9}{piton}
+
+\<piton env\><<<
+
+\NewConfigure{pitonline}{3}
+\NewConfigure{pitonnumber}{2}
+\protected\def\:tempa #1\__piton_end_line:{
+ \:pitonendignorelines\glet\:pitonendignorelines\relax
+ \group_begin:
+ % we set line in a box, because otherwise lines are collapsed sometimes
+ \hbox_set:Nn \l_tmpa_box{
+ \a:pitonline
+ \a:pitonnumber
+ \bool_if:NT \l__piton_line_numbers_bool
+ {
+ \bool_if:NF \l__piton_all_line_numbers_bool
+ { \tl_if_eq:nnF { #1 } { \PitonStyle {Prompt}{} } } % corrected 2023/04/10
+ \__piton_print_number:
+ }
+ \b:pitonnumber
+ \language = -1
+ \raggedright
+ \strut
+ % \HCode{<code>}
+ \b:pitonline
+ \NoFonts
+ \__piton_replace_spaces:n { #1 }
+ \EndNoFonts
+ %
+ \c:pitonline
+ }
+ \box_use_drop:N \l_tmpa_box
+ \group_end:
+}
+\HLet\__piton_begin_line:\:tempa
+
+
+\NewConfigure{piton}{2}
+
+% Piton environments and file input produces extra blank line at the start
+% we use TeX4ht specials to remove them
+\gdef\:pitonendignorelines{}
+\pend:def\__piton_pre_env:{\a:piton
+ \ht:special{t4ht@[}% ignore next linebreak, to preven spurious blank line at the beginning of listings
+ \gdef\:pitonendignorelines{\ht:special{t4ht@]}}
+}
+\append:def\__piton_width_to_aux:{\b:piton}
+
+>>>
+
+\<piton inlines\><<<
+\NewDocumentCommand { \:__piton_piton_standard } { m }
+ {
+ \group_begin:
+ \ttfamily
+ \a:pitonline\b:pitonline
+ \automatichyphenmode = 1
+ \cs_set_eq:NN \\ \c_backslash_str
+ \cs_set_eq:NN \% \c_percent_str
+ \cs_set_eq:NN \{ \c_left_brace_str
+ \cs_set_eq:NN \} \c_right_brace_str
+ \cs_set_eq:NN \$ \c_dollar_str
+ \cs_set_eq:cN { ~ } \space
+ \cs_set_protected:Npn \__piton_begin_line: { }
+ \cs_set_protected:Npn \__piton_end_line: { }
+ \tl_set:Nx \l_tmpa_tl
+ {
+ \lua_now:e
+ { piton.ParseBis('\l__piton_language_str',token.scan_string()) }
+ { #1 }
+ }
+ \bool_if:NTF \l__piton_show_spaces_bool
+ { \regex_replace_all:nnN { \x20 } { ^^^^2423 } \l_tmpa_tl } % U+2423
+ {
+ \bool_if:NT \l__piton_break_lines_in_piton_bool
+ { \regex_replace_all:nnN { \x20 } { \x20 } \l_tmpa_tl }
+ }
+ % our extra code to remove the space glyph
+ \regex_replace_all:nnN { \x20 } { \c { __piton_breakable_space: } } \l_tmpa_tl
+ \l_tmpa_tl
+ \c:pitonline
+ \group_end:
+ }
+
+\HLet\__piton_piton_standard\:__piton_piton_standard
+
+\NewDocumentCommand { \:__piton_piton_verbatim } { v }
+ {
+ \group_begin:
+ \ttfamily
+ \a:pitonline\b:pitonline
+ \automatichyphenmode = 1
+ \cs_set_protected:Npn \__piton_begin_line: { }
+ \cs_set_protected:Npn \__piton_end_line: { }
+ \tl_set:Nx \l_tmpa_tl
+ {
+ \lua_now:e
+ { piton.Parse('\l__piton_language_str',token.scan_string()) }
+ { #1 }
+ }
+ \bool_if:NT \l__piton_show_spaces_bool
+ { \regex_replace_all:nnN { \x20 } { ^^^^2423 } \l_tmpa_tl } % U+2423
+ % our extra code to remove the space glyph
+ \regex_replace_all:nnN { \x20 } { \c { __piton_breakable_space: } } \l_tmpa_tl
+ \l_tmpa_tl
+ \c:pitonline
+ \group_end:
+ }
+
+\HLet\__piton_piton_verbatim\:__piton_piton_verbatim
+>>>
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{pythontex}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Modified: trunk/lit/tex4ht-html4.tex
===================================================================
--- trunk/lit/tex4ht-html4.tex 2023-04-16 14:49:41 UTC (rev 1324)
+++ trunk/lit/tex4ht-html4.tex 2023-04-21 13:23:46 UTC (rev 1325)
@@ -15385,7 +15385,30 @@
>>>
+%%%%%%%%%%%%%%%%%%%%
+\subsection{piton}
+%%%%%%%%%%%%%%%%%%%%
+\<configure html4 piton\><<<
+% handle \color commands
+% piton already uses hexadecimal colors, so we don't need to convert them for use in CSS
+\def\:endundeclaredcolor{\HCode{</span>}}
+\def\:undeclaredcolor[#1]#2{\o:@undeclaredcolor:[#1]{#2}
+\HCode{<span style="color:\##2">}\aftergroup\:endundeclaredcolor
+}
+
+\Configure{piton}{%
+ \ifvmode\IgnorePar\fi\EndP\HCode{<pre class="piton">}\HtmlParOff\NoFonts%
+ \Configure{newline}{\HCode{\Hnewline}}% don't insert any special tags for newlines, only newline characters
+}
+{\EndNoFonts\HCode{</pre>}\HtmlParOn}
+
+\Configure{pitonline}{\HLet\@undeclaredcolor\:undeclaredcolor}{\HCode{<code style="white-space:pre">}}{\HCode{</code>}}
+\Configure{pitonnumber}{\HCode{<span class="linenumber">}}{\HCode{</span>}}
+\Css{pre.piton{font-family: monospace,monospace; font-size:1rem; text-align:left; clear:both; }}
+\Css{.piton .linenumber{font-size: small; margin-right: 1em;}}
+>>>
+
%%%%%%%%%%%%%%%%%%%%
\subsection{pythontex}
%%%%%%%%%%%%%%%%%%%%
More information about the tex4ht-commits
mailing list.