[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.77 and 1.82

version 1.77, 2011/07/07 13:26:25 version 1.82, 2011/10/05 21:35:17
Line 36 
Line 36 
 /* FIXME: have PD set the default vspace width. */  /* FIXME: have PD set the default vspace width. */
   
 #define INDENT            5  #define INDENT            5
 #define HALFINDENT        3  
   
 #define MAN_ARGS          const struct man_meta *m, \  #define MAN_ARGS          const struct man_meta *m, \
                           const struct man_node *n, \                            const struct man_node *n, \
Line 142  print_bvspace(struct html *h, const struct man_node *n
Line 141  print_bvspace(struct html *h, const struct man_node *n
 void  void
 html_man(void *arg, const struct man *m)  html_man(void *arg, const struct man *m)
 {  {
         struct html     *h;  
         struct tag      *t;  
         struct mhtml     mh;          struct mhtml     mh;
   
         h = (struct html *)arg;  
   
         print_gen_decls(h);  
   
         memset(&mh, 0, sizeof(struct mhtml));          memset(&mh, 0, sizeof(struct mhtml));
           print_man(man_meta(m), man_node(m), &mh, (struct html *)arg);
         t = print_otag(h, TAG_HTML, 0, NULL);          putchar('\n');
         print_man(man_meta(m), man_node(m), &mh, h);  
         print_tagq(h, t);  
   
         printf("\n");  
 }  }
   
 static void  static void
 print_man(MAN_ARGS)  print_man(MAN_ARGS)
 {  {
         struct tag      *t;          struct tag      *t, *tt;
           struct htmlpair  tag;
   
         t = print_otag(h, TAG_HEAD, 0, NULL);          PAIR_CLASS_INIT(&tag, "mandoc");
         print_man_head(m, n, mh, h);  
         print_tagq(h, t);  
   
         t = print_otag(h, TAG_BODY, 0, NULL);          if ( ! (HTML_FRAGMENT & h->oflags)) {
                   print_gen_decls(h);
                   t = print_otag(h, TAG_HTML, 0, NULL);
                   tt = print_otag(h, TAG_HEAD, 0, NULL);
                   print_man_head(m, n, mh, h);
                   print_tagq(h, tt);
                   print_otag(h, TAG_BODY, 0, NULL);
                   print_otag(h, TAG_DIV, 1, &tag);
           } else
                   t = print_otag(h, TAG_DIV, 1, &tag);
   
         print_man_nodelist(m, n, mh, h);          print_man_nodelist(m, n, mh, h);
         print_tagq(h, t);          print_tagq(h, t);
 }  }
Line 201  print_man_node(MAN_ARGS)
Line 199  print_man_node(MAN_ARGS)
 {  {
         int              child;          int              child;
         struct tag      *t;          struct tag      *t;
         struct htmlpair  tag;  
   
         child = 1;          child = 1;
         t = h->tags.head;          t = h->tags.head;
Line 219  print_man_node(MAN_ARGS)
Line 216  print_man_node(MAN_ARGS)
                 if ('\0' == *n->string) {                  if ('\0' == *n->string) {
                         print_otag(h, TAG_P, 0, NULL);                          print_otag(h, TAG_P, 0, NULL);
                         return;                          return;
                 } else if (' ' == *n->string && MAN_LINE & n->flags)                  }
   
                   if (' ' == *n->string && MAN_LINE & n->flags)
                         print_otag(h, TAG_BR, 0, NULL);                          print_otag(h, TAG_BR, 0, NULL);
                   else if (MANH_LITERAL & mh->fl && n->prev)
                           print_otag(h, TAG_BR, 0, NULL);
   
                 print_text(h, n->string);                  print_text(h, n->string);
   
                 /*  
                  * If we're in a literal context, make sure that words  
                  * togehter on the same line stay together.  This is a  
                  * POST-printing call, so we check the NEXT word.  Since  
                  * -man doesn't have nested macros, we don't need to be  
                  * more specific than this.  
                  */  
                 if (MANH_LITERAL & mh->fl &&  
                                 (NULL == n->next ||  
                                  n->next->line > n->line))  
                         print_otag(h, TAG_BR, 0, NULL);  
                 return;                  return;
         case (MAN_EQN):          case (MAN_EQN):
                 PAIR_CLASS_INIT(&tag, "eqn");                  print_eqn(h, n->eqn);
                 print_otag(h, TAG_SPAN, 1, &tag);  
                 print_text(h, n->eqn->data);  
                 break;                  break;
         case (MAN_TBL):          case (MAN_TBL):
                 /*                  /*
Line 453  static int
Line 440  static int
 man_alt_pre(MAN_ARGS)  man_alt_pre(MAN_ARGS)
 {  {
         const struct man_node   *nn;          const struct man_node   *nn;
         int              i;          int              i, savelit;
         enum htmltag     fp;          enum htmltag     fp;
         struct tag      *t;          struct tag      *t;
   
           if ((savelit = mh->fl & MANH_LITERAL))
                   print_otag(h, TAG_BR, 0, NULL);
   
           mh->fl &= ~MANH_LITERAL;
   
         for (i = 0, nn = n->child; nn; nn = nn->next, i++) {          for (i = 0, nn = n->child; nn; nn = nn->next, i++) {
                 t = NULL;                  t = NULL;
                 switch (n->tok) {                  switch (n->tok) {
Line 495  man_alt_pre(MAN_ARGS)
Line 487  man_alt_pre(MAN_ARGS)
                         print_tagq(h, t);                          print_tagq(h, t);
         }          }
   
           if (savelit)
                   mh->fl |= MANH_LITERAL;
   
         return(0);          return(0);
 }  }
   
Line 554  man_IP_pre(MAN_ARGS)
Line 549  man_IP_pre(MAN_ARGS)
                 return(1);                  return(1);
         }          }
   
           /* FIXME: width specification. */
   
         print_otag(h, TAG_DT, 0, NULL);          print_otag(h, TAG_DT, 0, NULL);
   
         /* For IP, only print the first header element. */          /* For IP, only print the first header element. */
Line 623  static int
Line 620  static int
 man_literal_pre(MAN_ARGS)  man_literal_pre(MAN_ARGS)
 {  {
   
         if (MAN_nf == n->tok) {          if (MAN_nf != n->tok) {
                 print_otag(h, TAG_BR, 0, NULL);                  print_otag(h, TAG_BR, 0, NULL);
                 mh->fl |= MANH_LITERAL;  
         } else  
                 mh->fl &= ~MANH_LITERAL;                  mh->fl &= ~MANH_LITERAL;
           } else
                   mh->fl |= MANH_LITERAL;
   
         return(0);          return(0);
 }  }

Legend:
Removed from v.1.77  
changed lines
  Added in v.1.82

CVSweb