groff
[Top][All Lists]
Advanced

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

[Groff] Re: finally some grohtml patches


From: Werner LEMBERG
Subject: [Groff] Re: finally some grohtml patches
Date: Fri, 12 Jul 2002 22:25:40 +0200 (CEST)

> here are a set of patches for grohtml to fix the bug you reported
> concerning indentation and preserving font etc.  The patches turned
> out much more than I anticipated due to having to implement
> indentation correctly and (also implementing TABs along the way).

Dear Gaius,

thanks for your efforts!  Unfortunately, it doesn't work.  Below are
some patches which I've applied after yours to make groff compile
without warnings.  Please check them.  The most notable fix is a
missing ' in an-old.tmac which I've added.

The results look horrible, really.  Bernd sent me some improvements to
the groff_char man pages which aren't applied yet to the CVS due to
the ffii.org failure.  I've attached it.  Please use it for testing.
It seems that this man page probably exhibits other bugs.

I think that html support in an-old.tmac is heavily broken.  For
example,

  groff -ww -Thtml -man groff_char.n > groff_char1.html

and

  groff -ww -Thtml -man-old groff_char.n > groff_char2.html

yield different results (and two strange warning messages)!  This must
not happen.  Please have a look into this.  I've attached both html
versions for further inspection.

> For the future:
> 
>   -  one killer fix to some ragged tables edges would be to find
>      out how one can emit html-tags (from within the troff binary)
>      without any spaces after them.. I spent days examining this
>      and with few results :-(
>      This is the reason why multiple .IP's and indents do not
>      always match up exactly (they can be n space widths out..
>      where n is the number of diverted html-tags).

Use the new .output request (you've apparently missed its announcement
on the list).  It has been especially added for such purposes.  For
example, compare

  \X^html:\\$*^\c

with

  .output x X html:\\$*

The latter doesn't start a partial line.

I really hope that the problems are trivial to solve.


    Werner

======================================================================

diff -aruN groff.gaius/src/devices/grohtml/html-table.cc 
groff.new/src/devices/grohtml/html-table.cc
--- groff.gaius/src/devices/grohtml/html-table.cc       Tue Jul  9 16:38:43 2002
+++ groff.new/src/devices/grohtml/html-table.cc Fri Jul 12 21:22:31 2002
@@ -228,7 +228,7 @@
  */
 
 html_table::html_table (simple_output *op, int linelen)
-  : out(op), linelength(linelen), columns(NULL), last_col(NULL), 
start_space(FALSE)
+  : columns(NULL), out(op), linelength(linelen), last_col(NULL), 
start_space(FALSE)
 {
   tab_stops = new tabs();
 }
diff -aruN groff.gaius/src/devices/grohtml/html-text.cc 
groff.new/src/devices/grohtml/html-text.cc
--- groff.gaius/src/devices/grohtml/html-text.cc        Fri Jul 12 22:05:12 2002
+++ groff.new/src/devices/grohtml/html-text.cc  Fri Jul 12 21:24:21 2002
@@ -418,9 +418,7 @@
   done_tt();
   if (is_present(P_TAG)) {
     html_indent *i = remove_indent(P_TAG);
-    int text = emitted_text();
-
-    void *s = done_para();
+    (void)done_para();
     if (! is_present(PRE_TAG))
       push_para(PRE_TAG, NULL, i);
   } else if (! is_present(PRE_TAG))
diff -aruN groff.gaius/src/devices/grohtml/post-html.cc 
groff.new/src/devices/grohtml/post-html.cc
--- groff.gaius/src/devices/grohtml/post-html.cc        Fri Jul 12 22:05:12 2002
+++ groff.new/src/devices/grohtml/post-html.cc  Fri Jul 12 21:20:52 2002
@@ -719,6 +719,7 @@
       return -1;
     return atoi(p);
   }
+  return -1;
 }
 
 /*
@@ -745,6 +746,7 @@
       return -1;
     return atoi(p);
   }
+  return -1;
 }
 
 /*
@@ -1530,8 +1532,8 @@
   void  lookahead_for_tables          (void);
   void  insert_tab_te                 (void);
   text_glob *insert_tab_ts            (text_glob *where);
-  void insert_tab0_foreach_tab         (void);
-  text_glob *insert_tab_0             (text_glob *where);
+  void insert_tab0_foreach_tab        (void);
+  void insert_tab_0                   (text_glob *where);
   void do_indent                      (int in, int pageoff, int linelen);
   void shutdown_table                 (void);
   void do_tab_ts                      (text_glob *g);
@@ -2246,7 +2248,6 @@
   if (table) {
     while (isspace(*s))
       s++;
-    char align = *s;
     s++;
     int col = table->find_column(atoi(s) + pageoffset + indentation);
     if (col > 0) {
@@ -2505,7 +2506,7 @@
  *  insert_tab_0 - inserts a tab0 before, where.
  */
 
-text_glob *html_printer::insert_tab_0 (text_glob *where)
+void html_printer::insert_tab_0 (text_glob *where)
 {
   text_glob *old_pos = page_contents->glyphs.get_data();
 
@@ -2577,7 +2578,6 @@
 void html_printer::insert_tab0_foreach_tab (void)
 {
   text_glob  *start_of_line  = NULL;
-  text_glob  *last           = NULL;
   text_glob  *g              = NULL;
   int seen_tab               = FALSE;
   int seen_col               = FALSE;
diff -aruN groff.gaius/tmac/an-old.tmac groff.new/tmac/an-old.tmac
--- groff.gaius/tmac/an-old.tmac        Fri Jul 12 22:05:12 2002
+++ groff.new/tmac/an-old.tmac  Fri Jul 12 21:56:49 2002
@@ -92,7 +92,7 @@
 .\" .TH title section extra1 extra2 extra3
 .de1 TH
 .  if \\n[an-html] \{\
-.     HTML-TAG ".tl"
+.    HTML-TAG ".tl"
 \\$1
 .  \}
 .
@@ -327,16 +327,9 @@
 .  sp \\n[PD]u
 .  if \\n[.$] .nr an-prevailing-indent (n;\\$1)
 .  it 1 an-trap
-.  ie \\n[an-html] \{\
-.     in 0
-.     ll -\\n[an-margin]u
-.     if !\\n[an-div?] .di an-div
-.  \}
-.  el \{\
-.     if !\\n[an-div?] .di an-div
-.     in 0
-.     ll -\\n[an-margin]u
-.  \}
+.  in 0
+.  ll -\\n[an-margin]u
+.  if !\\n[an-div?] .di an-div
 .  nr an-div? 1
 ..
 .
@@ -381,7 +374,7 @@
 .  br
 .  ll
 .  di
-.  ie (\\n[dl] + \\n[an-tag-sep] > \\n[an-prevailing-indent]) \{\
+.  ie ((\\n[dl] + \\n[an-tag-sep]) > \\n[an-prevailing-indent]) \{\
 .    in \\n[an-margin]u
 .    an-div
 .    br
@@ -392,7 +385,7 @@
 .    ti \\n[an-margin]u
 .    chop an-div
 .    HTML-TAG-NS ".col 1"
-\\*[an-div]\\h'|\\n[an-prevailing-indent]u\\h'\\n[an-tag-sep]u'\c
+\\*[an-div]\\h'|\\n[an-prevailing-indent]u'\\h'\\n[an-tag-sep]u'\c
 .    HTML-TAG-NS ".col 2"
 .  \}
 ..
@@ -577,10 +570,10 @@
 .ds lq \(lq
 .ds rq \(rq
 .
-.\" .ie \n[an-html] \{\
+.ie \n[an-html] \{\
 .   rm an-do-tag
 .   als an-do-tag an-do-tag-html
-.\" .\}
+.\}
 .el .hy 14
 .
 .\" Load local modifications.
diff -aruN groff.gaius/tmac/www.tmac groff.new/tmac/www.tmac
--- groff.gaius/tmac/www.tmac   Fri Jul 12 22:05:12 2002
+++ groff.new/tmac/www.tmac     Fri Jul 12 21:35:33 2002
@@ -44,7 +44,8 @@
 .\" an auxiliary macro for HTML (without following space)
 .\"
 .de HTML-NS
-.  if \\n[www-html] .nop \X^html:\\$*^\c
+.  if \\n[www-html] \
+.    nop \X^html:\\$*^\c
 ..
 .\"
 .\" HX n
@@ -172,9 +173,8 @@
 .\"   Emit a tag for grohtml (without a space).  This is an internal macro.
 .\"
 .de HTML-TAG-NS
-.  if \\n[www-html] \{\
+.  if \\n[www-html] \
 .    nop \X^html-tag:\\$*^\c
-.  \}
 ..
 .\"
 .\" PIMG  [-R|-L|-C] filename [width] [height]

Attachment: groff_char.n.bz2
Description: Binary data

Attachment: groff_char1.html.bz2
Description: Binary data

Attachment: groff_char2.html.bz2
Description: Binary data


reply via email to

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