File: base.zmm

package info (click to toggle)
zoem 08-248-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 2,752 kB
  • ctags: 2,074
  • sloc: ansic: 17,928; sh: 789; makefile: 228
file content (640 lines) | stat: -rw-r--r-- 15,945 bytes parent folder | download | duplicates (2)
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
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640

\'import{ref.zmm}
\'import{ctr.zmm}

\: iref#2, lref#2, enref#2, aref#2.
\: evn{spacing}
\: evn{itemize}   \item \items \intermezzo \itemskip
\: bf#1 it#1 v#1 tt#1
\: ftinc#2 ftdec#2
\: httpref#1 sibref#2
\: (deprecated) par car cpar#1 ccar#1
\: par#1 car#1 cpar#2 ccar#2
\: verbatim#1 verbatix#1

\'def{"zmm::html::justify"}{justify}


\'${html}{\set{{modes}{vw}}{}{

   {_spacer#2}    {\<spacer type=block width=\1 height=\2!>}
   {_anch#2}      {\<a name="\1">{\2}}
   {iref#2}       {\<a class="intern" href="#\1">{\2}}
   {lref#2}       {\<a class="local" href="\1">{\2}}
   {aref#2}       {\<a class="extern" href="\1">{\2}}
   {enref#2}      {\<a name="\1">{\2}}
   {iref_quiet#2} {\<a class="quiet" href="#\1">{\2}}
   {lref_quiet#2} {\<a class="quiet" href="\1">{\2}}

          }\set{{modes}{v}}{}{

   {"zbgen-text-level"} {50}
   {"zbgen-text-size"}  {0}

         }

         \'set{%{zbgen}{text}{level}}{
   {53}     {30pt}
   {52}     {20pt}
   {51}     {15pt}
   {50}     {12pt}
   {49}     {10pt}
   {48}     {9pt}
   {47}     {8pt}
         }
}


\'${roff}{\set{{modes}{vw}}{}{

   {iref#2}    {\it{\2}}
   {aref#2}    {\it{\2}}
   {lref#2}    {\it{\2}}
   {enref#2}   {\2}

         }
}

\'set{_p_classes}{\'vanish{
      \'set{_tmp}{\'if{\"zbgen-text-size"}{\"zbgen-text-size"}{\"zbgen-text-level"}}
   }class="default L\_tmp"}

\'formatted{
   \'env{spacing}{
      {top}{0}         \: not yet functional.
      {bottom}{0}      \: not yet functional.
      {left}{0}        \: only for indent.
      {pleft}{0}       \: only for indent, not yet in troff.
      {right}{0}       \: only for shrinking.
      {f}{3}
   }{
      \'${roff}{
         \'apply{_#1\!{{\'setx{$\1}{\'f{div}{\$\1}{\$f}}}}}
         { {top}{bottom}{right}{left}
         }
      }
      \'${html}{
         \<div style="
            \'if{\$top}{margin-top:\$top\,mm;}{}
            \'if{\$bottom}{margin-bottom:\$bottom\,mm;}{}
            \'if{\$left}{margin-left:\$left\,mm;}{}
            \'if{\$pleft}{margin-left:\$pleft%;}{}
            \'if{\$right}{margin-right:\$right\,mm;}{}
         ">
      }
      \'${roff}{
         \'if{\$left}{\@{\N.in +\&{\$left}m\N}}{}
         \'if{\$right}{\@{\N.ll -\&{\$right}m\N}}{}
      }
   }{
      \'${html}{\</div>}
      \'${roff}{
         \'if{\$left}{\@{\N.in -}\$left\@{m\N}}{}
         \'if{\$right}{\@{\N.ll +}\$right\@{m\N}}{}
      }
   }
}

\'switch{\__device__}{
   {html}{

         \set{{modes}{vw}}{}{
{bf#1}      {\<b>{\1}}
{it#1}      {\<i>{\1}}
{v#1}       {\<tt>{\1}}
{vq#1}      {\<tt>{\1}}
{m#1}       {\<tt>{\1}}
{tt#1}      {\<tt>{\1}}

{ftinc#2}   {\2}
{ftdec#2}   {\2}

{httpref#1} {\<a class="extern" href="\1">{\1}}
{httpref#2} {\<a class="extern" href="\1">{\2}}
{sibref#1}  {\<a class="local" href="\1.html">{\1}}
{sibref#2}  {\<a class="local" href="\1.html">{\2}}
{sibref#3}  {\<a class="local" href="\1.html#\2">{\3}}
         }}

   {roff}{
         \set{{modes}{vw}}{}{
{bf#1}      {\@{\\fB}\1\@{\\fP}}
{it#1}      {\@{\\fI}\1\@{\\fP}}
{v#1}       {\@{\\fC}\1\@{\\fP}}
{vq#1}      {'\v{\1}'}
{m#1}       {\@{\\fC}\1\@{\\fP}}
{tt#1}      {\@{\\fC}\1\@{\\fP}}

{ftinc#2}   {\@{\\s+\1}\2\@{\\s-\1}}
{ftdec#2}   {\@{\\s-\1}\2\@{\\s+\1}}

{httpref#1} {\1}
{httpref#2} {\1}  \: the url-encoded thing.
{sibref#1}  {\bf{\1}}
{sibref#2}  {\bf{\2}}
{sibref#3}  {\bf{\3}}
         }}
}

\'switch{\__device__}{
   {html}{
      \'special{
         {60}  {&lt;}      \: less than sign
         {62}  {&gt;}      \: greater than sign
         {38}  {&amp;}     \: ampersand

         {-1} {&nbsp;}     \: the zoem escape \~
         {-2} {<br>}       \: the zoem escape \|
         {-3} {-}          \: the zoem escape \-
      }

      \'constant{
         {bullet}{&bull;}
      }
   }
   {roff}{
      \'special{
         {34}  {"}         \: double quote is special in second layer only
         {34}  {""}        \: double quote is special in second layer only
         {46}  {\\&.}      \: a dot.
         {96}  {\\&`}      \: backquote.
         {39}  {\\&'}      \: quote

         {92}  {\\e}       \: backslash (default troff escape character).
                           \: escaping by backslash may fail in
                           \: diversions [for old roffs].

         {-1} {\\ \\&}        \: the zoem escape \~
         {-2} {\!N.br\!N}  \: the zoem escape \|
         {-3} {\\-}        \: the zoem escape \-
      }
      \'constant{
         {bullet}{\\(bu}
      }
   }
}

\'formatted{

   \'env{itemize}{
      {contiguous}{0}       \: no paragraph skips
      {compact}{0}          \: item and description on same line.
      {w1}{2}               \: width of item column in m's.
      {w2}{1}               \: width of separating column in m's.
      {f1}{16}              \: correction factor for html.
      {f2}{8}               \: correction factor for html.
      {mark}{\*{bullet}}
      {margintop}{1}        \: NOTE anonalous unit (ems). mq.
      {align}{left}         \: the way item is aligned.
      {debug}{0}
      {lp}{}                \: left parenthesis
      {rp}{}                \: right parenthesis
      {type}{mark}          \: affects \item. mark/roman/abc/arabic
      {itemcount}{0}
      {smallertext}{0}      \: decreases font size in paragraphs.
   }{
      \'${html}{
         \'setx{$w1}{\'f{*}{\$w1}{\$f1}}
         \'setx{$w2}{\'f{*}{\$w2}{\$f2}}
      }

      \'setx{$w3}{\'f{+}{\$w1}{\$w2}}

      \'if{\$smallertext}{
         \'setx{"zbgen-text-level"}{\'let{\"zbgen-text-level"-1}}
      }{}

      \ctrinc{_envlevel}
      \ctrset{_itemcheck\ctrput{_envlevel}}{0}

      \'${html}{
         \<div style="margin-top:\$margintop\,em">
         \<table
            cellspacing="0" border=\$debug
            cellpadding="0" summary="itemize">
      }
      \'${roff}{
         \'if{\$margintop}{\@{\P}}{}
      }
   }{
      \_itemend
      \'${html}{\</table>\@{\n}\</div>}
      \_itemaccount{0}{0}
      \ctrdec{_envlevel}
      \'if{\$smallertext}{
         \'setx{"zbgen-text-level"}{\'let{\"zbgen-text-level"+1}}
      }{}
   }

   \'${html}{
      \'def{itemskip}{
         \_itemend
         \<tr>{\<td width=\$w1>{\~}\<td width=\$w2>{\~}\<td>{}}
      }
   }
   \'${roff}{
      \'def{itemskip}{
         \_itemend
         \@{\P}
      }
   }

   \'def{intermezzo#1}{

      \_itemend

      \_itemaccount{0}{0}
      \'if{\$contiguous}
         {}
         {\itemskip}
      \'${html}{
         \<tr>{\<td colspan=3>{\1}}
      }
      \'${roff}{
         \1
      }
   }

   \'def{item#1}{

      \_itemend

      \'set{_item}{\1}
      \_itemaccount{1}{1}

      \'if{\'let{\$itemcount && !\$contiguous}}
         {\itemskip}
         {}

      \'${html}{
         \'if{\$compact}
         {  \@{<tr>}
            \<td width=\$w1 valign="top" class="\$align nowrap">{\_item}
            \<td width=\$w2>{\~}
         }
         {  \<tr>{\<td colspan=3>{\_item}}
         }
      }
      \'${roff}{
         \: compact/not compact is accounted for by \_itemdef.
         \'if{\'cmp{eq}{\$align}{left}}
            {\@{\+{2}.ZI }\$w3\@{m "}\1\@{"\+{1}}}
            {\@{\+{2}.ZJ }\$w1\@{m }\$w2\@{m "}\1\@{"\+{1}}}
      }
      \_itemdef
   }

   \'def{items#1}{

      \_itemend

      \'set{_items}{\1}
      \_itemaccount{1}{1}

      \'if{\$compact}{
         \'write{stderr}{txt}{
            \`{<}itemize: compact not supported with items#1\|\`{>}
         }
         \'exit
      }{}
      \'if{\'let{\$itemcount && !\$contiguous}}
         {\itemskip}
         {}
      \'${html}{
         \'apply{_#1{\<tr>{\<td colspan=3 class=\$align>{\!1}}}
         }{\_items}
      }
      \'${roff}{
         \: compact/not compact is accounted for by \_itemdef.
         \'apply{
            _#1{
               \'if{\'cmp{eq}{\$align}{left}}
                  {\@{\N\+{2}.ZI }\$w3\@{m "}\!1\@{"\+{1}}}
                  {\@{\N\+{2}.ZJ }\$w1\@{m }\$w2\@{m "}\!1\@{"\+{1}}}
               \@{\N\\&\N'in -}\$w3\@{m\N}
            }
         }{
            \_items
         }
         \@{\N'in\s+}\$w3\@{m\N}
      }
      \_itemdef
   }

   \'def{item}{

      \_itemend

      \_itemaccount{1}{1}
      \'if{\'let{\$itemcount && !\$contiguous}}
         {\itemskip}
         {}
      \'${html}{
         \@{<tr>}
         \<td width=\$w1 valign="top" class=\$align>{\_putitemmark}
         \<td width=\$w2>{\~}
      }
      \'${roff}{
         \'if{\'cmp{eq}{\$align}{left}}
            {\@{\N.ZI }\$w3\@{m \"}\_putitemmark\@{\"}}
            {\@{\N.ZJ }\$w1\@{m }\$w2\@{m }"\_putitemmark"}
      }
      \_itemdef
   }

   \'def{_itemdef}{
      \_itemaccount{2}{3}
      \'${html}{
         \'if{\$compact}
            {  \@{<td><div style="text-align:\&{\"zmm::html::justify"}">}}
            {  \@{<tr>}
               \<td width=\$w1>{\~}
               \<td width=\$w2>{\~}
               \@{<td><div style="text-align:\&{\"zmm::html::justify"}">}
            }
      }
      \'${roff}{
         \'if{\$compact}
            {\@{\N}}
            {\@{\N\\&\N.br\N}}
      }
   }

   \'def{_itemend}{
      \'if{\'eqt{eq}{\'f{%}{\ctrput{_itemcheck\ctrput{_envlevel}}}{7}}{3}}{
         \_itemaccount{4}{0}
         \'setx{$itemcount}{\'f{+}{\$itemcount}{1}}
         \'${html}{
            \@{</div></td></tr>}
         }
         \'${roff}{\@{\N.in\s-}\$w3\@{m\N}}
      }{}
   }

   \'def{_itemaccount#2}{
      \: add \1, check that the result % 7 == \2.
      \ctradd{_itemcheck\ctrput{_envlevel}}{\1}
      \'if{\'eqt{ne}{\'f{%}{\ctrput{_itemcheck\ctrput{_envlevel}}}{7}}{\2}}{
         \'write{stderr}{txt}{\`{<}
### Error in itemize: expect corrupt output (no further insights, sorry).
### Checksum: \ctrput{_itemcheck\ctrput{_envlevel}}
\`{>}
         }
      }{
      }
   }

   \'def{_putitemmark}{
      \$lp
      \'switch{\$type}{
         {mark}{\$mark}
         {roman}{\'textmap{{number}{roman}}{\'f{+}{\$itemcount}{1}}}
         {ROMAN}{\'textmap{{number}{roman}{word}{ucase}}{\'f{+}{\$itemcount}{1}}}
         {abc}{\'textmap{{number}{alpha}}{\'f{+}{\$itemcount}{1}}}
         {ABC}{\'textmap{{number}{alpha}{word}{ucase}}{\'f{+}{\$itemcount}{1}}}
         {arabic}{\'f{+}{\$itemcount}{1}}
         {?}
      }
      \$rp
   }
}


\'${html}{

\'def{"html::charset"}{ISO-8859-1}
\'def{"gen::html-meta"}{
   \<META http-equiv="Content-Type" content="text/html; charset=\"html::charset""!>
}

\'def{"gen::html-style-optional"}{
   body {
      text-align: \"zmm::html::justify";
      color: #001111;
      background: white;
      margin-left: 8%;
      margin-right: 8%;
      font-family: Helvetica, Univers, Verdana, sans-serif;
   }

   p.default  {
      font-family: Helvetica, Univers, Verdana, sans-serif;
      text-align: \"zmm::html::justify";
   }

   p.L53 { font-size: \%{zbgen}{text}{level}{53}; }
   p.L52 { font-size: \%{zbgen}{text}{level}{52}; }
   p.L51 { font-size: \%{zbgen}{text}{level}{51}; }
   p.L50 { font-size: \%{zbgen}{text}{level}{50}; }
   p.L49 { font-size: \%{zbgen}{text}{level}{49}; }
   p.L48 { font-size: \%{zbgen}{text}{level}{48}; }
   p.L47 { font-size: \%{zbgen}{text}{level}{47}; }

   td {
      font-family: Helvetica, Univers, Verdana, sans-serif;
      text-align: \"zmm::html::justify";
   }

   h3 { margin-top:1em; }
   h2 { margin-top:2em; }

   .left    { text-align: left; align: left; }
   .right   { text-align: right; align: right; }
   .center  { text-align: center; align: center; }
   .nowrap  { white-space: nowrap; }
}
\:^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

   \'def{"gen::html-style-required"}{
\@{
   a:link            { text-decoration: none; }
   a:active          { text-decoration: none; }
   a:visited         { text-decoration: none; }

   a:link { color: #1111aa; }
   a:active { color: #1111aa; }
   a:visited { color: #111166; }
   a.local:link { color: #11aa11; }
   a.local:active { color: #11aa11; }
   a.local:visited { color: #116611; }
   a.intern:link { color: #1111aa; }
   a.intern:active { color: #1111aa; }
   a.intern:visited { color: #111166; }
   a.extern:link { color: #aa1111; }
   a.extern:active { color: #aa1111; }
   a.extern:visited { color: #661111; }
   a.quiet:link { color: black; }
   a.quiet:active { color: black; }
   a.quiet:visited { color: black; }
}
\@{
   div.copy

{  font-size: 12pt;
   font-family: monospace;
   text-align: left;
   white-space: pre;
   margin-left: 2em;
   margin-top: 1em;
   margin-bottom: 1em;

}
   div.indent

{  margin-left: 8%;
   margin-right: 0%;
}
}}
\:^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   }

\'${roff}{
   \'def{"generic::troff-defs"}{
\@{\N
.po 2m
.de ZI
.\\" Zoem Indent/Itemize macro I.
.br
'in +\\\\$1
.nr xa 0
.nr xa -\\\\$1
.nr xb \\\\$1
.nr xb -\\\\w'\\\\$2'
\\h'|\\\\n(xau'\\\\$2\\h'\\\\n(xbu'\\\\
..
.de ZJ
.br
.\\" Zoem Indent/Itemize macro II.
'in +\\\\$1
'in +\\\\$2
.nr xa 0
.nr xa -\\\\$2
.nr xa -\\\\w'\\\\$3'
.nr xb \\\\$2
\\h'|\\\\n(xau'\\\\$3\\h'\\\\n(xbu'\\\\
..\N}
   }
}

\'formatted{

   \'switch{\__device__}{

      {html}{

\: plain ole style paragraph (deprecated)

         \'def{par}{\<p \_p_classes!>}

\: ole style carry on paragraph. more or less html specific; it seems to be
\: needed after e.g. verbatim environment. deprecated.

         \'def{car}{
            \<p \_p_classes style="margin-top:0em; margin-bottom:0em"!>
         }

\: ole style caption paragraph. deprecated.

         \'def{cpar#1}{
            \<p \_p_classes!>
            \bf{\1}
            \|
         }

\: old style caption carry on paragraph.

         \'def{ccar#1}{
            \<p \_p_classes style="margin-top:0em; margin-bottom:0em"!>
            \bf{\1}
            \|
         }


\: paragraph.

         \'def{par#1}{
            \<p \_p_classes style="margin-bottom:0">{\1}
         }

\: carry on paragraph. more or less html specific; it seems to be needed
\: after e.g. verbatim environment. only  use if spacing matters to you,
\: otherwise better suffer and wait  for more generic (html client side)
\: solutions.

         \'def{car#1}{
            \<p \_p_classes style="margin-top:0em; margin-bottom:0em">{\1}
         }

\: caption paragraph.

         \'def{cpar#2}{
            \<p \_p_classes style="margin-bottom:0">{
               \bf{\1}\|
               \2
            }
         }

\: caption carry on paragraph.

         \'def{ccar#2}{
            \<p \_p_classes style="margin-top:0em; margin-bottom:0em">{
               \bf{\1}\|
               \2
            }
         }

         \'def{verbatim#1}{
            \: \@{\N<div class=copy>\w}\1
            \@{\N<pre>\w}\1
            \@{\W</pre>\N}
         }
         \'def{verbatix#1}{\verbatim{\1}}
      }

      {roff}{
         \set{{modes}{vw}}{}{
            {par}       {\@{\P}}
            {car}       {\@{\N}}
            {cpar#1}    {\@{\P}\bf{\1}\@{\N}\|}
            {ccar#1}    {\@{\N}\bf{\1}\@{\N}\|}

            {par#1}     {\@{\P}\1}
            {car#1}     {\@{\N}\1}
            {cpar#2}    {\@{\P}\bf{\1}\|\2\@{\N}}
            {ccar#2}    {\@{\N}\bf{\1}\|\2\@{\N}}
         }

         \: the non-non-breaking variant of verbatim

         \'def{verbatix#1}{
            \@{\P.nf \\fC\N\w}
            \1
            \@{\W\N.fi \\fR\P}
         }

         \'def{verbatim#1}{
            \@{\P.di ZV\N.in 0\N.nf \\fC\N\w}
            \1
            \@{\W\N.fi \\fR\N.in\N.di\N.ne \\n(dnu\N}
            \@{\N.nf \\fC\N.ZV\N.fi \\fR\P}
         }

         \: Jan van der Steen is to blame for this :)

         \: .di ZV      new diversion named ZV.
         \: .in 0       set indent to 0.
         \: .nf \fC     no fill (no adjustment), fixed width font?

         \: .fi \fR     fill on, Roman font.
         \: .in         previous indent.
         \: .di         end of diversion (ZV).

         \: .ne \n(dnu  need 'dn' vspace (vsize of most recent diversion).
         \: .nf \fC     set no fill mode, fixed width font.
         \: .ZV         do diversion.
         \: .fi \fR     fill mode on, Roman font.

      }
   }
}