[BACK]Return to mdoc_html.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Diff for /mandoc/mdoc_html.c between version 1.250 and 1.255

version 1.250, 2017/01/18 19:22:22 version 1.255, 2017/01/19 16:59:30
Line 48  struct htmlmdoc {
Line 48  struct htmlmdoc {
         void            (*post)(MDOC_ARGS);          void            (*post)(MDOC_ARGS);
 };  };
   
   static  char             *make_id(const struct roff_node *);
 static  void              print_mdoc_head(MDOC_ARGS);  static  void              print_mdoc_head(MDOC_ARGS);
 static  void              print_mdoc_node(MDOC_ARGS);  static  void              print_mdoc_node(MDOC_ARGS);
 static  void              print_mdoc_nodelist(MDOC_ARGS);  static  void              print_mdoc_nodelist(MDOC_ARGS);
Line 299  void
Line 300  void
 html_mdoc(void *arg, const struct roff_man *mdoc)  html_mdoc(void *arg, const struct roff_man *mdoc)
 {  {
         struct html     *h;          struct html     *h;
         struct tag      *t, *tt;          struct tag      *t;
   
         h = (struct html *)arg;          h = (struct html *)arg;
   
         if ( ! (HTML_FRAGMENT & h->oflags)) {          if ((h->oflags & HTML_FRAGMENT) == 0) {
                 print_gen_decls(h);                  print_gen_decls(h);
                 t = print_otag(h, TAG_HTML, "");                  print_otag(h, TAG_HTML, "");
                 tt = print_otag(h, TAG_HEAD, "");                  t = print_otag(h, TAG_HEAD, "");
                 print_mdoc_head(&mdoc->meta, mdoc->first->child, h);                  print_mdoc_head(&mdoc->meta, mdoc->first->child, h);
                 print_tagq(h, tt);                  print_tagq(h, t);
                 print_otag(h, TAG_BODY, "");                  print_otag(h, TAG_BODY, "");
                 print_otag(h, TAG_DIV, "c", "mandoc");          }
         } else  
                 t = print_otag(h, TAG_DIV, "c", "mandoc");  
   
         mdoc_root_pre(&mdoc->meta, mdoc->first->child, h);          mdoc_root_pre(&mdoc->meta, mdoc->first->child, h);
           t = print_otag(h, TAG_DIV, "c", "manual-text");
         print_mdoc_nodelist(&mdoc->meta, mdoc->first->child, h);          print_mdoc_nodelist(&mdoc->meta, mdoc->first->child, h);
         mdoc_root_post(&mdoc->meta, mdoc->first->child, h);  
         print_tagq(h, t);          print_tagq(h, t);
           mdoc_root_post(&mdoc->meta, mdoc->first->child, h);
           print_tagq(h, NULL);
 }  }
   
 static void  static void
Line 384  print_mdoc_node(MDOC_ARGS)
Line 385  print_mdoc_node(MDOC_ARGS)
                         h->flags |= HTML_NOSPACE;                          h->flags |= HTML_NOSPACE;
                 return;                  return;
         case ROFFT_EQN:          case ROFFT_EQN:
                 if (n->flags & NODE_LINE)  
                         putchar('\n');  
                 print_eqn(h, n->eqn);                  print_eqn(h, n->eqn);
                 break;                  break;
         case ROFFT_TBL:          case ROFFT_TBL:
Line 494  mdoc_root_pre(MDOC_ARGS)
Line 493  mdoc_root_pre(MDOC_ARGS)
         return 1;          return 1;
 }  }
   
 char *  static char *
 make_id(const struct roff_node *n)  make_id(const struct roff_node *n)
 {  {
         const struct roff_node  *nch;          const struct roff_node  *nch;
Line 523  mdoc_sh_pre(MDOC_ARGS)
Line 522  mdoc_sh_pre(MDOC_ARGS)
   
         switch (n->type) {          switch (n->type) {
         case ROFFT_BLOCK:          case ROFFT_BLOCK:
                 print_otag(h, TAG_DIV, "c", "section");  
                 return 1;                  return 1;
         case ROFFT_BODY:          case ROFFT_BODY:
                 if (n->sec == SEC_AUTHORS)                  if (n->sec == SEC_AUTHORS)
Line 534  mdoc_sh_pre(MDOC_ARGS)
Line 532  mdoc_sh_pre(MDOC_ARGS)
         }          }
   
         if ((id = make_id(n)) != NULL) {          if ((id = make_id(n)) != NULL) {
                 print_otag(h, TAG_H1, "i", id);                  print_otag(h, TAG_H1, "ci", "Sh", id);
                 free(id);                  free(id);
         } else          } else
                 print_otag(h, TAG_H1, "");                  print_otag(h, TAG_H1, "c", "Sh");
   
         return 1;          return 1;
 }  }
Line 547  mdoc_ss_pre(MDOC_ARGS)
Line 545  mdoc_ss_pre(MDOC_ARGS)
 {  {
         char    *id;          char    *id;
   
         if (n->type == ROFFT_BLOCK) {          if (n->type != ROFFT_HEAD)
                 print_otag(h, TAG_DIV, "c", "subsection");  
                 return 1;                  return 1;
         } else if (n->type == ROFFT_BODY)  
                 return 1;  
   
         if ((id = make_id(n)) != NULL) {          if ((id = make_id(n)) != NULL) {
                 print_otag(h, TAG_H2, "i", id);                  print_otag(h, TAG_H2, "ci", "Ss", id);
                 free(id);                  free(id);
         } else          } else
                 print_otag(h, TAG_H2, "");                  print_otag(h, TAG_H2, "c", "Ss");
   
         return 1;          return 1;
 }  }
Line 641  mdoc_xr_pre(MDOC_ARGS)
Line 636  mdoc_xr_pre(MDOC_ARGS)
                 return 0;                  return 0;
   
         if (h->base_man)          if (h->base_man)
                 print_otag(h, TAG_A, "chM", "link-man",                  print_otag(h, TAG_A, "chM", "Xr",
                     n->child->string, n->child->next == NULL ?                      n->child->string, n->child->next == NULL ?
                     NULL : n->child->next->string);                      NULL : n->child->next->string);
         else          else
                 print_otag(h, TAG_A, "c", "link-man");                  print_otag(h, TAG_A, "c", "Xr");
   
         n = n->child;          n = n->child;
         print_text(h, n->string);          print_text(h, n->string);
Line 851  mdoc_d1_pre(MDOC_ARGS)
Line 846  mdoc_d1_pre(MDOC_ARGS)
         if (n->type != ROFFT_BLOCK)          if (n->type != ROFFT_BLOCK)
                 return 1;                  return 1;
   
         print_otag(h, TAG_BLOCKQUOTE, "svtvb", 0, 0);          print_otag(h, TAG_DIV, "c", "D1");
   
         /* BLOCKQUOTE needs a block body. */          if (n->tok == MDOC_Dl)
                   print_otag(h, TAG_CODE, "c", "Li");
   
         print_otag(h, TAG_DIV, "c", "display");  
   
         if (MDOC_Dl == n->tok)  
                 print_otag(h, TAG_CODE, "c", "lit");  
   
         return 1;          return 1;
 }  }
   
Line 868  mdoc_sx_pre(MDOC_ARGS)
Line 859  mdoc_sx_pre(MDOC_ARGS)
 {  {
         char    *id;          char    *id;
   
         print_otag(h, TAG_I, "c", "link-sec");  
         if ((id = make_id(n)) != NULL) {          if ((id = make_id(n)) != NULL) {
                 print_otag(h, TAG_A, "chR", "link-sec", id);                  print_otag(h, TAG_A, "chR", "Sx", id);
                 free(id);                  free(id);
         } else          } else
                 print_otag(h, TAG_A, "c", "link-sec");                  print_otag(h, TAG_A, "c", "Sx");
   
         return 1;          return 1;
 }  }
Line 915  mdoc_bd_pre(MDOC_ARGS)
Line 905  mdoc_bd_pre(MDOC_ARGS)
                 offs = -1;                  offs = -1;
   
         if (offs == -1)          if (offs == -1)
                 print_otag(h, TAG_DIV, "cswl", "display", n->norm->Bd.offs);                  print_otag(h, TAG_DIV, "cswl", "Bd", n->norm->Bd.offs);
         else          else
                 print_otag(h, TAG_DIV, "cshl", "display", offs);                  print_otag(h, TAG_DIV, "cshl", "Bd", offs);
   
         if (n->norm->Bd.type != DISP_unfilled &&          if (n->norm->Bd.type != DISP_unfilled &&
             n->norm->Bd.type != DISP_literal)              n->norm->Bd.type != DISP_literal)
                 return 1;                  return 1;
   
         print_otag(h, TAG_PRE, "c", "lit");          print_otag(h, TAG_PRE, "c", "Li");
   
         /* This can be recursive: save & set our literal state. */          /* This can be recursive: save & set our literal state. */
   
Line 1420  mdoc_bf_pre(MDOC_ARGS)
Line 1410  mdoc_bf_pre(MDOC_ARGS)
         else if (FONT_Sy == n->norm->Bf.font)          else if (FONT_Sy == n->norm->Bf.font)
                 cattr = "symb";                  cattr = "symb";
         else if (FONT_Li == n->norm->Bf.font)          else if (FONT_Li == n->norm->Bf.font)
                 cattr = "lit";                  cattr = "Li";
         else          else
                 cattr = "none";                  cattr = "none";
   
Line 1479  mdoc_no_pre(MDOC_ARGS)
Line 1469  mdoc_no_pre(MDOC_ARGS)
 static int  static int
 mdoc_li_pre(MDOC_ARGS)  mdoc_li_pre(MDOC_ARGS)
 {  {
         print_otag(h, TAG_CODE, "c", "lit");          print_otag(h, TAG_CODE, "c", "Li");
         return 1;          return 1;
 }  }
   
Line 1662  mdoc_quote_pre(MDOC_ARGS)
Line 1652  mdoc_quote_pre(MDOC_ARGS)
         case MDOC_Ql:          case MDOC_Ql:
                 print_text(h, "\\(oq");                  print_text(h, "\\(oq");
                 h->flags |= HTML_NOSPACE;                  h->flags |= HTML_NOSPACE;
                 print_otag(h, TAG_CODE, "c", "lit");                  print_otag(h, TAG_CODE, "c", "Li");
                 break;                  break;
         case MDOC_So:          case MDOC_So:
         case MDOC_Sq:          case MDOC_Sq:

Legend:
Removed from v.1.250  
changed lines
  Added in v.1.255

CVSweb