[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.115 and 1.119

version 1.115, 2010/12/15 14:52:16 version 1.119, 2010/12/15 16:35:21
Line 246  static const struct htmlmdoc mdocs[MDOC_MAX] = {
Line 246  static const struct htmlmdoc mdocs[MDOC_MAX] = {
   
 static  const char * const lists[LIST_MAX] = {  static  const char * const lists[LIST_MAX] = {
         NULL,          NULL,
         "list-bullet",          "list-bul",
         "list-column",          "list-col",
         "list-dash",          "list-dash",
         "list-diag",          "list-diag",
         "list-enum",          "list-enum",
         "list-hang",          "list-hang",
         "list-hyphen",          "list-hyph",
         "list-inset",          "list-inset",
         "list-item",          "list-item",
         "list-ohang",          "list-ohang",
Line 369  static void
Line 369  static void
 print_mdoc(MDOC_ARGS)  print_mdoc(MDOC_ARGS)
 {  {
         struct tag      *t;          struct tag      *t;
         struct htmlpair  tag;  
   
         t = print_otag(h, TAG_HEAD, 0, NULL);          t = print_otag(h, TAG_HEAD, 0, NULL);
         print_mdoc_head(m, n, h);          print_mdoc_head(m, n, h);
         print_tagq(h, t);          print_tagq(h, t);
   
         t = print_otag(h, TAG_BODY, 0, NULL);          t = print_otag(h, TAG_BODY, 0, NULL);
   
         tag.key = ATTR_CLASS;  
         tag.val = "body";  
         print_otag(h, TAG_DIV, 1, &tag);  
   
         print_mdoc_nodelist(m, n, h);          print_mdoc_nodelist(m, n, h);
         print_tagq(h, t);          print_tagq(h, t);
 }  }
Line 479  mdoc_root_post(MDOC_ARGS)
Line 473  mdoc_root_post(MDOC_ARGS)
   
         time2a(m->date, b, DATESIZ);          time2a(m->date, b, DATESIZ);
   
         /*  
          * XXX: this should use divs, but in Firefox, divs with nested  
          * divs for some reason puke when trying to put a border line  
          * below.  So I use tables, instead.  
          */  
   
         PAIR_CLASS_INIT(&tag[0], "footer");          PAIR_CLASS_INIT(&tag[0], "footer");
         bufcat_style(h, "width", "100%");          bufcat_style(h, "width", "100%");
         PAIR_STYLE_INIT(&tag[1], h);          PAIR_STYLE_INIT(&tag[1], h);
Line 518  mdoc_root_pre(MDOC_ARGS)
Line 506  mdoc_root_pre(MDOC_ARGS)
         struct tag      *t, *tt;          struct tag      *t, *tt;
         char             b[BUFSIZ], title[BUFSIZ];          char             b[BUFSIZ], title[BUFSIZ];
   
         (void)strlcpy(b, m->vol, BUFSIZ);          strlcpy(b, m->vol, BUFSIZ);
   
         if (m->arch) {          if (m->arch) {
                 (void)strlcat(b, " (", BUFSIZ);                  strlcat(b, " (", BUFSIZ);
                 (void)strlcat(b, m->arch, BUFSIZ);                  strlcat(b, m->arch, BUFSIZ);
                 (void)strlcat(b, ")", BUFSIZ);                  strlcat(b, ")", BUFSIZ);
         }          }
   
         (void)snprintf(title, BUFSIZ - 1,          snprintf(title, BUFSIZ - 1, "%s(%s)", m->title, m->msec);
                         "%s(%s)", m->title, m->msec);  
   
         /* XXX: see note in mdoc_root_post() about divs. */  
   
         PAIR_CLASS_INIT(&tag[0], "header");          PAIR_CLASS_INIT(&tag[0], "header");
         bufcat_style(h, "width", "100%");          bufcat_style(h, "width", "100%");
         PAIR_STYLE_INIT(&tag[1], h);          PAIR_STYLE_INIT(&tag[1], h);
Line 903  mdoc_it_pre(MDOC_ARGS)
Line 888  mdoc_it_pre(MDOC_ARGS)
 {  {
         struct roffsu    su;          struct roffsu    su;
         enum mdoc_list   type;          enum mdoc_list   type;
         struct htmlpair  tag;          struct htmlpair  tag[2];
         const struct mdoc_node *bl;          const struct mdoc_node *bl;
   
         bl = n->parent;          bl = n->parent;
Line 914  mdoc_it_pre(MDOC_ARGS)
Line 899  mdoc_it_pre(MDOC_ARGS)
   
         type = bl->data.Bl->type;          type = bl->data.Bl->type;
   
         /* Whether we're top-padded (not "compact"). */          assert(lists[type]);
           PAIR_CLASS_INIT(&tag[0], lists[type]);
   
         SCALE_VS_INIT(&su, ! bl->data.Bl->comp);          SCALE_VS_INIT(&su, ! bl->data.Bl->comp);
         bufcat_su(h, "margin-top", &su);          bufcat_su(h, "margin-top", &su);
         PAIR_STYLE_INIT(&tag, h);          PAIR_STYLE_INIT(&tag[1], h);
   
         if (MDOC_HEAD == n->type) {          if (MDOC_HEAD == n->type) {
                 switch (type) {                  switch (type) {
Line 941  mdoc_it_pre(MDOC_ARGS)
Line 927  mdoc_it_pre(MDOC_ARGS)
                 case(LIST_ohang):                  case(LIST_ohang):
                         /* FALLTHROUGH */                          /* FALLTHROUGH */
                 case(LIST_tag):                  case(LIST_tag):
                         print_otag(h, TAG_DT, 1, &tag);                          print_otag(h, TAG_DT, 2, tag);
                         break;                          break;
                 case(LIST_column):                  case(LIST_column):
                         break;                          break;
Line 960  mdoc_it_pre(MDOC_ARGS)
Line 946  mdoc_it_pre(MDOC_ARGS)
                         /* FALLTHROUGH */                          /* FALLTHROUGH */
                 case(LIST_item):                  case(LIST_item):
                         /* FALLTHROUGH */                          /* FALLTHROUGH */
                         print_otag(h, TAG_LI, 1, &tag);                          print_otag(h, TAG_LI, 2, tag);
                         break;                          break;
                 case(LIST_diag):                  case(LIST_diag):
                         /* FALLTHROUGH */                          /* FALLTHROUGH */
Line 971  mdoc_it_pre(MDOC_ARGS)
Line 957  mdoc_it_pre(MDOC_ARGS)
                 case(LIST_ohang):                  case(LIST_ohang):
                         /* FALLTHROUGH */                          /* FALLTHROUGH */
                 case(LIST_tag):                  case(LIST_tag):
                         print_otag(h, TAG_DD, 0, NULL);                          print_otag(h, TAG_DD, 1, tag);
                         break;                          break;
                 case(LIST_column):                  case(LIST_column):
                         print_otag(h, TAG_TD, 1, &tag);                          print_otag(h, TAG_TD, 2, tag);
                         break;                          break;
                 default:                  default:
                         break;                          break;
Line 982  mdoc_it_pre(MDOC_ARGS)
Line 968  mdoc_it_pre(MDOC_ARGS)
         } else {          } else {
                 switch (type) {                  switch (type) {
                 case (LIST_column):                  case (LIST_column):
                         print_otag(h, TAG_TR, 0, NULL);                          print_otag(h, TAG_TR, 1, tag);
                         break;                          break;
                 default:                  default:
                         break;                          break;
Line 997  static int
Line 983  static int
 mdoc_bl_pre(MDOC_ARGS)  mdoc_bl_pre(MDOC_ARGS)
 {  {
         size_t           i;          size_t           i;
         struct htmlpair  tag[2];          struct htmlpair  tag[3];
         struct roffsu    su;          struct roffsu    su;
   
         if (MDOC_BODY == n->type) {          if (MDOC_BODY == n->type) {
Line 1031  mdoc_bl_pre(MDOC_ARGS)
Line 1017  mdoc_bl_pre(MDOC_ARGS)
                 return(0);                  return(0);
         }          }
   
           SCALE_VS_INIT(&su, 0);
           bufcat_su(h, "margin-top", &su);
           bufcat_su(h, "margin-bottom", &su);
           PAIR_STYLE_INIT(&tag[0], h);
   
         assert(lists[n->data.Bl->type]);          assert(lists[n->data.Bl->type]);
         PAIR_CLASS_INIT(&tag[0], lists[n->data.Bl->type]);          PAIR_CLASS_INIT(&tag[1], lists[n->data.Bl->type]);
         i = 1;          i = 2;
   
         /* Set the block's left-hand margin. */          /* Set the block's left-hand margin. */
   
         if (n->data.Bl->offs) {          if (n->data.Bl->offs) {
                 a2offs(n->data.Bl->offs, &su);                  a2offs(n->data.Bl->offs, &su);
                 bufcat_su(h, "margin-left", &su);                  bufcat_su(h, "margin-left", &su);
                 PAIR_STYLE_INIT(&tag[1], h);                  PAIR_STYLE_INIT(&tag[2], h);
                 i = 2;                  i = 3;
   
         }          }
   
         switch (n->data.Bl->type) {          switch (n->data.Bl->type) {
Line 1138  mdoc_d1_pre(MDOC_ARGS)
Line 1128  mdoc_d1_pre(MDOC_ARGS)
         if (MDOC_BLOCK != n->type)          if (MDOC_BLOCK != n->type)
                 return(1);                  return(1);
   
         /* FIXME: D1 shouldn't be literal. */          SCALE_VS_INIT(&su, 0);
           bufcat_su(h, "margin-top", &su);
           bufcat_su(h, "margin-bottom", &su);
           PAIR_STYLE_INIT(&tag[0], h);
   
         SCALE_VS_INIT(&su, INDENT - 2);          if (MDOC_Dl == n->tok) {
         bufcat_su(h, "margin-left", &su);                  PAIR_CLASS_INIT(&tag[1], "lit");
         PAIR_CLASS_INIT(&tag[0], "lit");                  print_otag(h, TAG_BLOCKQUOTE, 2, tag);
         PAIR_STYLE_INIT(&tag[1], h);          } else
         print_otag(h, TAG_DIV, 2, tag);                  print_otag(h, TAG_BLOCKQUOTE, 1, tag);
   
         return(1);          return(1);
 }  }
   

Legend:
Removed from v.1.115  
changed lines
  Added in v.1.119

CVSweb