summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/tex4ht/mkht.4ht
blob: a186116620fb7ba3c3fbae47fccb708469066be5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
% mkht.4ht (2020-11-23-10:05), generated from tex4ht-mkht.tex
% Copyright 2009-2020 TeX Users Group
% Copyright 1997-2009 Eitan M. Gurari
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
% version 1.3c of this license or (at your option) any
% later version. The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions
% of LaTeX version 2005/12/01 or later.
%
% This work has the LPPL maintenance status "maintained".
%
% The Current Maintainer of this work
% is the TeX4ht Project <https://tug.org/tex4ht>.
%
% If you modify this program, changing the
% version identification would be appreciated.
%
\immediate\write-1{version \ifx \JOBNAME\UnDefined 2020-11-23-10:05\else |version\fi}

\immediate\write-1{version 2020-11-23-10:05}

\def\exit{\documentclass{article}\begin{document}\end{document}\endinput}
\bgroup
  \def\missing#1{\aftergroup\exit
     \immediate\write16{---------------------------- error
        ----------------------------
        ^^JRequires #1ProTex.sty from
        https://tug.org/tex4ht^^J%
       ---------------------------------------------------------------}}
  \openin15=ProTex.sty \ifeof15 \missing{}\else \closein15 \fi
  \openin15=AlProTex.sty \ifeof15 \missing{Al}\else \closein15 \fi
\egroup

\let\ScriptFileName\relax
\let\AddExtn\relax

\documentclass{article}

\ifx \HCode\UnDef
  \input tex4ht.sty
  \Preamble{xhtml}
  \input ProTex.sty
  \AlProTex{foo,<<<>>>,|,title,list}
  \begin{document}
  \EndPreamble
\else
  \Configure{ProTex}{foo,<<<>>>,|,title,list,[[]]}
  \begin{document}
\fi

\catcode`\:=11
\def\OutputCodE\<#1.#2\>{{\xdef\ScriptFileName{#1}
   \:DoName\def{#1}{\<#1.#2\>}
   \OutputCode[#2]\<#1\>}}
\def\winextn{bat}
\def\AddExtn{\ifx\ext\winextn .bat\fi}

\tableofcontents

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{LaTeX}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\<htlatex ...\><<<
|<unix line|>|<windows line|>
        |<latex|>
        |<latex|>
        |<latex|>
        |<base|>tex4ht |<dir ch|>|<@|>1  |<III|>
        |<base|>t4ht |<dir ch|>|<@|>1 |<IV|>

>>>


\<latex\><<<
latex |<@|>5 |<'|>|<definitions|>|<get parameters|>|empty>>>

\<get parameters\><<<
\HCode |<'|>|<@|>2|<'|>.a.b.c.\input |<'|> |<@|>1>>>


\<definitions\><<<
\makeatletter|<get 2nd arg|>|<2e + 209|>\makeatother>>>

\<get 2nd arg\><<<
\def\HCode{\futurelet\HCode\HChar}\def\HChar{|<double quotes?|>}>>>

\<double quotes?\><<<
\ifx"\HCode|<remove qts|>\expandafter\HCode\else\expandafter\Link\fi>>>

\<remove qts\><<<
\def\HCode"##1"{\Link##1}>>>


\<2e + 209\><<<
\def\Link#1.a.b.c.{|<2e|>|<209|>}>>>

\<2e\><<<
\g@addto@macro\@documentclasshook{|<require package|>}>>>

\<209\><<<
|<save|>\def\documentstyle{|<recall|>|<options|>|<209+tex4ht|>}>>>

\<require package\><<<
\RequirePackage[#1|<II|>|<,html|>]{tex4ht}>>>


\<options\><<<
|<def tex4ht|>{#1|<II|>|<,html|>}>>>


\<209+tex4ht\><<<
|<209+tex4ht+...|>\@ifnextchar[{\HCode}{\documentstyle[tex4ht]}>>>

\<209+tex4ht+...\><<<
\def\HCode####1{\documentstyle[tex4ht,}>>>


\<save\><<<
\let\HCode\documentstyle>>>

\<recall\><<<
\let\documentstyle\HCode>>>



\<htlatex 2e...\><<<
|<unix line|>|<windows line|>|<latex2e|>
        |<latex2e|>
        |<latex2e|>
        |<base|>tex4ht |<dir ch|>|<@|>1  |<III|>
        |<base|>t4ht |<dir ch|>|<@|>1 |<IV|>

>>>




\<latex2e\><<<
latex |<@|>5 |<'|>|<definitions2e|>|<get parameters|>|empty>>>

\<definitions2e\><<<
\makeatletter|<get 2nd arg|>|<2e only|>\makeatother>>>


\<2e only\><<<
\def\Link#1.a.b.c.{|<2e|>}>>>





\<htlatex 209...\><<<
|<unix line|>|<windows line|>|<latex209|>
        |<latex209|>
        |<latex209|>
        |<base|>tex4ht |<dir ch|>|<@|>1  |<III|>
        |<base|>t4ht |<dir ch|>|<@|>1 |<IV|>

>>>




\<latex209\><<<
latex  |<@|>5 |<'|>|<definitions209|>|<get parameters|>|empty>>>

\<definitions209\><<<
\makeatletter|<get 2nd arg|>|<209 only|>\makeatother>>>


\<209 only\><<<
\def\Link#1.a.b.c.{|<209|>}>>>


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{TeX}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\<httex...\><<<
|<unix line|>|<windows line|>|<tex|>
        |<tex|>
        |<tex|>
        |<base|>tex4ht |<dir ch|>|<@|>1 |<III|>
        |<base|>t4ht |<dir ch|>|<@|>1 |<IV|>

>>>

\<tex\><<<
etex  |<@|>5 |<'|>|<tex definitions|>|<get parameters|>|empty>>>


\<tex definitions\><<<
|<set hook|>|<get 2nd arg|>|empty>>>

\<set hook\><<<
\def\Link#1.a.b.c.{|<def tex4ht|>{|<options|>\input tex4ht.sty }}>>>


\<def tex4ht\><<<
\expandafter\def\csname tex4ht\endcsname>>>

%%%%%%%%%%%%%%%%%%%%
\section{Texinfo}
%%%%%%%%%%%%%%%%%%%%

The loading of tex4ht takes place at the @rm command at the end of the
texinfo.tex file.

\<httexi...\><<<
|<unix line|>|<windows line|>|<texinfo|>
        |<texinfo|>
        |<texinfo|>
        |<base|>tex4ht |<dir ch|>|<@|>1 |<III|>
        |<base|>t4ht |<dir ch|>|<@|>1 |<IV|>
|<Rem|>        texindex ?

>>>

\<texinfo\><<<
etex |<@|>5 |<'|>|<texinfo definitions|>|<get parameters|>|empty>>>


\<texinfo definitions\><<<
|<tex definitions|>\let\svrm=\rm\def\rm{\svrm|<tex4ht into texinfo|>}>>>

\<tex4ht into texinfo\><<<
\ifx\c\comment\def\rm{\let\rm=\svrm|<load into texinfo|>}\expandafter\rm\fi>>>

\<load into texinfo\><<<
|<change cats|>\csname tex4ht\endcsname|<restore cats|>|empty>>>

\<change cats\><<<
\catcode`\@=12\catcode`\\=0 >>>

\<restore cats\><<<
\catcode`\@=0\catcode`\\=13 >>>
%%%%%%%%%%%%%%%
\section{ConTeXt}
%%%%%%%%%%%%%%%


\<context...\><<<
|<unix line|>|<windows line|>
        |<texexec|>
        |<base|>tex4ht |<dir ch|>|<@|>1 |<III|>
        |<base|>t4ht |<dir ch|>|<@|>1 |<IV|>

>>>

\<texexec\><<<
|<ruby call|>texexec --arg="ht-1=|<@|>2" --use=tex4ht --dvi --nobackend |<@|>5 |<@|>1 >>>

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{XeTeX}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\<htxetex...\><<<
|<unix line|>|<windows line|>|<xetex|>
        |<xetex|>
        |<xetex|>
        |<base|>tex4ht -.xdv |<dir ch|>|<@|>1 |<III|>
        |<base|>t4ht -.xdv |<dir ch|>|<@|>1 |<IV|>

>>>

\<xetex\><<<
xetex -no-pdf |<@|>5 |<'|>|<tex definitions|>|<get parameters|>|empty>>>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{XeLaTeX}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\<htxelatex...\><<<
|<unix line|>|<windows line|>|<xelatex|>
        |<xelatex|>
        |<xelatex|>
        |<base|>tex4ht -.xdv |<dir ch|>|<@|>1  |<III|>
        |<base|>t4ht -.xdv |<dir ch|>|<@|>1 |<IV|>

>>>


\<xelatex\><<<
xelatex -no-pdf |<@|>5 |<'|>|<definitions|>|<get parameters|>|empty>>>

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{MeX}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\<htmex...\><<<
|<unix line|>|<windows line|>|<mex|>
        |<mex|>
        |<mex|>
        |<base|>tex4ht |<dir ch|>|<@|>1 |<III|>
        |<base|>t4ht |<dir ch|>|<@|>1 |<IV|>

>>>

\<mex\><<<
mex |<@|>5 |<'|>|<tex definitions|>|<get parameters|>|empty>>>



%%%%%%%%%%%%%%%%%%%%%%
\section{Script Components}
%%%%%%%%%%%%%%%%%%%%%%

\def\setcats{\catcode`\\=12 \catcode`\%=12 \catcode`\~=12
 \catcode`\_=12
}

\def\Remark{\bgroup \catcode`\#=12 \setcats \Rema}  \def\Rema#1{\egroup\def\Rem{#1}}
\def\Ii{\def\II}
\def\Iii{\bgroup \setcats \Iiicont}  \def\Iiicont#1{\egroup\def\III.##1.{#1}}
\def\Iv{\bgroup \setcats \Ivcont}    \def\Ivcont#1{\egroup\def\IV.##1.{#1}}
\def\Quote{\bgroup \setcats \Qcont}  \def\Qcont#1{\egroup\def\quote{#1}}
\def\Argchar{\bgroup \setcats \Acont}\def\Acont#1{\egroup\def\argchar{#1}}
\def\Dirchar{\bgroup \setcats \Dicont}\def\Dicont#1{\egroup\def\dirchar{#1}}
\def\Rubycall{\bgroup \setcats \Dcont}\def\Dcont#1{\egroup\def\rubyCall{#1}}
\def\Echooff{\bgroup \setcats \Dcont}\def\Dcont#1{\egroup\def\echoOff{#1}}
\def\Ext{\bgroup \setcats \Econt}    \def\Econt#1{\egroup\def\ext{#1}%
    \def\firstln{unix}\ifx \firstln\ext
           \def\firstln##1endfirstln{##1}%
  \else    \def\firstln##1endfirstln{}\fi
}
\def\Base{\bgroup \setcats \Bcont}   \def\Bcont#1{\egroup\def\base{#1}}
\def\Script{\def\script##1##2}  % #1 -- file    #2 -- extension
\def\Options#1{\ifx \OPTIONS\UnDef \def\OPTIONS{#1}\fi}
\def\Latex#1{\ifx \latex\UnDef \def\latex{#1}\fi}

\let\Rem=\relax
\let\II=\relax
\let\III=\relax
\let\IV=\relax
\let\quote=\relax
\let\argchar=\relax
\let\dirchar=\relax
\let\rubyCall=\relax
\let\echoOff=\relax
\let\ext=\relax
\ifx \script\UnDef \let\script=\relax \fi
\let\base=\relax
\let\firstln=\relax

\<Rem\><<<
|Rem>>>

\<II\><<<
|II>>>

\<III\><<<
|III.|<@|>3.>>>

\<IV\><<<
|IV.|<@|>4.>>>

\<'\><<<
|quote>>>

\<@\><<<
|argchar>>>

\<dir ch\><<<
|dirchar>>>

\<base\><<<
|base>>>

\<ruby call\><<<
|rubyCall>>>

\<echo off\><<<
|echoOff>>>

\<unix line\><<<
|firstln#!/bin/sh
# stop at first error
set -e

# No interaction on the TeX runs is desirable.
# Simpler to do that here than on the individual commands;
# let's hope exec redirections are portable enough.
exec </dev/null
endfirstln
>>>

Despite the name, this macro is not for Windows. It is unconditionally
included in all the scripts. It should only be the copyright notice,
which somehow gets transformed for Unix. Thus we go to lots of trouble
to insert the at-echo off only for Windows.

\<windows line\><<<
|<echo off|>
|Rem |ScriptFileName|AddExtn (2020-11-23-10:05), generated from tex4ht-mkht.tex
|Rem Copyright 2009-2020 TeX Users Group
|Rem Copyright 2003-2009 Eitan M. Gurari
|Rem
|Rem This work may be distributed and/or modified under the
|Rem conditions of the LaTeX Project Public License, either
|Rem version 1.3 of this license or (at your option) any
|Rem later version. The latest version of this license is in
|Rem   http://www.latex-project.org/lppl.txt
|Rem and version 1.3 or later is part of all distributions
|Rem of LaTeX version 2003/12/01 or later.
|Rem
|Rem This work has the LPPL maintenance status "maintained".
|Rem
|Rem The Current Maintainer of this work
|Rem is the TeX4ht Project <https://tug.org/tex4ht>.
|Rem
|Rem If you modify this file, changing the
|Rem version identification be appreciated.

>>>


\def\IfExt#1,#2//{\def\next{#1}%
   \ifx \next\ext \def\next{\csname iftrue\endcsname}%
   \else \ifx \next\empty \def\next{\csname iffalse\endcsname}%
   \else \def\next{\IfExt#2,,//}\fi\fi \next}

\begingroup
\catcode`\:=11 \catcode`\^=7    \catcode`\^^M=13%
%
\gdef\make#1{%
  \expandafter\IfExt\OPTIONS,,//%
  %
   \subsection{#1}%
   \def\temp##1{\par{\tt\string##1: \meaning##1}}%
   \temp\quote
   \temp\argchar
   \temp\dirchar
   \temp\rubyCall
   \temp\echoOff
   \temp\ext
   \temp\script
   \temp\base
   \temp\firstln
   \temp\latex
   \temp\Rem
   \temp\II
   \temp\III
   \temp\IV
   \def\pref{#1} %
   \<\pref latex\latex.\ext\><<<
   \<htlatex \latex...\>
   >>> %
   \OutputCodE\<\pref latex\latex.\ext\>   \script{\pref latex}{\ext}  %
\expandafter\let\csname\pref latex\latex\endcsname=\UnDef
%
\<\pref tex.\ext\><<<
\<httex...\>
>>> %
%
\OutputCodE\<\pref tex.\ext\>    \script{\pref tex}{\ext}  %
%
\<\pref texi.\ext\><<<
\<httexi...\>
>>> %
%
\OutputCodE\<\pref texi.\ext\>   \script{\pref texi}{\ext}  %
%
\<\pref context.\ext\><<<
\<context...\>
>>> %
%
\OutputCodE\<\pref context.\ext\>   \script{\pref context}{\ext}  %
%
\<\pref xetex.\ext\><<<
\<htxetex...\>
>>> %
%
\OutputCodE\<\pref xetex.\ext\>    \script{\pref xetex}{\ext}  %
%
\<\pref xelatex.\ext\><<<
\<htxelatex...\>
>>> %
%
\OutputCodE\<\pref xelatex.\ext\>    \script{\pref xelatex}{\ext}  %
%
\<\pref mex.\ext\><<<
\<htmex...\>
>>> %
%
\OutputCodE\<\pref mex.\ext\>    \script{\pref mex}{\ext}  %
%
%
  \fi
}                                      %
\endgroup

\ifx \JOBNAME\UnDefined
   \def\one{\Ii}
\def\two{\Iii}
\def\three{\Iv}
\Latex{}             % {}, {2e}, {209}
\def\temp{unix}\ifx\script\temp
   \Options{unix}   % {unix,bat}, {unix}, {bat}
   %%%%%%%%%%
\Ext{unix}
%%%%%%%%%%
\Base{}
\Quote{'}
\Argchar{$}
\Dirchar{-f/}
\Rubycall{}
\Echooff{}
\Remark{#}

\else
   \def\temp{bat}\ifx\script\temp
      \Options{bat}
      %%%%%%%%%%%%%%%%%%
\Options{bat}
%%%%%%%%%%%%%%%%%%
%%%%%%%%%
\Ext{bat}
%%%%%%%%%
\Base{}
\Quote{}
\Argchar{%}
\Dirchar{}
\Rubycall{call }
\Echooff{@echo off}
\Remark{Rem }

   \else
      \bgroup
         \def\1{\space\space\space}
         \def\2{\space\space\space\space\space\space}
         \catcode`\%=12
         \catcode`\#=12
         \catcode`\~=12
         \catcode`\@=0
         \catcode`\\=12
      @immediate@write16{|-------------------------------------------------------------}
      @immediate@write16{|@2@1 A sample of a scripts generator file }
      @immediate@write16{|}
      @immediate@write16{|@1    Creates a foolatex script for commands}
      @immediate@write16{|}
      @immediate@write16{|@2        foolatex file}
      @immediate@write16{|}
      @immediate@write16{|@1    similar to htlatex for commands}
      @immediate@write16{|}
      @immediate@write16{|@2        htlatex file "html,...1..." " ...2..." "...3..."}
      @immediate@write16{|}
      @immediate@write16{|@1    with the arguments ...1..., ...2..., and ...3... }
      @immediate@write16{|@1    embedded in the new script. General usage}
      @immediate@write16{|}
      @immediate@write16{|@2        foolatex file "..." "..." "..."}
      @immediate@write16{|}
      @immediate@write16{|----------------- sample.tex --------------------------------}
      @immediate@write16{|% latex sample}
      @immediate@write16{|}
      @immediate@write16{| \def\script{bat} }
      @immediate@write16{| % \def\script{unix} }
      @immediate@write16{|}
      @immediate@write16{| \input ./mkht.4ht }
      @immediate@write16{|}
      @immediate@write16{| \one{,html,...1...}}
      @immediate@write16{| \two{-i/tex4ht/ht-fonts/#1 ...2...}    % bat }
      @immediate@write16{| % \two{-i~/tex4ht/texmf/tex4ht/ht-fonts/#1 ...2...}   % unix }
      @immediate@write16{| \three{#1 ...3...}}
      @immediate@write16{| \make{foo}}
      @immediate@write16{|}
      @immediate@write16{| \end{document} }
      @immediate@write16{-------------------------------------------------------------}
      @egroup
      \def\next{\csname fi\endcsname
                \csname fi\endcsname
                \csname fi\endcsname\end{document}}
\fi \fi

   \expandafter\endinput
\fi

\input \JOBNAME

\end{document}
\endinput