groff
[Top][All Lists]
Advanced

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

[Groff] tag tidying up..


From: Gaius Mulley
Subject: [Groff] tag tidying up..
Date: 14 Dec 2004 21:28:38 +0000
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Hi Werner,

here is a patch which (tidies up some of the tag handling -
or at least removes some of the ugliness :-).

Basically changes include:

 *  .tag is now accessible from any device.
    The libdriver has a default method to ignore the devtag special.
    Only grohtml replaces this method with its own from html_printer.
 *  only two .tag requests: `.tag' and `.taga'
    `.tag' does not place a trailing space after the its operand.
    `.taga' has been left alone.

 *  documentation in groff/src/devices/grohtml/grohtml_tags.man
    to correct with the code. Still not finished behaviour within
    diversions though.
 *  introduced tmac/devtag.tmac which catalogues all generic tag uses.
    HTML specific tag requests are held within www.tmac

 *  categorised the `.HTML', `.HTML-NS' and `.HTML</p> macros in
    groff/src/devices/grohtml/grohtml_tags.man as grohtml pseudo tag
    requests. They are all HTML specific and deal with different ways
    of emitting raw HTML commands so I think it makes sense to
    leave them as implemented by a special.

Hope these changes are useful,

Gaius


Attachment: newfiles.tar.bz2
Description: devtag.tmac and grohtml_tags.man


--- groff-cvs/src/devices/grohtml/post-html.cpp 2004-12-07 21:23:55.000000000 
+0000
+++ groff-html/src/devices/grohtml/post-html.cpp        2004-12-14 
15:41:05.198813960 +0000
@@ -430,7 +430,7 @@
 
   // and return start of new string
 
-  return( &tail->buffer[old_used] );
+  return &tail->buffer[old_used];
 }
 
 char *char_buffer::add_string (const string &s)
@@ -658,7 +658,7 @@
 
 int text_glob::is_eol (void)
 {
-  return is_tag && (strcmp(text_string, "html-tag:.eol") == 0);
+  return is_tag && (strcmp(text_string, "devtag:.eol") == 0);
 }
 
 /*
@@ -667,7 +667,7 @@
 
 int text_glob::is_eol_ce (void)
 {
-  return is_tag && (strcmp(text_string, "html-tag:eol.ce") == 0);
+  return is_tag && (strcmp(text_string, "devtag:eol.ce") == 0);
 }
 
 /*
@@ -676,7 +676,7 @@
 
 int text_glob::is_tl (void)
 {
-  return is_tag && (strcmp(text_string, "html-tag:.tl") == 0);
+  return is_tag && (strcmp(text_string, "devtag:.tl") == 0);
 }
 
 /*
@@ -685,7 +685,7 @@
 
 int text_glob::is_eo_tl (void)
 {
-  return is_tag && (strcmp(text_string, "html-tag:.eo.tl") == 0);
+  return is_tag && (strcmp(text_string, "devtag:.eo.tl") == 0);
 }
 
 /*
@@ -694,8 +694,8 @@
 
 int text_glob::is_nf (void)
 {
-  return is_tag && (strncmp(text_string, "html-tag:.fi",
-                           strlen("html-tag:.fi")) == 0) &&
+  return is_tag && (strncmp(text_string, "devtag:.fi",
+                           strlen("devtag:.fi")) == 0) &&
          (get_arg() == 0);
 }
 
@@ -705,8 +705,8 @@
 
 int text_glob::is_fi (void)
 {
-  return( is_tag && (strncmp(text_string, "html-tag:.fi",
-                            strlen("html-tag:.fi")) == 0) &&
+  return( is_tag && (strncmp(text_string, "devtag:.fi",
+                            strlen("devtag:.fi")) == 0) &&
          (get_arg() == 1) );
 }
 
@@ -716,7 +716,7 @@
 
 int text_glob::is_eo_h (void)
 {
-  return is_tag && (strcmp(text_string, "html-tag:.eo.h") == 0);
+  return is_tag && (strcmp(text_string, "devtag:.eo.h") == 0);
 }
 
 /*
@@ -725,8 +725,8 @@
 
 int text_glob::is_ce (void)
 {
-  return is_tag && (strncmp(text_string, "html-tag:.ce",
-                           strlen("html-tag:.ce")) == 0);
+  return is_tag && (strncmp(text_string, "devtag:.ce",
+                           strlen("devtag:.ce")) == 0);
 }
 
 /*
@@ -735,8 +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, "devtag:.in ",
+                           strlen("devtag:.in ")) == 0);
 }
 
 /*
@@ -745,8 +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, "devtag:.po ",
+                           strlen("devtag:.po ")) == 0);
 }
 
 /*
@@ -755,8 +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, "devtag:.ti ",
+                           strlen("devtag:.ti ")) == 0);
 }
 
 /*
@@ -765,7 +765,8 @@
 
 int text_glob::is_ll (void)
 {
-  return is_tag && (strncmp(text_string, "html-tag:.ll ", strlen("html-tag:.ll 
")) == 0);
+  return is_tag && (strncmp(text_string, "devtag:.ll ",
+                           strlen("devtag:.ll ")) == 0);
 }
 
 /*
@@ -774,7 +775,8 @@
 
 int text_glob::is_col (void)
 {
-  return is_tag && (strncmp(text_string, "html-tag:.col", 
strlen("html-tag:.col")) == 0);
+  return is_tag && (strncmp(text_string, "devtag:.col",
+                           strlen("devtag:.col")) == 0);
 }
 
 /*
@@ -783,7 +785,7 @@
 
 int text_glob::is_tab_ts (void)
 {
-  return is_tag && (strcmp(text_string, "html-tag:.tab-ts") == 0);
+  return is_tag && (strcmp(text_string, "devtag:.tab-ts") == 0);
 }
 
 /*
@@ -792,7 +794,7 @@
 
 int text_glob::is_tab_te (void)
 {
-  return is_tag && (strcmp(text_string, "html-tag:.tab-te") == 0);
+  return is_tag && (strcmp(text_string, "devtag:.tab-te") == 0);
 }
 
 /*
@@ -801,7 +803,8 @@
 
 int text_glob::is_ta (void)
 {
-  return is_tag && (strncmp(text_string, "html-tag:.ta ", strlen("html-tag:.ta 
")) == 0);
+  return is_tag && (strncmp(text_string, "devtag:.ta ",
+                           strlen("devtag:.ta ")) == 0);
 }
 
 /*
@@ -810,7 +813,8 @@
 
 int text_glob::is_tab (void)
 {
-  return is_tag && (strncmp(text_string, "html-tag:tab ", strlen("html-tag:tab 
")) == 0);
+  return is_tag && (strncmp(text_string, "devtag:tab ",
+                           strlen("devtag:tab ")) == 0);
 }
 
 /*
@@ -819,7 +823,8 @@
 
 int text_glob::is_tab0 (void)
 {
-  return is_tag && (strncmp(text_string, "html-tag:tab0", 
strlen("html-tag:tab0")) == 0);
+  return is_tag && (strncmp(text_string, "devtag:tab0",
+                           strlen("devtag:tab0")) == 0);
 }
 
 /*
@@ -841,13 +846,14 @@
 
 int text_glob::is_br (void)
 {
-  return is_a_tag() && ((strcmp ("html-tag:.br", text_string) == 0) ||
-                       (strncmp("html-tag:.sp", text_string, 11) == 0));
+  return is_a_tag() && ((strcmp ("devtag:.br", text_string) == 0) ||
+                       (strncmp("devtag:.sp", text_string,
+                                strlen("devtag:.sp")) == 0));
 }
 
 int text_glob::get_arg (void)
 {
-  if (strncmp("html-tag:", text_string, strlen("html-tag:")) == 0) {
+  if (strncmp("devtag:", text_string, strlen("devtag:")) == 0) {
     const char *p = text_string;
 
     while ((*p != (char)0) && (!isspace(*p)))
@@ -867,7 +873,7 @@
 
 int text_glob::get_tab_args (char *align)
 {
-  if (strncmp("html-tag:", text_string, strlen("html-tag:")) == 0) {
+  if (strncmp("devtag:", text_string, strlen("devtag:")) == 0) {
     const char *p = text_string;
 
     // firstly the alignment C|R|L
@@ -1320,7 +1326,8 @@
   if (str.length() > 0) {
     text_glob *g;
 
-    if (strncmp((str+'\0').contents(), "html-tag:.auto-image", 20) == 0) {
+    if (strncmp((str+'\0').contents(), "devtag:.auto-image",
+               strlen("devtag:.auto-image")) == 0) {
       g = new text_glob();
       g->text_glob_auto_image(s, buffer.add_string(str), str.length(),
                              min_vertical, min_horizontal, max_vertical, 
max_horizontal);
@@ -2097,6 +2104,7 @@
   void begin_page       (int);
   void end_page         (int);
   void special          (char *arg, const environment *env, char type);
+  void devtag           (char *arg, const environment *env, char type);
   font *make_font       (const char *);
   void end_of_line      ();
 };
@@ -2240,7 +2248,7 @@
 }
 
 /*
- *  do_centered_image - set a flag such that the next html-tag is
+ *  do_centered_image - set a flag such that the next devtag is
  *                      placed inside a centered paragraph.
  */
 
@@ -2250,7 +2258,7 @@
 }
 
 /*
- *  do_right_image - set a flag such that the next html-tag is
+ *  do_right_image - set a flag such that the next devtag is
  *                   placed inside a right aligned paragraph.
  */
 
@@ -2260,7 +2268,7 @@
 }
 
 /*
- *  do_left_image - set a flag such that the next html-tag is
+ *  do_left_image - set a flag such that the next devtag is
  *                  placed inside a left aligned paragraph.
  */
 
@@ -2996,7 +3004,7 @@
 }
 
 /*
- *  do_tab - handle the "html-tag:tab" tag
+ *  do_tab - handle the "devtag:tab" tag
  */
 
 void html_printer::do_tab (char *s)
@@ -3014,7 +3022,7 @@
 }
 
 /*
- *  do_tab0 - handle the "html-tag:tab0" tag
+ *  do_tab0 - handle the "devtag:tab0" tag
  */
 
 void html_printer::do_tab0 (void)
@@ -3048,11 +3056,11 @@
 void html_printer::troff_tag (text_glob *g)
 {
   /*
-   *  firstly skip over html-tag:
+   *  firstly skip over devtag:
    */
-  char *t=(char *)g->text_string+9;
+  char *t=(char *)g->text_string+strlen("devtag:");
 
-  if (strncmp(g->text_string, "html</p>:", 9) == 0) {
+  if (strncmp(g->text_string, "html</p>:", strlen("html</p>:")) == 0) {
     do_end_para(g);
   } else if (g->is_eol()) {
     do_eol();
@@ -3141,7 +3149,8 @@
 
 int html_printer::is_in_middle (int left, int right)
 {
-  return( abs(abs(left-pageoffset) - abs(pageoffset+linelength-right)) <= 
CENTER_TOLERANCE );
+  return( abs(abs(left-pageoffset) - abs(pageoffset+linelength-right))
+         <= CENTER_TOLERANCE );
 }
 
 /*
@@ -3269,7 +3278,7 @@
 
   page_contents->glyphs.move_to(where);
   page_contents->glyphs.move_left();
-  page_contents->insert_tag(string("html-tag:.tab-ts"));  // tab table start
+  page_contents->insert_tag(string("devtag:.tab-ts"));  // tab table start
   page_contents->glyphs.move_right();
   start_of_table = page_contents->glyphs.get_data();
   page_contents->glyphs.move_to(old_pos);
@@ -3289,7 +3298,7 @@
   while (page_contents->glyphs.get_data()->is_a_tag())
     page_contents->glyphs.move_left();
 
-  page_contents->insert_tag(string("html-tag:.tab-te"));  // tab table end
+  page_contents->insert_tag(string("devtag:.tab-te"));  // tab table end
   while (g != page_contents->glyphs.get_data())
     page_contents->glyphs.move_right();
   page_contents->dump_page();
@@ -3305,7 +3314,7 @@
 
   page_contents->glyphs.move_to(where);
   page_contents->glyphs.move_left();
-  page_contents->insert_tag(string("html-tag:tab0"));  // tab0 start of line
+  page_contents->insert_tag(string("devtag:tab0"));  // tab0 start of line
   page_contents->glyphs.move_right();
   page_contents->glyphs.move_to(old_pos);
 }
@@ -3498,8 +3507,10 @@
       g = page_contents->glyphs.move_right_get_data();
       handle_state_assertion(g);
       if (page_contents->glyphs.is_equal_to_head()) {
-       if (tbl != NULL)
+       if (tbl != NULL) {
          delete tbl;
+         tbl = NULL;
+       }
        return;
       }
 
@@ -3664,8 +3675,10 @@
       page_contents->insert_tag(string("*** LAST ***"));      
     }
   }
-  if (tbl != NULL)
+  if (tbl != NULL) {
     delete tbl;
+    tbl = NULL;
+  }
 
   // and reset the registers
   pageoffset = old_pageoffset;
@@ -3728,7 +3741,7 @@
 
     return( (fontname != 0) && (fontname[0] == 'C') );
   }
-  return( FALSE );
+  return FALSE;
 }
 
 /*
@@ -4698,7 +4711,7 @@
   else if (strcmp(cmd, "assertion:[y") == 0)
     as.addy(cmd, id, make_val(val, minv, id, file, line), file, line);
   else
-    if (strncmp(cmd, "assertion:[", 11) == 0)
+    if (strncmp(cmd, "assertion:[", strlen("assertion:[")) == 0)
       page_contents->add_tag(&sbuf_style, string(s),
                             line_number, minv, minh, maxv, maxh);
 }
@@ -4725,8 +4738,7 @@
 /*
  *  special - handle all x X requests from troff. For post-html they
  *            allow users to pass raw html commands, turn auto linked
- *            headings off/on and also allow troff to emit tags to
- *            indicate when a: .br, .sp etc occurs.
+ *            headings off/on etc.
  */
 
 void html_printer::special(char *s, const environment *env, char type)
@@ -4793,22 +4805,48 @@
        */
     } else if (strncmp(s, "index:", 6) == 0) {
       cutoff_heading = atoi(&s[6]);
-    } else if (strncmp(s, "html-tag:", 9) == 0) {
+    } else if (strncmp(s, "assertion:[", 11) == 0) {
+      int r=font::res;   /* resolution of the device */
+
+      handle_assertion(env->vpos-env->size*r/72, env->hpos,
+                      env->vpos, env->hpos, s);
+    }
+  }
+}
+
+/*
+ *  devtag - handles device troff tags sent from the `troff'.
+ *           These include the troff state machine tags:
+ *           .br, .sp, .in, .tl, .ll etc
+ *
+ *           (see man 5 grohtml_tags).
+ */
+
+void html_printer::devtag (char *s, const environment *env, char type)
+{
+  if (type != 'p')
+    return;
+
+  if (s != 0) {
+    flush_sbuf();
+    if (env->fontno >= 0) {
+      style sty(get_font_from_index(env->fontno), env->size, env->height,
+               env->slant, env->fontno, *env->col);
+      sbuf_style = sty;
+    }
+
+    if (strncmp(s, "devtag:", strlen("devtag:")) == 0) {
       int r=font::res;   /* resolution of the device */
 
       page_contents->add_tag(&sbuf_style, string(s),
                             line_number,
                             env->vpos-env->size*r/72, env->hpos,
                             env->vpos               , env->hpos);
-    } else if (strncmp(s, "assertion:[", 11) == 0) {
-      int r=font::res;   /* resolution of the device */
-
-      handle_assertion(env->vpos-env->size*r/72, env->hpos,
-                      env->vpos, env->hpos, s);
     }
   }
 }
 
+
 /*
  *  taken from number.cpp in src/roff/troff, [hunits::hunits(units x)]
  */
--- groff-cvs/src/include/printer.h     2004-10-30 12:11:00.000000000 +0100
+++ groff-html/src/include/printer.h    2004-12-14 15:00:05.291441014 +0000
@@ -83,6 +83,8 @@
   virtual void end_of_line();
   virtual void special(char *arg, const environment *env,
                       char type = 'p');
+  virtual void devtag(char *arg, const environment *env,
+                     char type = 'p');
 
 protected:
   font_pointer_list *font_list;
--- groff-cvs/src/libs/libdriver/input.cpp      2004-04-08 21:43:22.000000000 
+0100
+++ groff-html/src/libs/libdriver/input.cpp     2004-12-14 15:03:53.360760611 
+0000
@@ -1520,6 +1520,9 @@
       char *str_arg = get_extended_arg(); // includes line skip
       if (npages <= 0)
        error("`x X' command invalid before first `p' command");
+      else if (str_arg != NULL && (strncmp(str_arg, "devtag:",
+                                          strlen("devtag:")) == 0))
+       pr->devtag(str_arg, current_env);
       else
        pr->special(str_arg, current_env);
       a_delete str_arg;
--- groff-cvs/src/libs/libdriver/printer.cpp    2003-04-15 16:13:35.000000000 
+0100
+++ groff-html/src/libs/libdriver/printer.cpp   2004-12-14 15:00:36.012500144 
+0000
@@ -107,6 +107,10 @@
 {
 }
 
+void printer::devtag(char *, const environment *, char)
+{
+}
+
 void printer::draw(int, int *, int, const environment *)
 {
 }
--- groff-cvs/src/roff/troff/env.cpp    2004-10-15 06:08:35.000000000 +0100
+++ groff-html/src/roff/troff/env.cpp   2004-12-14 14:45:48.782193449 +0000
@@ -2206,7 +2206,7 @@
     if (curdiv == topdiv && topdiv->before_first_page)
       topdiv->begin_page();
     macro *m = new macro;
-    m->append_str("html-tag:");
+    m->append_str("devtag:");
     for (const char *p = nm; *p; p++)
       if (!invalid_input_char((unsigned char)*p))
        m->append(*p);
--- groff-cvs/src/roff/troff/input.cpp  2004-11-22 08:36:29.000000000 +0000
+++ groff-html/src/roff/troff/input.cpp 2004-12-14 21:06:23.731647127 +0000
@@ -6075,8 +6075,7 @@
     for (; c != '\n' && c != EOF; c = get_copy(0))
       s += (char)c;
     s += '\n';
-    if (is_html)
-      curenv->add_node(new tag_node(s, 0));
+    curenv->add_node(new tag_node(s, 0));
   }
   tok.next();
 }
@@ -6099,8 +6098,7 @@
     for (; c != '\n' && c != EOF; c = get_copy(0))
       s += (char)c;
     s += '\n';
-    if (is_html)
-      curenv->add_node(new tag_node(s, 1));
+    curenv->add_node(new tag_node(s, 1));
   }
   tok.next();
 }
--- groff-cvs/src/roff/troff/mtsm.cpp   2004-10-15 06:08:35.000000000 +0100
+++ groff-html/src/roff/troff/mtsm.cpp  2004-12-14 14:35:34.942917257 +0000
@@ -198,27 +198,27 @@
 
 void statem::flush(FILE *fp, statem *compare)
 {
-  int_values[MTSM_FI].diff(fp, "html-tag:.fi",
+  int_values[MTSM_FI].diff(fp, "devtag:.fi",
                           compare->int_values[MTSM_FI]);
-  int_values[MTSM_RJ].diff(fp, "html-tag:.rj",
+  int_values[MTSM_RJ].diff(fp, "devtag:.rj",
                           compare->int_values[MTSM_RJ]);
-  int_values[MTSM_SP].diff(fp, "html-tag:.sp",
+  int_values[MTSM_SP].diff(fp, "devtag:.sp",
                           compare->int_values[MTSM_SP]);
-  units_values[MTSM_IN].diff(fp, "html-tag:.in",
+  units_values[MTSM_IN].diff(fp, "devtag:.in",
                             compare->units_values[MTSM_IN]);
-  units_values[MTSM_LL].diff(fp, "html-tag:.ll",
+  units_values[MTSM_LL].diff(fp, "devtag:.ll",
                             compare->units_values[MTSM_LL]);
-  units_values[MTSM_PO].diff(fp, "html-tag:.po",
+  units_values[MTSM_PO].diff(fp, "devtag:.po",
                             compare->units_values[MTSM_PO]);
-  string_values[MTSM_TA].diff(fp, "html-tag:.ta",
+  string_values[MTSM_TA].diff(fp, "devtag:.ta",
                              compare->string_values[MTSM_TA]);
-  units_values[MTSM_TI].diff(fp, "html-tag:.ti",
+  units_values[MTSM_TI].diff(fp, "devtag:.ti",
                             compare->units_values[MTSM_TI]);
-  int_values[MTSM_CE].diff(fp, "html-tag:.ce",
+  int_values[MTSM_CE].diff(fp, "devtag:.ce",
                           compare->int_values[MTSM_CE]);
-  bool_values[MTSM_EOL].diff(fp, "html-tag:.eol",
+  bool_values[MTSM_EOL].diff(fp, "devtag:.eol",
                             compare->bool_values[MTSM_EOL]);
-  bool_values[MTSM_BR].diff(fp, "html-tag:.br",
+  bool_values[MTSM_BR].diff(fp, "devtag:.br",
                            compare->bool_values[MTSM_BR]);
   if (debug_state) {
     fprintf(stderr, "compared state %d\n", compare->issue_no);
--- groff-cvs/src/roff/troff/node.cpp   2004-10-15 06:08:35.000000000 +0100
+++ groff-html/src/roff/troff/node.cpp  2004-12-14 14:41:20.471345899 +0000
@@ -4081,15 +4081,15 @@
        switch (last_position) {
        case 'c':
          out->start_special();
-         put(out, "html-tag:.centered-image");
+         put(out, "devtag:.centered-image");
          break;
        case 'r':
          out->start_special();
-         put(out, "html-tag:.right-image");
+         put(out, "devtag:.right-image");
          break;
        case 'l':
          out->start_special();
-         put(out, "html-tag:.left-image");
+         put(out, "devtag:.left-image");
          break;
        case 'i':
          ;
@@ -4098,7 +4098,7 @@
        }
        out->end_special();
        out->start_special();
-       put(out, "html-tag:.auto-image ");
+       put(out, "devtag:.auto-image ");
        put(out, name);
        out->end_special();
       }
--- groff-cvs/tmac/an-old.tmac  2004-10-13 08:24:46.000000000 +0100
+++ groff-html/tmac/an-old.tmac 2004-12-14 17:18:49.102721935 +0000
@@ -109,9 +109,9 @@
 .\" .TH title section extra1 extra2 extra3
 .de1 TH
 .  if \\n[an-html] \{\
-.    HTML-TAG-NS ".tl"
+.    DEVTAG-TL
 \\$1
-.    HTML-TAG-NS ".eo.tl"
+.    DEVTAG-EO-TL
 .  \}
 .
 .  de an-init \" We have to do it like this to get multiple man pages right.
@@ -314,7 +314,7 @@
 .  in \\n[an-margin]u
 .  ti 0
 .  nr need_eo_h 1
-.  HTML-TAG-NS ".NH \\n[an-level]"
+.  DEVTAG-NH \\n[an-level]
 .  it 1 an-trap
 .  nr an-no-space-flag 1
 .  nr an-break-flag 1
@@ -377,7 +377,7 @@
 ..
 .
 .de1 an-trap
-.  if \\n[need_eo_h]>0 .HTML-TAG-NS ".eo.h"
+.  if \\n[need_eo_h]>0 .DEVTAG-EO-H
 .  nr need_eo_h 0
 .  ft R
 .  ps \\n[PS]u
@@ -413,9 +413,9 @@
 .    ti -\\n[an-prevailing-indent]u
 .    chop an-div
 .    ne (1v + 1u)
-.    HTML-TAG-NS ".col 1"
+.    DEVTAG-COL 1
 \\*[an-div]\\h'|\\n[an-prevailing-indent]u'\c
-.    HTML-TAG-NEXT ".col 2"
+.    DEVTAG-COL-NEXT 2
 .  \}
 ..
 .
--- groff-cvs/tmac/Makefile.sub 2003-04-10 19:07:35.000000000 +0100
+++ groff-html/tmac/Makefile.sub        2004-12-14 11:50:06.206756503 +0000
@@ -23,6 +23,7 @@
   lj4.tmac \
   lbp.tmac \
   html.tmac html-end.tmac \
+  devtag.tmac \
   europs.tmac \
   composite.tmac \
   eqnrc \
--- groff-cvs/tmac/s.tmac       2004-12-07 21:23:55.000000000 +0000
+++ groff-html/tmac/s.tmac      2004-12-14 17:17:48.463474549 +0000
@@ -178,7 +178,7 @@
 .vs +3p
 .ll (u;\\n[LL]*5/6)
 .nr cov*n-au 0
-.HTML-TAG-NS ".tl"
+.DEVTAG-TL
 ..
 .de @AU
 address@hidden
@@ -382,7 +382,7 @@
 .ce 9999
 .if d cov*tl-div \{\
 .    cov*tl-div
-.    HTML-TAG-NS ".eo.tl"
+.    DEVTAG-EO-TL
 .\}
 .nr cov*i 1
 .nr cov*sp 1v
@@ -500,7 +500,7 @@
 .              nr pg*gutw \\n[LL]-(address@hidden@colw])/(address@hidden)
 .      el .nr pg*gutw 0
 .\}
-.HTML-TAG ".mc address@hidden address@hidden \\n[pg*gutw]"
+.DEVTAG ".mc address@hidden address@hidden \\n[pg*gutw]"
 .mk pg*col-top
 .ns
 .nr pg*col-num 0
@@ -1137,9 +1137,9 @@
 .\" address@hidden
 .de address@hidden
 .br
-.if \\n[need_eo_tl]>0 .HTML-TAG ".eo.tl"
+.if \\n[need_eo_tl]>0 .DEVTAG-EO-TL
 .nr need_eo_tl 0
-.if \\n[need_eo_h]>0 .HTML-TAG ".eo.h"
+.if \\n[need_eo_h]>0 .DEVTAG-EO-H
 .nr need_eo_h 0
 .ce 0
 .rj 0
@@ -1226,14 +1226,14 @@
 .      chop par*label
 .      ti -\\n[\\n[.ev]:ai]u
 .      ie \\n[dl]+1n<=\\n[\\n[.ev]:ai] \{\
-.              HTML-TAG-NS ".col 1"
+.              DEVTAG-COL 1
 \\*[par*label]\h'|\\n[\\n[.ev]:ai]u'\c
-.              HTML-TAG-NS ".col 2"
+.              DEVTAG-COL 2
 .       \}
 .      el \{\
-.              HTML-TAG-NS ".col 1"
+.              DEVTAG-COL 1
 \\*[par*label]
-.              HTML-TAG-NEXT ".col 2"
+.              DEVTAG-COL-NEXT 2
 .              br
 .      \}
 .      rm par*label
@@ -1403,7 +1403,7 @@
 .  nr sh*psincr 0
 .  if 0\\$1>0 .nr sh*psincr (\\n[GROWPS]-0\\$1)*\\n[PSINCR]
 .  SH-NO-TAG
-.  HTML-TAG ".SH 1"
+.  DEVTAG-SH 1
 .  if '\*(.T'html' .nr need_eo_h 1
 ..
 .\" TL, AU, and AI are aliased to these in cov*ab-init.
@@ -1414,7 +1414,7 @@
 .ps +2
 .vs +3p
 .ce 9999
-.HTML-TAG-NS ".tl"
+.DEVTAG-TL
 .nr need_eo_tl 1
 ..
 .de address@hidden
@@ -1575,7 +1575,7 @@
 .if !dSN .als SN SN-DOT
 .nr sh*psincr (\\n[GROWPS]-\\n[nh*hl])*\\n[PSINCR]
 .SH-NO-TAG
-.HTML-TAG-NS ".NH \\$1"
+.DEVTAG-NH "\\$1"
 .  if '\*(.T'html' .nr need_eo_h 1
 \\*[SN-DOT]
 ..
--- groff-cvs/tmac/troffrc-end  2003-04-10 19:07:36.000000000 +0100
+++ groff-html/tmac/troffrc-end 2004-12-14 12:51:03.268591024 +0000
@@ -13,8 +13,7 @@
 .do if !d HTML-IMAGE-RIGHT  .do ds HTML-IMAGE-RIGHT
 .do if !d HTML-IMAGE-LEFT   .do ds HTML-IMAGE-LEFT
 .do if !d HTML-IMAGE-END    .do ds HTML-IMAGE-END
-.do if !d HTML-TAG          .do ds HTML-TAG
-.do if !d HTML-TAG-NS       .do ds HTML-TAG-NS
+.do if !d DEVTAG            .do ds DEVTAG
 .do if !d HTML-DO-IMAGE     .do ds HTML-DO-IMAGE
 .
 .\" Don't let blank lines creep in here.
--- groff-cvs/tmac/www.tmac     2004-11-24 15:42:10.000000000 +0000
+++ groff-html/tmac/www.tmac    2004-12-14 17:19:52.317555089 +0000
@@ -45,6 +45,8 @@
 .nr _C \n(.C
 .cp 0
 .
+.mso devtag.tmac
+.
 .nr www-html 0
 .if '\*[.T]'html' .nr www-html 1
 .
@@ -262,15 +264,21 @@
 .\"
 .de HTML
 .  if \\n[www-html] \{\
+.    \" was implemented via .nop \&\X^html:\\$*^ but
+.    \" is now implemented using HTML-NS to utilize code factoring.
+.    \"
 .    \" the `\&' makes the vertical mode leave, so to say
-.    nop \&\X^html:\\$*^
+.    \"
+.    nop \&\c
+.    HTML-NS \\$*
+.    nop \&
 .  \}
 ..
 .\"
 .\" an auxiliary macro for HTML (without following space)
 .\"
 .de HTML-NS
-.  tag "html:\\$*
+.  nop \X^html:\\$*^\c
 ..
 .\"
 .\" emit a HTML tag after shutting down a (possibly open) paragraph
@@ -314,10 +322,14 @@
 .  ds \\$0:adr \\$1\"
 .  www:url_breaks \\$0:adr
 .  ie \\n[www-html] \{\
+.    ie '\\$3'' .ds \\$0:after \&
+.    el         .ds \\$0:after \\$3
 .    ie '\\$2'' \
-.       HTML <a href="\\$1">\\$1</a>\\$3
+.       HTML-NS <a href="\\$1">\\$1</a>
 .    el \
-.       HTML <a href="\\$1">\\$2</a>\\$3
+.       HTML-NS <a href="\\$1">\\$2</a>
+.    nop \\*[\\$0:after]
+.    rm \\$0:after
 .  \}
 .  el \{\
 .    if !r ps4html .ad l
@@ -385,12 +397,12 @@
 .de IMG
 .  ie \\n[www-html] \{\
 .    ie '\\$2'-R' \
-.      HTML-TAG ".right-image"
+.      DEVTAG ".right-image"
 .    el \{\
 .      ie '\\$2'-L' \
-.        HTML-TAG ".left-image"
+.        DEVTAG ".left-image"
 .      el \
-.        HTML-TAG ".centered-image"
+.        DEVTAG ".centered-image"
 .    \}
 .    nr www-width 100
 .    if !'\\$3'' \
@@ -405,35 +417,6 @@
 .    nop \[la]\f[C]\\$1\f[]\[ra]
 ..
 .\" --------------------------------------------------------------------
-.\" HTML-TAG
-.\"
-.\"   Emit a tag for grohtml.  This is an internal macro.
-.\"
-.de HTML-TAG
-.  if \\n[www-html] \{\
-.    \" the `\&' makes the vertical mode leave, so to say
-.    nop \&\X^html-tag:\\$*^
-.  \}
-..
-.\" --------------------------------------------------------------------
-.\" HTML-TAG-NS
-.\"
-.\"   Emit a tag for grohtml (without a space).  This is an internal macro.
-.\"
-.de HTML-TAG-NS
-.  tag html-tag:\\$*
-..
-.\" --------------------------------------------------------------------
-.\" HTML-TAG-NEXT
-.\"
-.\"   When the troff state changes, emit a tag for grohtml (without a space)
-.\"   This is an internal macro.
-.\"
-.de HTML-TAG-NEXT
-.  taga html-tag:\\$*
-..
-.
-.\" --------------------------------------------------------------------
 .\" PIMG  [-R|-L|-C] filename [width] [height]
 .\"
 .\"   Include a png image.  It will work for -Tps and -Thtml.
@@ -447,12 +430,12 @@
 .de PIMG
 .  ie \\n[www-html] \{\
 .    ie '\\$1'-R' \
-.      HTML-TAG ".right-image"
+.      DEVTAG ".right-image"
 .    el \{\
 .      ie '\\$1'-L' \
-.        HTML-TAG ".left-image"
+.        DEVTAG ".left-image"
 .      el \
-.        HTML-TAG ".centered-image"
+.        DEVTAG ".centered-image"
 .    \}
 .    nr www-width 0
 .    nr www-height 0
@@ -657,13 +640,13 @@
 .    nr www-heading-no 1
 .  el \
 .    nr www-heading-no \\$1
-.  HTML-TAG ".NH \\n[www-heading-no]"
+.  DEVTAG-NH \\n[www-heading-no]
 ..
 .
 .de HnE
 .  if (\\n[www-heading-no] == -1) \
 .    www-error "HnE found without a corresponding HnS"
-.  HTML-TAG ".eo.h"
+.  DEVTAG-EO-H
 ..
 .\" --------------------------------------------------------------------
 .\" LK
@@ -672,7 +655,7 @@
 .\"   section/numbered headings at this position.
 .\"
 .de LK
-.  HTML-TAG-NS ".links"
+.  DEVTAG ".links"
 ..
 .\" --------------------------------------------------------------------
 .\" HR
@@ -689,7 +672,7 @@
 .\"  emits by default.
 .\"
 .de NHR
-.  HTML-TAG ".no-auto-rule"
+.  DEVTAG ".no-auto-rule"
 ..
 .\"
 .\" www-end-nowhere - end of input trap called to finish diversion.
@@ -697,7 +680,7 @@
 .de www-end-nowhere
 .  if !\\n[www-html] \
 .    di
-.  HTML-TAG ".eo.tl"
+.  DEVTAG-EO-TL
 ..
 .\" --------------------------------------------------------------------
 .\" HTL
@@ -711,7 +694,7 @@
 .\"   The macro terminates when a space or break is seen (.sp, .br).
 .\"
 .de HTL
-.  HTML-TAG ".html-tl"
+.  DEVTAG ".html-tl"
 .  if !\\n[www-html] \
 .    di www-nowhere
 .  it 2 www-end-nowhere
@@ -913,7 +896,7 @@
 .\"   The argument to JOBNAME is the file stem for future output files.
 .\"
 .de JOBNAME
-.  HTML-TAG .job-name \\$1
+.  DEVTAG .job-name \\$1
 ..
 .\" --------------------------------------------------------------------
 .\" HEAD
@@ -922,7 +905,7 @@
 .\"   document
 .\" --------------------------------------------------------------------
 .de HEAD
-.  HTML-TAG .head "\\$*"
+.  DEVTAG .head "\\$*"
 ..
 .\" --------------------------------------------------------------------
 .\" Final Setup

reply via email to

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