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

Diff for /mandoc/man_html.c between version 1.147 and 1.153

version 1.147, 2018/04/13 16:28:07 version 1.153, 2018/07/27 17:49:31
Line 35 
Line 35 
   
 /* FIXME: have PD set the default vspace width. */  /* FIXME: have PD set the default vspace width. */
   
 #define INDENT            5  
   
 #define MAN_ARGS          const struct roff_meta *man, \  #define MAN_ARGS          const struct roff_meta *man, \
                           const struct roff_node *n, \                            const struct roff_node *n, \
                           struct html *h                            struct html *h
Line 53  static void    print_man_head(const struct roff_meta *
Line 51  static void    print_man_head(const struct roff_meta *
 static  void              print_man_nodelist(MAN_ARGS);  static  void              print_man_nodelist(MAN_ARGS);
 static  void              print_man_node(MAN_ARGS);  static  void              print_man_node(MAN_ARGS);
 static  int               fillmode(struct html *, int);  static  int               fillmode(struct html *, int);
 static  int               a2width(const struct roff_node *,  
                                 struct roffsu *);  
 static  int               man_B_pre(MAN_ARGS);  static  int               man_B_pre(MAN_ARGS);
 static  int               man_HP_pre(MAN_ARGS);  static  int               man_HP_pre(MAN_ARGS);
 static  int               man_IP_pre(MAN_ARGS);  static  int               man_IP_pre(MAN_ARGS);
Line 368  fillmode(struct html *h, int want)
Line 364  fillmode(struct html *h, int want)
         return had;          return had;
 }  }
   
 static int  
 a2width(const struct roff_node *n, struct roffsu *su)  
 {  
         if (n->type != ROFFT_TEXT)  
                 return 0;  
         return a2roffsu(n->string, su, SCALE_EN) != NULL;  
 }  
   
 static void  static void
 man_root_pre(const struct roff_meta *man, struct html *h)  man_root_pre(const struct roff_meta *man, struct html *h)
 {  {
Line 428  man_SH_pre(MAN_ARGS)
Line 416  man_SH_pre(MAN_ARGS)
         char    *id;          char    *id;
   
         if (n->type == ROFFT_HEAD) {          if (n->type == ROFFT_HEAD) {
                 id = html_make_id(n);                  id = html_make_id(n, 1);
                 print_otag(h, TAG_H1, "cTi", "Sh", id);                  print_otag(h, TAG_H1, "cTi", "Sh", id);
                 if (id != NULL)                  if (id != NULL)
                         print_otag(h, TAG_A, "chR", "selflink", id);                          print_otag(h, TAG_A, "chR", "permalink", id);
                 free(id);  
         }          }
         return 1;          return 1;
 }  }
Line 498  man_SS_pre(MAN_ARGS)
Line 485  man_SS_pre(MAN_ARGS)
         char    *id;          char    *id;
   
         if (n->type == ROFFT_HEAD) {          if (n->type == ROFFT_HEAD) {
                 id = html_make_id(n);                  id = html_make_id(n, 1);
                 print_otag(h, TAG_H2, "cTi", "Ss", id);                  print_otag(h, TAG_H2, "cTi", "Ss", id);
                 if (id != NULL)                  if (id != NULL)
                         print_otag(h, TAG_A, "chR", "selflink", id);                          print_otag(h, TAG_A, "chR", "permalink", id);
                 free(id);  
         }          }
         return 1;          return 1;
 }  }
Line 525  man_IP_pre(MAN_ARGS)
Line 511  man_IP_pre(MAN_ARGS)
         const struct roff_node  *nn;          const struct roff_node  *nn;
   
         if (n->type == ROFFT_BODY) {          if (n->type == ROFFT_BODY) {
                 print_otag(h, TAG_DD, "c", "It-tag");                  print_otag(h, TAG_DD, "");
                 return 1;                  return 1;
         } else if (n->type != ROFFT_HEAD) {          } else if (n->type != ROFFT_HEAD) {
                 print_otag(h, TAG_DL, "c", "Bl-tag");                  print_otag(h, TAG_DL, "c", "Bl-tag");
Line 534  man_IP_pre(MAN_ARGS)
Line 520  man_IP_pre(MAN_ARGS)
   
         /* FIXME: width specification. */          /* FIXME: width specification. */
   
         print_otag(h, TAG_DT, "c", "It-tag");          print_otag(h, TAG_DT, "");
   
         /* For IP, only print the first header element. */          /* For IP, only print the first header element. */
   
Line 559  man_IP_pre(MAN_ARGS)
Line 545  man_IP_pre(MAN_ARGS)
 static int  static int
 man_HP_pre(MAN_ARGS)  man_HP_pre(MAN_ARGS)
 {  {
         struct roffsu    sum, sui;  
         const struct roff_node *np;  
   
         if (n->type == ROFFT_HEAD)          if (n->type == ROFFT_HEAD)
                 return 0;                  return 0;
         else if (n->type != ROFFT_BLOCK)  
                 return 1;  
   
         np = n->head->child;          if (n->type == ROFFT_BLOCK) {
                   print_bvspace(h, n);
         if (np == NULL || !a2width(np, &sum))                  print_otag(h, TAG_DIV, "c", "HP");
                 SCALE_HS_INIT(&sum, INDENT);          }
   
         sui.unit = sum.unit;  
         sui.scale = -sum.scale;  
   
         print_bvspace(h, n);  
         print_otag(h, TAG_DIV, "csului", "Pp", &sum, &sui);  
         return 1;          return 1;
 }  }
   
Line 638  man_ign_pre(MAN_ARGS)
Line 613  man_ign_pre(MAN_ARGS)
 static int  static int
 man_RS_pre(MAN_ARGS)  man_RS_pre(MAN_ARGS)
 {  {
         struct roffsu    su;  
   
         if (n->type == ROFFT_HEAD)          if (n->type == ROFFT_HEAD)
                 return 0;                  return 0;
         else if (n->type == ROFFT_BODY)          if (n->type == ROFFT_BLOCK)
                 return 1;                  print_otag(h, TAG_DIV, "c", "Bd-indent");
   
         SCALE_HS_INIT(&su, INDENT);  
         if (n->head->child)  
                 a2width(n->head->child, &su);  
   
         print_otag(h, TAG_DIV, "sul", &su);  
         return 1;          return 1;
 }  }
   

Legend:
Removed from v.1.147  
changed lines
  Added in v.1.153

CVSweb