[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.333 and 1.334

version 1.333, 2020/01/19 18:02:00 version 1.334, 2020/02/27 01:43:52
Line 52  static void    print_mdoc_head(const struct roff_meta 
Line 52  static void    print_mdoc_head(const struct roff_meta 
                                 struct html *);                                  struct html *);
 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);
 static  void              synopsis_pre(struct html *,  static  void              synopsis_pre(struct html *, struct roff_node *);
                                 const struct roff_node *);  
   
 static  void              mdoc_root_post(const struct roff_meta *,  static  void              mdoc_root_post(const struct roff_meta *,
                                 struct html *);                                  struct html *);
Line 250  static const struct mdoc_html_act mdoc_html_acts[MDOC_
Line 249  static const struct mdoc_html_act mdoc_html_acts[MDOC_
  * See the same function in mdoc_term.c for documentation.   * See the same function in mdoc_term.c for documentation.
  */   */
 static void  static void
 synopsis_pre(struct html *h, const struct roff_node *n)  synopsis_pre(struct html *h, struct roff_node *n)
 {  {
           struct roff_node *np;
   
         if (NULL == n->prev || ! (NODE_SYNPRETTY & n->flags))          if ((n->flags & NODE_SYNPRETTY) == 0 ||
               (np = roff_node_prev(n)) == NULL)
                 return;                  return;
   
         if (n->prev->tok == n->tok &&          if (np->tok == n->tok &&
             MDOC_Fo != n->tok &&              MDOC_Fo != n->tok &&
             MDOC_Ft != n->tok &&              MDOC_Ft != n->tok &&
             MDOC_Fn != n->tok) {              MDOC_Fn != n->tok) {
Line 264  synopsis_pre(struct html *h, const struct roff_node *n
Line 265  synopsis_pre(struct html *h, const struct roff_node *n
                 return;                  return;
         }          }
   
         switch (n->prev->tok) {          switch (np->tok) {
         case MDOC_Fd:          case MDOC_Fd:
         case MDOC_Fn:          case MDOC_Fn:
         case MDOC_Fo:          case MDOC_Fo:
Line 625  mdoc_ss_pre(MDOC_ARGS)
Line 626  mdoc_ss_pre(MDOC_ARGS)
 static int  static int
 mdoc_fl_pre(MDOC_ARGS)  mdoc_fl_pre(MDOC_ARGS)
 {  {
         char    *id;          struct roff_node        *nn;
           char                    *id;
   
         if ((id = cond_id(n)) != NULL)          if ((id = cond_id(n)) != NULL)
                 print_otag(h, TAG_A, "chR", "permalink", id);                  print_otag(h, TAG_A, "chR", "permalink", id);
         print_otag(h, TAG_CODE, "ci", "Fl", id);          print_otag(h, TAG_CODE, "ci", "Fl", id);
   
         print_text(h, "\\-");          print_text(h, "\\-");
         if (!(n->child == NULL &&          if (n->child != NULL ||
             (n->next == NULL ||              ((nn = roff_node_next(n)) != NULL &&
              n->next->type == ROFFT_TEXT ||               nn->type != ROFFT_TEXT &&
              n->next->flags & NODE_LINE)))               (nn->flags & NODE_LINE) == 0))
                 h->flags |= HTML_NOSPACE;                  h->flags |= HTML_NOSPACE;
   
         return 1;          return 1;
Line 909  mdoc_bl_pre(MDOC_ARGS)
Line 911  mdoc_bl_pre(MDOC_ARGS)
 static int  static int
 mdoc_ex_pre(MDOC_ARGS)  mdoc_ex_pre(MDOC_ARGS)
 {  {
         if (n->prev)          if (roff_node_prev(n) != NULL)
                 print_otag(h, TAG_BR, "");                  print_otag(h, TAG_BR, "");
         return 1;          return 1;
 }  }
Line 986  mdoc_bd_pre(MDOC_ARGS)
Line 988  mdoc_bd_pre(MDOC_ARGS)
                         continue;                          continue;
                 if (nn->tok == MDOC_Sh || nn->tok == MDOC_Ss)                  if (nn->tok == MDOC_Sh || nn->tok == MDOC_Ss)
                         comp = 1;                          comp = 1;
                 if (nn->prev != NULL)                  if (roff_node_prev(nn) != NULL)
                         break;                          break;
         }          }
         (void)strlcpy(buf, "Bd", sizeof(buf));          (void)strlcpy(buf, "Bd", sizeof(buf));
Line 1098  mdoc_fa_pre(MDOC_ARGS)
Line 1100  mdoc_fa_pre(MDOC_ARGS)
                 print_otag(h, TAG_VAR, "c", "Fa");                  print_otag(h, TAG_VAR, "c", "Fa");
                 return 1;                  return 1;
         }          }
           for (nn = n->child; nn != NULL; nn = nn->next) {
         for (nn = n->child; nn; nn = nn->next) {  
                 t = print_otag(h, TAG_VAR, "c", "Fa");                  t = print_otag(h, TAG_VAR, "c", "Fa");
                 print_text(h, nn->string);                  print_text(h, nn->string);
                 print_tagq(h, t);                  print_tagq(h, t);
                 if (nn->next) {                  if (nn->next != NULL) {
                         h->flags |= HTML_NOSPACE;                          h->flags |= HTML_NOSPACE;
                         print_text(h, ",");                          print_text(h, ",");
                 }                  }
         }          }
           if (n->child != NULL &&
         if (n->child && n->next && n->next->tok == MDOC_Fa) {              (nn = roff_node_next(n)) != NULL &&
               nn->tok == MDOC_Fa) {
                 h->flags |= HTML_NOSPACE;                  h->flags |= HTML_NOSPACE;
                 print_text(h, ",");                  print_text(h, ",");
         }          }
   
         return 0;          return 0;
 }  }
   
Line 1572  mdoc_sy_pre(MDOC_ARGS)
Line 1573  mdoc_sy_pre(MDOC_ARGS)
 static int  static int
 mdoc_lb_pre(MDOC_ARGS)  mdoc_lb_pre(MDOC_ARGS)
 {  {
         if (SEC_LIBRARY == n->sec && NODE_LINE & n->flags && n->prev)          if (n->sec == SEC_LIBRARY &&
               n->flags & NODE_LINE &&
               roff_node_prev(n) != NULL)
                 print_otag(h, TAG_BR, "");                  print_otag(h, TAG_BR, "");
   
         print_otag(h, TAG_SPAN, "c", "Lb");          print_otag(h, TAG_SPAN, "c", "Lb");
Line 1582  mdoc_lb_pre(MDOC_ARGS)
Line 1585  mdoc_lb_pre(MDOC_ARGS)
 static int  static int
 mdoc__x_pre(MDOC_ARGS)  mdoc__x_pre(MDOC_ARGS)
 {  {
         const char      *cattr;          struct roff_node        *nn;
         enum htmltag     t;          const char              *cattr;
           enum htmltag             t;
   
         t = TAG_SPAN;          t = TAG_SPAN;
   
         switch (n->tok) {          switch (n->tok) {
         case MDOC__A:          case MDOC__A:
                 cattr = "RsA";                  cattr = "RsA";
                 if (n->prev && MDOC__A == n->prev->tok)                  if ((nn = roff_node_prev(n)) != NULL && nn->tok == MDOC__A &&
                         if (NULL == n->next || MDOC__A != n->next->tok)                      ((nn = roff_node_next(n)) == NULL || nn->tok != MDOC__A))
                                 print_text(h, "and");                          print_text(h, "and");
                 break;                  break;
         case MDOC__B:          case MDOC__B:
                 t = TAG_I;                  t = TAG_I;
Line 1647  mdoc__x_pre(MDOC_ARGS)
Line 1651  mdoc__x_pre(MDOC_ARGS)
 static void  static void
 mdoc__x_post(MDOC_ARGS)  mdoc__x_post(MDOC_ARGS)
 {  {
           struct roff_node *nn;
   
         if (MDOC__A == n->tok && n->next && MDOC__A == n->next->tok)          if (n->tok == MDOC__A &&
                 if (NULL == n->next->next || MDOC__A != n->next->next->tok)              (nn = roff_node_next(n)) != NULL && nn->tok == MDOC__A &&
                         if (NULL == n->prev || MDOC__A != n->prev->tok)              ((nn = roff_node_next(nn)) == NULL || nn->tok != MDOC__A) &&
                                 return;              ((nn = roff_node_prev(n)) == NULL || nn->tok != MDOC__A))
                   return;
   
         /* TODO: %U */          /* TODO: %U */
   
         if (NULL == n->parent || MDOC_Rs != n->parent->tok)          if (n->parent == NULL || n->parent->tok != MDOC_Rs)
                 return;                  return;
   
         h->flags |= HTML_NOSPACE;          h->flags |= HTML_NOSPACE;
         print_text(h, n->next ? "," : ".");          print_text(h, roff_node_next(n) ? "," : ".");
 }  }
   
 static int  static int

Legend:
Removed from v.1.333  
changed lines
  Added in v.1.334

CVSweb