1 |
COMMENT(-- $Id: masonyodl.yo,v 1.1 2003/11/18 14:22:16 root Exp $ --) |
2 |
COMMENT(----------------------------------------------------------------------- |
3 |
-- We want more functionality and some better layout |
4 |
-- proto changes: |
5 |
-- starttable(nColumns)(Alignment)(borderwidth) |
6 |
------------------------------------------------------------------------------) |
7 |
NEWCOUNTER(RRindentlevel) |
8 |
NEWCOUNTER(RRnl) |
9 |
SETCOUNTER(RRindentlevel)(0) |
10 |
\ |
11 |
DEFINEMACRO(nltxt)(0)(\ |
12 |
IFZERO(RRnl)()( ADDTOCOUNTER(RRnl)(-1)nltxt())) |
13 |
\ |
14 |
UNDEFINEMACRO(XXnl) |
15 |
DEFINEMACRO(XXnl)(0)(\ |
16 |
NOTRANS( |
17 |
)\ |
18 |
whentxt(SETCOUNTER(RRnl)(RRindentlevel)nltxt())) |
19 |
\ |
20 |
DEFINEMACRO(P)(0)(\ |
21 |
SETCOUNTER(RRnl)(0)\ |
22 |
whenhtml(SETCOUNTER(RRnl)(1)htmlcommand(<p>))\ |
23 |
IFZERO(RRnl)(nl())()) |
24 |
\ |
25 |
UNDEFINEMACRO(starttable) |
26 |
DEFINEMACRO(starttable)(3)(\ |
27 |
SETCOUNTER(XXtablewidth)(ARG1)\ |
28 |
whenhtml(IFZERO(ARG3)(htmlcommand(<table>))\ |
29 |
(htmlcommand(<table border=ARG3>))XXnl())\ |
30 |
whenlatex(latexcommand(\begin{tabular}{)ARG2+latexcommand(}))\ |
31 |
whenman(roffcmd(.TS)()()())\ |
32 |
whenman(IFZERO(ARG3)(roffcmd(tab(`);)()()())\ |
33 |
(roffcmd(allbox,tab(`);)()()()))\ |
34 |
whenman(ARG2 NOTRANS(. |
35 |
))\ |
36 |
whenms(roffcmd(.TS)()()())\ |
37 |
whenms(IFZERO(ARG3)(roffcmd(tab(`);)()()())\ |
38 |
(roffcmd(allbox,tab(`);)()()()))\ |
39 |
whenms(ARG2+mscommand(.))\ |
40 |
SETCOUNTER(XXtablewidth)(ARG1)\ |
41 |
SETCOUNTER(XXparcounter)(0)) |
42 |
COMMENT( For HTML, we'll need <table>, for |
43 |
LaTeX we'll need \begin{tabular}{alignment}. Also, we don't want |
44 |
paragraph delimiters.) |
45 |
\ |
46 |
UNDEFINEMACRO(cell) |
47 |
DEFINEMACRO(cell)(1)(\ |
48 |
ADDTOCOUNTER(XXtableline)(1)\ |
49 |
whenhtml(htmlcommand(<td>) ARG1 \ |
50 |
IFZERO(XXcellcounter)\ |
51 |
(htmlcommand(<br>))\ |
52 |
()\ |
53 |
htmlcommand(</td>) XXnl())\ |
54 |
whenlatex(ARG1 \ |
55 |
IFZERO(XXcellcounter)\ |
56 |
()(latexcommand( & )))\ |
57 |
whentxt( ARG1 )\ |
58 |
whenms( ARG1 )\ |
59 |
IFZERO(XXcellcounter)\ |
60 |
()\ |
61 |
(mscommand(`\))\ |
62 |
whenman( ARG1 )\ |
63 |
IFZERO(XXcellcounter)\ |
64 |
()\ |
65 |
(mancommand(`\))\ |
66 |
ADDTOCOUNTER(XXcellcounter)(-1)) |
67 |
COMMENT(For HTML we need: |
68 |
<td> text </td>, so that's fairly easy. If we're already at the last |
69 |
cell, we need <td> text <br></td>. |
70 |
For LaTeX: we need text followed by &, unless |
71 |
we're already at the last cell 'cuz in that case we need only text. |
72 |
Also we need to decrement the cell counter..) |
73 |
\ |
74 |
UNDEFINEMACRO(cells) |
75 |
DEFINEMACRO(cells)(2)(\ |
76 |
ADDTOCOUNTER(XXtableline)(ARG1)\ |
77 |
ADDTOCOUNTER(XXcellcounter)(-ARG1)\ |
78 |
ADDTOCOUNTER(XXcellcounter)(1)\ |
79 |
whenhtml(htmlcommand(<td colspan=ARG1 align=center>) ARG2 \ |
80 |
IFZERO(XXcellcounter)\ |
81 |
(htmlcommand(<br>))\ |
82 |
()\ |
83 |
htmlcommand(</td>) XXnl())\ |
84 |
whenlatex(\ |
85 |
latexcommand(\multicolumn{)ARG1+latexcommand(}{c}{)ARG2+latexcommand(})\ |
86 |
IFZERO(XXcellcounter)\ |
87 |
()(latexcommand( & )))\ |
88 |
whentxt( ARG1 )\ |
89 |
whenms( ARG1 )\ |
90 |
IFZERO(XXcellcounter)\ |
91 |
()\ |
92 |
(mscommand(`\))\ |
93 |
whenman( ARG1 )\ |
94 |
IFZERO(XXcellcounter)\ |
95 |
()\ |
96 |
(mancommand(`\))\ |
97 |
ADDTOCOUNTER(XXcellcounter)(-1)) |
98 |
\ |
99 |
DEFINEMACRO(indent)(1)(\ |
100 |
whenhtml(htmlcommand(<ul>)ARG1+htmlcommand(</ul>))\ |
101 |
whentxt(ADDTOCOUNTER(RRindentlevel)(4)ARG1+ADDTOCOUNTER(RRindentlevel)(-4))\ |
102 |
whenman(roffcmd(.RS)()()()roffcmd(.HP)()()()ARG1+roffcmd(.RE)()()())\ |
103 |
whenms()) |
104 |
\ |
105 |
DEFINEMACRO(startdl)(0)(\ |
106 |
whenhtml(htmlcommand(<dl>))\ |
107 |
whentxt(ADDTOCOUNTER(RRindentlevel)(4))\ |
108 |
whenman(startdit())) |
109 |
\ |
110 |
DEFINEMACRO(enddl)(0)(\ |
111 |
whenhtml(htmlcommand(</dl>))\ |
112 |
whentxt(ADDTOCOUNTER(RRindentlevel)(-4))\ |
113 |
whenman(enddit())) |
114 |
\ |
115 |
DEFINEMACRO(dl)(2)(\ |
116 |
whenhtml(htmlcommand(<dt>)ARG1+htmlcommand(</dt><dd>)\ |
117 |
ARG2+htmlcommand(</dd>))\ |
118 |
whentxt(ADDTOCOUNTER(RRindentlevel)(2)dit(ARG1)\ |
119 |
ADDTOCOUNTER(RRindentlevel)(2)nl()\ |
120 |
ARG2+ADDTOCOUNTER(RRindentlevel)(-4))\ |
121 |
whenman(dit(ARG1)ARG2)) |
122 |
\ |
123 |
DEFINEMACRO(manpageauthors)(0)(\ |
124 |
manpagesection(AUTHORS)\ |
125 |
DEFINESYMBOL(XXmanpageAuthor)) |