--- groff-cvs/tmac/e.tmac 2006-12-24 23:37:49.000000000 +0000 +++ groff-html/tmac/e.tmac 2007-01-04 18:34:11.000000000 +0000 @@ -39,10 +39,27 @@ .\" to provide variant functions. .\" --- an internal macro. .\" +.nr need_eo_h 0 +.nr need_eo_tl 0 +.nr need_tl 1 +.mso devtag.tmac .if !\n(.g .ig .de @R \" --- initialize number register to 0, if undefined .if !r\\$1 .nr \\$1 0 .. +.de check_need_title \" --- check whether grohtml needs end of title/heading +. if (\\n[need_eo_tl] == 1) \{\ +. nr need_eo_tl 0 +. DEVTAG-EO-TL +. \} +. if (\\n[need_tl] == 1) \{\ +. DEVTAG-TL +. nr need_tl 0 +. nr need_eo_tl 1 +. \} +. if \\n[need_eo_h]>0 .DEVTAG-EO-H +. nr need_eo_h 0 +.. .@R pf .if \n(pf .nx .if !\n(.g .ig @@ -186,11 +203,13 @@ .ev 2 .rs .if \\n(hm>0 \ -. sp |\\n(hmu \" move to header position +. if !'\*(.T'html' \ +. sp |\\n(hmu \" move to header position .@t $h\" \" output header title .if \\n(tm<=0 \ . nr tm \n(.Vu -.sp |\\n(tmu \" move to top of text +.if !'\*(.T'html' \ +. sp |\\n(tmu \" move to top of text .ev .mk _k \" for columned output .if \\n(?n .nm 1 \" restore line numbering if n1 mode @@ -368,7 +387,7 @@ .ns .. .\" *** COMMANDS WITH VARIANT DEFINITIONS *** -.rn bp @b \" --- begin page +.if !'\*(.T'html' .rn bp @b \" --- begin page .de bp \" *** begin new page (overrides columns) .nr $c \\n($m \" force new page, not new column .ie \\n(nl>0 \ @@ -479,6 +498,10 @@ .. .de hl \" *** draw horizontal line .br +.if '\*(.T'html' \{\ +. HR +. return +.\} .ie \n(.g .do nr _I \\n[.in] .el .nr _I \\n(.i \l'\\n(.lu-\\n(_Iu' @@ -509,16 +532,23 @@ .di .in \\n(_Iu .ds |j \\*(|i\\ -.if \\w"\\*(|j" \ +.ie \\w"\\*(|j" \ \{\ . ti -\\n(_0u . ie \\w"\\*(|j">=\\n(_0 \ \{\ +. DEVTAG-COL 1 \\*(|j +. DEVTAG-COL-NEXT 2 . br . \} -. el \\*(|j\h'|\\n(_0u'\c +. el \{\ +. DEVTAG-COL 1 +. nop \\*(|j\h'|\\n(_0u'\c +. DEVTAG-COL 2 +. \} .\} +.el .DEVTAG-COL 2 .rr _0 .rm |i |j .. @@ -542,6 +572,7 @@ \0\(bu\0\c .. .de @p \" --- initialize for paragraph +.check_need_title .if "\\n(.z"|e" .tm Line \\n(c. -- Unmatched continued equation .in \\n($iu+\\n(pou .if \\n(.$ \ @@ -557,9 +588,13 @@ .\" *** SECTION HEADINGS *** .de sh \" *** section heading .fi +.check_need_title .if (\\n(si>0)&(\\n(si<1n) \ . nr si \\n(sin +.if '\*(.T'html' .nr si 0 .ce 0 +.DEVTAG-SH \\$1 +.if '\*(.T'html' .nr need_eo_h 1 .@d "\\$1" +1 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 .if !"\\$2"_" \ \{\ @@ -780,6 +815,7 @@ .@D 3 \\$1 \\$2 .sp \\n(bsu .@( +.if '\*(.T'html' .sp \\n(bsu .. .de )b \" *** end block .br @@ -872,6 +908,7 @@ .sp \\n(bsu .@D 3 \\$1 \\$2 .@M +.if '\*(.T'html' .sp \\n(bsu .. .de )l \" *** end list .br @@ -884,7 +921,10 @@ .\" EQN .\" .de EQ \" *** equation start +.if \\n[need_eo_h]>0 .DEVTAG-EO-H +.nr need_eo_h 0 .ec +.HTML-IMAGE .if !\\n(?e \ \{\ . if "\\n(.z"|e" .tm Line \\n(c. -- Nested .EQ request @@ -898,6 +938,7 @@ .. .de EN \" *** equation end .br +.HTML-IMAGE-END .ie "\\$1"C" \ \{\ . nr ?e 1 @@ -948,6 +989,7 @@ .\" .de TS \" *** table start .sp \\n(bsu +.HTML-IMAGE .@C 1 .fi \" drop into fill mode for text boxes .if "\\$1"H" \ @@ -981,6 +1023,7 @@ .if \\n(.p-\\n(_b<=\\n(nl \ . ch @f \\n(nlu+\n(.Vu .ev +.HTML-IMAGE-END .sp \\n(bsu+\\n(.Lv-1v .re .. @@ -1110,6 +1153,7 @@ .\" .de PS \" *** start picture: $1=height, $2=width in units or inches .sp 0.3 +.HTML-IMAGE .nr g7 \\$2 .in (u;\\n(.l-\\n(g7>?0/2) .ne \\$1u @@ -1120,24 +1164,35 @@ .ls .in .if \\n(g7 .fi +.HTML-IMAGE-END .sp .6 .. .\" .\" GREMLIN .\" .de GS \" *** start gremlin picture -.nr g7 (\\n(.lu-\\n(g1u)/2u -.if "\\$1"L" .nr g7 \\n(.iu -.if "\\$1"R" .nr g7 \\n(.lu-\\n(g1u -.in \\n(g7u -.nr g7 \\n(.u -.ls 1 -.nf -.ne \\n(g2u +. ie '\*(.T'html' \{\ +. ie "\\$1"L" .HTML-IMAGE-LEFT +. el .ie "\\$1"R" .HTML-IMAGE-RIGHT +. el .HTML-IMAGE +. \} +. el \{\ +. nr g7 (\\n(.lu-\\n(g1u)/2u +. if "\\$1"L" .nr g7 \\n(.iu +. if "\\$1"R" .nr g7 \\n(.lu-\\n(g1u +. in \\n(g7u +. nr g7 \\n(.u +. ls 1 +. nf +. ne \\n(g2u +. \} .. .de GE \" *** end gremlin picture -.GF -.sp .6 +. ie '\*(.T'html' .HTML-IMAGE-END +. el \{\ +. GF +. sp .6 +. \} .. .de GF \" *** finish gremlin picture; stay at top .ls @@ -1168,29 +1223,39 @@ .\} .. .de r \" *** enter roman font +.check_need_title .@E .ft 1 .if \\n(.$ \&\\$1\f\\*(_F\\$2 +.check_need_title .. .de i \" *** enter italic +.check_need_title .@E .ft 2 .if \\n(.$ \&\\$1\f\\*(_F\\$2 +.check_need_title .. .de b \" *** enter boldface +.check_need_title .@E .ft 3 .if \\n(.$ \&\\$1\f\\*(_F\\$2 +.check_need_title .. .de rb \" *** enter real boldface +.check_need_title .@E .ft 3 .if \\n(.$ \&\\$1\f\\*(_F\\$2 +.check_need_title .. .de bi \" *** enter bold italic +.check_need_title .@E .ft 4 .if \\n(.$ \&\\$1\f\\*(_F\\$2 +.check_need_title .. .de u \" *** enter underlined word \&\\$1\l'|0\(ul'\\$2 @@ -1204,7 +1269,8 @@ \&\\*(lq\\$1\\*(rq\\$2 .. .de bx \" *** enter boxed word -\k~\(br\|\\$1\|\(br\l'|\\n~u\(rn'\l'|\\n~u\(ul'\^\\$2 +. ie '\*(.T'html' .nop \\$1\\$2 +. el .nop \k~\(br\|\\$1\|\(br\l'|\\n~u\(rn'\l'|\\n~u\(ul'\^\\$2 .. .de sm \" *** print in smaller font \s-1\\$1\\s0\\$2 @@ -1332,6 +1398,7 @@ .. .\" *** INDEXES (TABLE OF CONTENTS) *** .nr _x 0 1 +.nr _xn 0 .af _x a .de (x \" *** begin index entry .if \n@>4 .tm >> (x, .z=\\n(.z @@ -1405,7 +1472,64 @@ .in .rm |x .. -.de +c \" *** begin chapter +. +.\" html versions of .x( .x) and .xp +. +.de (x-html \" --- create TAG and divert text +. nr _x +1 +. nr _xn +1 +. TAG "_x\\n[_x] +. br +. di |x\\n[_xn] +. br +.. +. +.de )x-html \" --- end diversion +. br +. di +.. +. +.de xp-html \" --- create list of links +. nr _xx 1 +. br +. ev xp-html-ev +. sp +. ULS +. while \\n[_xx]<=\\n[_xn] \{\ +. br +. unformat |x\\n[_xx] +. di xp-html-div +. br +. ll 100i +. fi +. |x\\n[_xx] +. br +. di +. asciify xp-html-div +. rm xp-html-as +. as xp-html-as # +. as xp-html-as _x\\n[_xx] +. ll +. LI +. URL \\*[xp-html-as] "\\*[xp-html-div] +. rm xp-html-as +. nr _xx +1 +. \} +. ULE +. sp +. ev +.. +. +.if '\*(.T'html' \{\ +. rm (x +. als (x (x-html +. rm )x +. als )x )x-html +. rm xp +. als xp xp-html +.\} +. +.de +c \" *** begin chapter .ep\" \" force out footnotes .if \\n(?o:\\n(?a \ \{\