groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Groff] Proposed m.tmac patch


From: Larry Kollar
Subject: [Groff] Proposed m.tmac patch
Date: Sat, 16 Oct 2004 15:54:44 -0400

The following patch adds rudimentary grohtml support to the -mm macros -- it tags headings properly and eliminates header and footer output. I'm not sure whether the way I implemented the latter (disabling output) is the Right Way to go, but if it inspires a better patch then I'll be happy. I'll add further improvements as we go.

One possible bug... the HTML output's heading tags are incremented by 1 -- for .H 2, it spits out "<h3>...</h3>" and so on.

Index: m.tmac
===================================================================
RCS file: /cvsroot/groff/groff/contrib/mm/m.tmac,v
retrieving revision 2.24
diff -u -r2.24 m.tmac
--- m.tmac      10 Mar 2004 06:11:26 -0000      2.24
+++ m.tmac      16 Oct 2004 19:46:48 -0000
@@ -1038,6 +1038,7 @@
 .\"---------- user macro HY -------------
 .\"    user macro to reset indents
 .if d HY .HY \\n[hd*level] \\n[hd*arg1] "\\$2\\$3"
+.HTML-TAG-NS ".NH \\$1"
 .\"--------------------------------------
 .nr hd*mark-size address@hidden@
 .if (\\n[hd*level]<=\\n[Hc])&\\n[hd*htype] .ce\" center if level<=Hc
@@ -1147,9 +1148,12 @@
.if \\n[D]>2 .tm pg*last-pos address@hidden(\\n[pg*block-size]u+\\n[pg*foot-margin]
u+\\n[pg*footer-size]u+\\n[pg*extra-footer-size]u) = \\n[pg*last-pos]
 ..
 .de address@hidden
+.\" Disable in HTML mode
+.if !'\*[.T]'html' \{\
 .wh \\n[pg*foot-trap]u address@hidden
 .if \\n[D]>2 .tm address@hidden .t=\\n[.t] nl=\\n[nl]
 .if \\n[D]>2 .ptr
+.\}
 ..
 .de address@hidden
 .ch address@hidden
@@ -1198,6 +1202,8 @@
 .\"------------------------------------------------------------
 .\" HEADER
 .de address@hidden
+.\" Disable in HTML mode
+.if !'\*[.T]'html' \{\
 .if \\n[D]>1 .tm Page# \\n[%] (\\n[.F]:\\n[c.])
 .\" check if Hy has been changed
 .ie \\n[Hy] 'hy 14
@@ -1257,6 +1263,7 @@
 .\}
 .if \\n[pg*top-enabled]<0 .nr pg*top-enabled 1
.nr hd*cur-bline \\n[nl] \" .H needs to know if output has occured
+.\}
 ..
 .\"---------------------------------------------------------
 .\" FOOTER

--
Larry Kollar     k  o  l  l  a  r  @  a  l  l  t  e  l  .  n  e  t
Unix Text Processing: "UTP Revival"
http://home.alltel.net/kollar/utp/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]