Debian Codegraph @

texmf-dist/tex/optex/base/hisyntax-html.opm

raw
1 %% This is part of the OpTeX project, see http://petr.olsak.net/optex
2
3 \_codedecl\_hisyntaxhtml {Syntax highlighting for html or xml sources <2022-05-12>}
4
5 \_newtoks\_hisyntaxhtml \_newtoks\_hicolorshtml
6
7 \_global\_hicolorshtml={% colors in html codes
8 \_hicolor A \Cyan % <, > and parameters
9 \_hicolor T \Red % tag names
10 \_hicolor C \Green % comments
11 \_hicolor E \Blue % HTML entities
12 \_hicolor S \Magenta % strings in parameters
13 }
14 \_global\_hisyntaxhtml={
15 \_the\_hicolorshtml
16 \_replfromto{<!--}{-->}{\x C{<!--#1-->}}
17 \_replthis{<}{\y{_hitaghtml}}
18 \_replthis{\_string&}{\y{_hientityhtml}}
19 }
20 \_bgroup \_lccode`\~=`\ \_lowercase{\_egroup
21 \_gdef\_hitaghtml#1>{\_hitaghtmlA#1~>}
22 \_gdef\_hitaghtmlA#1~#2>}{\z A{<}\z T{#1}\_def\_tmpb{#2^}%
23 \_if^\_tmpb
24 \_else \_space
25 \_replthis{\ ^}{}\_replfromto{"}{"}{\_histringhtml{"##1"}}\z A{\_tmpb}\_fi
26 \z A{>}%
27 }
28 \_gdef\_histringhtml#1{\_visiblesp \z S{#1}}
29 \_gdef\_hientityhtml#1;{\z E{\&#1;}}
30
31 \_endcode %------------------------------------------------
32
33 2022-05-12 \_hitaghtmlA #1~#2: bug fixed
34 2020-04-03 released