[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.68 and 1.75

version 1.68, 2010/05/29 18:47:54 version 1.75, 2010/06/04 22:16:27
Line 84  static void    mdoc_dq_post(MDOC_ARGS);
Line 84  static void    mdoc_dq_post(MDOC_ARGS);
 static  int               mdoc_dq_pre(MDOC_ARGS);  static  int               mdoc_dq_pre(MDOC_ARGS);
 static  int               mdoc_dv_pre(MDOC_ARGS);  static  int               mdoc_dv_pre(MDOC_ARGS);
 static  int               mdoc_fa_pre(MDOC_ARGS);  static  int               mdoc_fa_pre(MDOC_ARGS);
   static  void              mdoc_fd_post(MDOC_ARGS);
 static  int               mdoc_fd_pre(MDOC_ARGS);  static  int               mdoc_fd_pre(MDOC_ARGS);
 static  int               mdoc_fl_pre(MDOC_ARGS);  static  int               mdoc_fl_pre(MDOC_ARGS);
 static  int               mdoc_fn_pre(MDOC_ARGS);  static  int               mdoc_fn_pre(MDOC_ARGS);
Line 100  static int    mdoc_it_block_pre(MDOC_ARGS, enum mdoc_l
Line 101  static int    mdoc_it_block_pre(MDOC_ARGS, enum mdoc_l
                                 int, struct roffsu *, struct roffsu *);                                  int, struct roffsu *, struct roffsu *);
 static  int               mdoc_it_head_pre(MDOC_ARGS, enum mdoc_list,  static  int               mdoc_it_head_pre(MDOC_ARGS, enum mdoc_list,
                                 struct roffsu *);                                  struct roffsu *);
 static  int               mdoc_it_body_pre(MDOC_ARGS, enum mdoc_list);  static  int               mdoc_it_body_pre(MDOC_ARGS, enum mdoc_list,
                                   struct roffsu *);
 static  int               mdoc_it_pre(MDOC_ARGS);  static  int               mdoc_it_pre(MDOC_ARGS);
 static  int               mdoc_lb_pre(MDOC_ARGS);  static  int               mdoc_lb_pre(MDOC_ARGS);
 static  int               mdoc_li_pre(MDOC_ARGS);  static  int               mdoc_li_pre(MDOC_ARGS);
Line 157  static const struct htmlmdoc mdocs[MDOC_MAX] = {
Line 159  static const struct htmlmdoc mdocs[MDOC_MAX] = {
         {mdoc_ev_pre, NULL}, /* Ev */          {mdoc_ev_pre, NULL}, /* Ev */
         {mdoc_ex_pre, NULL}, /* Ex */          {mdoc_ex_pre, NULL}, /* Ex */
         {mdoc_fa_pre, NULL}, /* Fa */          {mdoc_fa_pre, NULL}, /* Fa */
         {mdoc_fd_pre, NULL}, /* Fd */          {mdoc_fd_pre, mdoc_fd_post}, /* Fd */
         {mdoc_fl_pre, NULL}, /* Fl */          {mdoc_fl_pre, NULL}, /* Fl */
         {mdoc_fn_pre, NULL}, /* Fn */          {mdoc_fn_pre, NULL}, /* Fn */
         {mdoc_ft_pre, NULL}, /* Ft */          {mdoc_ft_pre, NULL}, /* Ft */
Line 254  static const struct htmlmdoc mdocs[MDOC_MAX] = {
Line 256  static const struct htmlmdoc mdocs[MDOC_MAX] = {
         {mdoc_sp_pre, NULL}, /* br */          {mdoc_sp_pre, NULL}, /* br */
         {mdoc_sp_pre, NULL}, /* sp */          {mdoc_sp_pre, NULL}, /* sp */
         {mdoc__x_pre, mdoc__x_post}, /* %U */          {mdoc__x_pre, mdoc__x_post}, /* %U */
           {NULL, NULL}, /* Ta */
 };  };
   
   
Line 830  mdoc_it_block_pre(MDOC_ARGS, enum mdoc_list type, int 
Line 833  mdoc_it_block_pre(MDOC_ARGS, enum mdoc_list type, int 
         struct roffsu            su;          struct roffsu            su;
   
         nn = n->parent->parent;          nn = n->parent->parent;
         assert(nn->args);  
   
         /* XXX: see notes in mdoc_it_pre(). */          /* XXX: see notes in mdoc_it_pre(). */
   
Line 877  mdoc_it_block_pre(MDOC_ARGS, enum mdoc_list type, int 
Line 879  mdoc_it_block_pre(MDOC_ARGS, enum mdoc_list type, int 
   
 /* ARGSUSED */  /* ARGSUSED */
 static int  static int
 mdoc_it_body_pre(MDOC_ARGS, enum mdoc_list type)  mdoc_it_body_pre(MDOC_ARGS, enum mdoc_list type, struct roffsu *width)
 {  {
         struct htmlpair  tag;          struct htmlpair  tag;
         struct roffsu    su;          struct roffsu    su;
Line 888  mdoc_it_body_pre(MDOC_ARGS, enum mdoc_list type)
Line 890  mdoc_it_body_pre(MDOC_ARGS, enum mdoc_list type)
         case (LIST_ohang):          case (LIST_ohang):
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case (LIST_column):          case (LIST_column):
                   bufcat_su(h, "min-width", width);
                   bufcat_style(h, "clear", "none");
                   if (n->next)
                           bufcat_style(h, "float", "left");
                   PAIR_STYLE_INIT(&tag, h);
                   print_otag(h, TAG_DIV, 1, &tag);
                 break;                  break;
         default:          default:
                 /*                  /*
Line 920  mdoc_it_head_pre(MDOC_ARGS, enum mdoc_list type, struc
Line 928  mdoc_it_head_pre(MDOC_ARGS, enum mdoc_list type, struc
                 print_otag(h, TAG_DIV, 0, &tag);                  print_otag(h, TAG_DIV, 0, &tag);
                 return(1);                  return(1);
         case (LIST_column):          case (LIST_column):
                 bufcat_su(h, "min-width", width);  
                 bufcat_style(h, "clear", "none");  
                 if (n->next && MDOC_HEAD == n->next->type)  
                         bufcat_style(h, "float", "left");  
                 PAIR_STYLE_INIT(&tag, h);  
                 print_otag(h, TAG_DIV, 1, &tag);  
                 break;                  break;
         default:          default:
                 bufcat_su(h, "min-width", width);                  bufcat_su(h, "min-width", width);
Line 1012  mdoc_it_pre(MDOC_ARGS)
Line 1014  mdoc_it_pre(MDOC_ARGS)
   
         /* Get width, offset, and compact arguments. */          /* Get width, offset, and compact arguments. */
   
         for (wp = -1, comp = i = 0; i < (int)bl->args->argc; i++)          wp = -1;
           for (comp = i = 0; bl->args && i < (int)bl->args->argc; i++)
                 switch (bl->args->argv[i].arg) {                  switch (bl->args->argv[i].arg) {
                 case (MDOC_Column):                  case (MDOC_Column):
                         wp = i; /* Save for later. */                          wp = i; /* Save for later. */
Line 1048  mdoc_it_pre(MDOC_ARGS)
Line 1051  mdoc_it_pre(MDOC_ARGS)
                 break;                  break;
         }          }
   
         /* Flip to body/block processing. */          if (LIST_column == type && MDOC_BODY == n->type) {
   
         if (MDOC_BODY == n->type)  
                 return(mdoc_it_body_pre(m, n, h, type));  
         if (MDOC_BLOCK == n->type)  
                 return(mdoc_it_block_pre(m, n, h, type, comp,  
                                         &offs, &width));  
   
         /* Override column widths. */  
   
         if (LIST_column == type) {  
                 nn = n->parent->child;                  nn = n->parent->child;
                 for (i = 0; nn && nn != n; nn = nn->next, i++)                  for (i = 0; nn && nn != n; nn = nn->next)
                         /* Counter... */ ;                          if (MDOC_BODY == nn->type)
                                   i++;
                 if (i < (int)bl->args->argv[wp].sz)                  if (i < (int)bl->args->argv[wp].sz)
                         a2width(bl->args->argv[wp].value[i], &width);                          a2width(bl->args->argv[wp].value[i], &width);
         }          }
   
         return(mdoc_it_head_pre(m, n, h, type, &width));          if (MDOC_HEAD == n->type)
                   return(mdoc_it_head_pre(m, n, h, type, &width));
           else if (MDOC_BODY == n->type)
                   return(mdoc_it_body_pre(m, n, h, type, &width));
   
           return(mdoc_it_block_pre(m, n, h, type, comp, &offs, &width));
 }  }
   
   
Line 1324  mdoc_bd_pre(MDOC_ARGS)
Line 1323  mdoc_bd_pre(MDOC_ARGS)
         SCALE_VS_INIT(&su, 0);          SCALE_VS_INIT(&su, 0);
   
         type = comp = 0;          type = comp = 0;
         for (i = 0; i < (int)bl->args->argc; i++)          for (i = 0; bl->args && i < (int)bl->args->argc; i++)
                 switch (bl->args->argv[i].arg) {                  switch (bl->args->argv[i].arg) {
                 case (MDOC_Offset):                  case (MDOC_Offset):
                         a2offs(bl->args->argv[i].value[0], &su);                          a2offs(bl->args->argv[i].value[0], &su);
Line 1512  mdoc_fa_pre(MDOC_ARGS)
Line 1511  mdoc_fa_pre(MDOC_ARGS)
   
   
 /* ARGSUSED */  /* ARGSUSED */
   static void
   mdoc_fd_post(MDOC_ARGS)
   {
   
           print_otag(h, TAG_BR, 0, NULL);
   }
   
   
   /* ARGSUSED */
 static int  static int
 mdoc_fd_pre(MDOC_ARGS)  mdoc_fd_pre(MDOC_ARGS)
 {  {
         struct htmlpair  tag;          struct htmlpair  tag;
         struct roffsu    su;  
   
         if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags) {  
                 if (n->next && MDOC_Fd != n->next->tok) {  
                         SCALE_VS_INIT(&su, 1);  
                         bufcat_su(h, "margin-bottom", &su);  
                         PAIR_STYLE_INIT(&tag, h);  
                         print_otag(h, TAG_DIV, 1, &tag);  
                 } else  
                         print_otag(h, TAG_DIV, 0, NULL);  
         }  
   
         PAIR_CLASS_INIT(&tag, "macro");          PAIR_CLASS_INIT(&tag, "macro");
         print_otag(h, TAG_SPAN, 1, &tag);          print_otag(h, TAG_SPAN, 1, &tag);
         return(1);          return(1);
Line 1587  mdoc_fn_pre(MDOC_ARGS)
Line 1584  mdoc_fn_pre(MDOC_ARGS)
         int                      sz, i;          int                      sz, i;
         struct roffsu            su;          struct roffsu            su;
   
         if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags) {          /* NB: MDOC_LINE has no effect on this macro! */
           if (SEC_SYNOPSIS == n->sec) {
                 SCALE_HS_INIT(&su, INDENT);                  SCALE_HS_INIT(&su, INDENT);
                 bufcat_su(h, "margin-left", &su);                  bufcat_su(h, "margin-left", &su);
                 su.scale = -su.scale;                  su.scale = -su.scale;
Line 1826  mdoc_in_pre(MDOC_ARGS)
Line 1824  mdoc_in_pre(MDOC_ARGS)
         struct tag              *t;          struct tag              *t;
         struct htmlpair          tag[2];          struct htmlpair          tag[2];
         int                      i;          int                      i;
         struct roffsu            su;  
   
         if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags) {  
                 if (n->next && MDOC_In != n->next->tok) {  
                         SCALE_VS_INIT(&su, 1);  
                         bufcat_su(h, "margin-bottom", &su);  
                         PAIR_STYLE_INIT(&tag[0], h);  
                         print_otag(h, TAG_DIV, 1, tag);  
                 } else  
                         print_otag(h, TAG_DIV, 0, NULL);  
         }  
   
         /* FIXME: there's a buffer bug in here somewhere. */  
   
         PAIR_CLASS_INIT(&tag[0], "includes");          PAIR_CLASS_INIT(&tag[0], "includes");
         print_otag(h, TAG_SPAN, 1, tag);          print_otag(h, TAG_SPAN, 1, tag);
   
         if (SEC_SYNOPSIS == n->sec)          if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags)
                 print_text(h, "#include");                  print_text(h, "#include");
   
         print_text(h, "<");          print_text(h, "<");
         h->flags |= HTML_NOSPACE;          h->flags |= HTML_NOSPACE;
   
         /* XXX -- see warning in termp_in_post(). */  
   
         for (nn = n->child; nn; nn = nn->next) {          for (nn = n->child; nn; nn = nn->next) {
                 PAIR_CLASS_INIT(&tag[0], "link-includes");                  PAIR_CLASS_INIT(&tag[0], "link-includes");
                 i = 1;                  i = 1;
Line 1868  mdoc_in_pre(MDOC_ARGS)
Line 1851  mdoc_in_pre(MDOC_ARGS)
         h->flags |= HTML_NOSPACE;          h->flags |= HTML_NOSPACE;
         print_text(h, ">");          print_text(h, ">");
   
           if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags)
                   print_otag(h, TAG_BR, 0, NULL);
   
         return(0);          return(0);
 }  }
   
Line 1999  mdoc_bf_pre(MDOC_ARGS)
Line 1985  mdoc_bf_pre(MDOC_ARGS)
                 else if ( ! strcmp("Li", n->head->child->string))                  else if ( ! strcmp("Li", n->head->child->string))
                         PAIR_CLASS_INIT(&tag[0], "lit");                          PAIR_CLASS_INIT(&tag[0], "lit");
         } else {          } else {
                 assert(n->args);                  for (i = 0; n->args && i < (int)n->args->argc; i++)
                 for (i = 0; i < (int)n->args->argc; i++)  
                         switch (n->args->argv[i].arg) {                          switch (n->args->argv[i].arg) {
                         case (MDOC_Symbolic):                          case (MDOC_Symbolic):
                                 PAIR_CLASS_INIT(&tag[0], "symb");                                  PAIR_CLASS_INIT(&tag[0], "symb");
Line 2091  mdoc_li_pre(MDOC_ARGS)
Line 2076  mdoc_li_pre(MDOC_ARGS)
   
         PAIR_CLASS_INIT(&tag, "lit");          PAIR_CLASS_INIT(&tag, "lit");
         print_otag(h, TAG_SPAN, 1, &tag);          print_otag(h, TAG_SPAN, 1, &tag);
         if (NULL == n->child)  
                 print_text(h, "");  
         return(1);          return(1);
 }  }
   

Legend:
Removed from v.1.68  
changed lines
  Added in v.1.75

CVSweb