groff
[Top][All Lists]
Advanced

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

Re: [Groff] Title bug with grohtml


From: Gaius Mulley
Subject: Re: [Groff] Title bug with grohtml
Date: 07 Dec 2004 12:57:39 +0000
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Robert Goulding <address@hidden> writes:

> On Dec 1, 2004, at 4:34 PM, Gaius Mulley wrote:
> 
> > Robert Goulding <address@hidden> writes:
> >
> >> Using the latest CVS, titles include the whole text of the file.
> >> Minimal -ms file to demonstrate this:
> >>
> >> .TL
> >> This is the title
> >> .LP
> >> This is the text.
> >> See how it is contained in the title?
> >
> > Hi Robert,
> >
> > many thanks for the bug report and tiny example, here is a fix
> >
> > Gaius
> >
> This patch *nearly* does it.  Here is a minimal file:
> 
> .TL
> This is the title
> .LP
> This is the text.
> Is it going to come out right?

Hi Robert,

second attempt, I think this works, the patch required an alteration
to post-html.cpp as well as the macro set to ensure that the ordering
of the internal html tags eo.tl and ce doesn't matter,

Gaius


--- groff-cvs/tmac/s.tmac       2004-11-23 22:22:07.000000000 +0000
+++ groff-html/tmac/s.tmac      2004-12-07 10:43:37.000000000 +0000
@@ -179,7 +179,6 @@
 .ll (u;\\n[LL]*5/6)
 .nr cov*n-au 0
 .HTML-TAG-NS ".tl"
-.nr need_eo_tl 1
 ..
 .de @AU
 address@hidden
@@ -381,7 +380,10 @@
 .rs
 .sp 3
 .ce 9999
-.if d cov*tl-div .cov*tl-div
+.if d cov*tl-div \{\
+.    cov*tl-div
+.    HTML-TAG-NS ".eo.tl"
+.\}
 .nr cov*i 1
 .nr cov*sp 1v
 .while \\n[cov*i]<=\\n[cov*n-au] \{\
--- groff-cvs/src/devices/grohtml/post-html.cpp 2004-11-24 14:18:21.000000000 
+0000
+++ groff-html/src/devices/grohtml/post-html.cpp        2004-12-07 
12:30:30.342888951 +0000
@@ -694,7 +694,8 @@
 
 int text_glob::is_nf (void)
 {
-  return is_tag && (strncmp(text_string, "html-tag:.fi", 12) == 0) &&
+  return is_tag && (strncmp(text_string, "html-tag:.fi",
+                           strlen("html-tag:fi")) == 0) &&
          (get_arg() == 0);
 }
 
@@ -704,7 +705,8 @@
 
 int text_glob::is_fi (void)
 {
-  return( is_tag && (strncmp(text_string, "html-tag:.fi", 12) == 0) &&
+  return( is_tag && (strncmp(text_string, "html-tag:.fi",
+                            strlen("html-tag:fi")) == 0) &&
          (get_arg() == 1) );
 }
 
@@ -723,7 +725,8 @@
 
 int text_glob::is_ce (void)
 {
-  return is_tag && (strcmp(text_string, "html-tag:.ce") == 0);
+  return is_tag && (strncmp(text_string, "html-tag:.ce",
+                           strlen("html-tag:.ce")) == 0);
 }
 
 /*
@@ -732,7 +735,8 @@
 
 int text_glob::is_in (void)
 {
-  return is_tag && (strncmp(text_string, "html-tag:.in ", strlen("html-tag:.in 
")) == 0);
+  return is_tag && (strncmp(text_string, "html-tag:.in ",
+                           strlen("html-tag:.in ")) == 0);
 }
 
 /*
@@ -741,7 +745,8 @@
 
 int text_glob::is_po (void)
 {
-  return is_tag && (strncmp(text_string, "html-tag:.po ", strlen("html-tag:.po 
")) == 0);
+  return is_tag && (strncmp(text_string, "html-tag:.po ",
+                           strlen("html-tag:.po ")) == 0);
 }
 
 /*
@@ -750,7 +755,8 @@
 
 int text_glob::is_ti (void)
 {
-  return is_tag && (strncmp(text_string, "html-tag:.ti ", strlen("html-tag:.ti 
")) == 0);
+  return is_tag && (strncmp(text_string, "html-tag:.ti ",
+                           strlen("html-tag:.ti ")) == 0);
 }
 
 /*
@@ -2076,6 +2082,8 @@
   void handle_state_assertion         (text_glob *g);
   void do_end_para                    (text_glob *g);
   int  round_width                    (int x);
+  void handle_tag_within_title        (text_glob *g);
+  
   // ADD HERE
 
 public:
@@ -2208,6 +2216,20 @@
 }
 
 /*
+ *  handle_tag_within_title - handle a limited number of tags within
+ *                            the context of a table. Those tags which
+ *                            set values rather than generate spaces
+ *                            and paragraphs.
+ */
+
+void html_printer::handle_tag_within_title (text_glob *g)
+{
+  if (g->is_in() || g->is_ti() || g->is_po() || g->is_ce() || g->is_ll()
+      || g->is_fi() || g->is_nf())
+    troff_tag(g);
+}
+
+/*
  *  do_center - handle the .ce commands from troff.
  */
 
@@ -2353,6 +2375,7 @@
          title.has_been_found = TRUE;
          return;
        } else if (t->is_a_tag()) {
+         handle_tag_within_title(t);
          page_contents->glyphs.sub_move_right();         /* move onto next 
word */
          removed_from_head = ((!page_contents->glyphs.is_empty()) &&
                               (page_contents->glyphs.is_equal_to_head()));
@@ -2369,7 +2392,8 @@
          removed_from_head = ((!page_contents->glyphs.is_empty()) &&
                               (page_contents->glyphs.is_equal_to_head()));
        }
-      } while ((! page_contents->glyphs.is_equal_to_head()) || 
(removed_from_head));
+      } while ((! page_contents->glyphs.is_equal_to_head()) ||
+              (removed_from_head));
     }
   }
 }




reply via email to

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