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

Diff for /mandoc/html.c between version 1.21 and 1.22

version 1.21, 2008/12/10 10:43:57 version 1.22, 2008/12/10 12:05:33
Line 76  static int  html_begin(struct md_mbuf *,
Line 76  static int  html_begin(struct md_mbuf *,
 static  int             html_printargs(struct md_mbuf *, int,  static  int             html_printargs(struct md_mbuf *, int,
                                 const char *, const int *,                                  const char *, const int *,
                                 const char **, size_t *);                                  const char **, size_t *);
 static  int             html_end(struct md_mbuf *,  static  int             html_end(struct md_mbuf *,
                                 const struct md_args *);                                  const struct md_args *,
                                   const struct tm *,
                                   const char *, const char *,
                                   enum roffmsec, enum roffvol);
 static  int             html_blocktagname(struct md_mbuf *,  static  int             html_blocktagname(struct md_mbuf *,
                                 const struct md_args *, int,                                  const struct md_args *, int,
                                 struct htmlq *, const int *,                                  struct htmlq *, const int *,
Line 384  html_begin(struct md_mbuf *mbuf, const struct md_args 
Line 387  html_begin(struct md_mbuf *mbuf, const struct md_args 
                 const struct tm *tm, const char *os,                  const struct tm *tm, const char *os,
                 const char *name, enum roffmsec msec, enum roffvol vol)                  const char *name, enum roffmsec msec, enum roffvol vol)
 {  {
           enum roffvol     bvol;
         struct html_pair attr[4];          struct html_pair attr[4];
         char             ts[32], title[64];          char             ts[32], title[64];
         int              i;          int              i;
Line 391  html_begin(struct md_mbuf *mbuf, const struct md_args 
Line 395  html_begin(struct md_mbuf *mbuf, const struct md_args 
         (void)snprintf(ts, sizeof(ts), "%s(%s)",          (void)snprintf(ts, sizeof(ts), "%s(%s)",
                         name, roff_msecname(msec));                          name, roff_msecname(msec));
   
         (void)snprintf(ts, sizeof(ts), "%s",  
                         name, roff_volname(vol));  
   
         if (vol >= ROFF_ARCH_START) {          if (vol >= ROFF_ARCH_START) {
                   switch (msec) {
                   case(ROFF_MSEC_1):
                           /* FALLTHROUGH */
                   case(ROFF_MSEC_6):
                           /* FALLTHROUGH */
                   case(ROFF_MSEC_7):
                           bvol = ROFF_VOL_URM;
                           break;
                   case(ROFF_MSEC_2):
                           /* FALLTHROUGH */
                   case(ROFF_MSEC_3):
                           /* FALLTHROUGH */
                   case(ROFF_MSEC_3p):
                           /* FALLTHROUGH */
                   case(ROFF_MSEC_4):
                           /* FALLTHROUGH */
                   case(ROFF_MSEC_5):
                           bvol = ROFF_VOL_PRM;
                           break;
                   case(ROFF_MSEC_8):
                           bvol = ROFF_VOL_PRM;
                           break;
                   case(ROFF_MSEC_9):
                           bvol = ROFF_VOL_KM;
                           break;
                   case(ROFF_MSEC_UNASS):
                           /* FALLTHROUGH */
                   case(ROFF_MSEC_DRAFT):
                           /* FALLTHROUGH */
                   case(ROFF_MSEC_PAPER):
                           bvol = ROFF_VOL_NONE;
                           break;
                   default:
                           abort();
                           /* NOTREACHED */
                   }
   
         }                  (void)snprintf(title, sizeof(title), "%s (%s)",
                                   roff_volname(bvol), roff_volname(vol));
           } else
                   (void)snprintf(title, sizeof(title), "%s", roff_volname(vol));
   
   
         i = 0;          i = 0;
Line 439  html_begin(struct md_mbuf *mbuf, const struct md_args 
Line 479  html_begin(struct md_mbuf *mbuf, const struct md_args 
                                         HTML_TAG_STYLE, 1, attr))                                          HTML_TAG_STYLE, 1, attr))
                         return(0);                          return(0);
                 if ( ! html_commentput(mbuf, ML_OPEN, NULL))                  if ( ! html_commentput(mbuf, ML_OPEN, NULL))
                         return(NULL);                          return(0);
   
                 if ( ! html_loadcss(mbuf, args->params.html.css))                  if ( ! html_loadcss(mbuf, args->params.html.css))
                         return(0);                          return(0);
   
                 if ( ! html_commentput(mbuf, ML_CLOSE, NULL))                  if ( ! html_commentput(mbuf, ML_CLOSE, NULL))
                         return(NULL);                          return(0);
                 if ( ! html_tputln(mbuf, ML_CLOSE, i, HTML_TAG_STYLE))                  if ( ! html_tputln(mbuf, ML_CLOSE, i, HTML_TAG_STYLE))
                         return(0);                          return(0);
         } else {          } else {
Line 474  html_begin(struct md_mbuf *mbuf, const struct md_args 
Line 514  html_begin(struct md_mbuf *mbuf, const struct md_args 
   
         attr[0].attr = HTML_ATTR_WIDTH;          attr[0].attr = HTML_ATTR_WIDTH;
         attr[0].val = "100%";          attr[0].val = "100%";
           attr[1].attr = HTML_ATTR_CLASS;
           attr[1].val = "header-table";
   
         if ( ! html_aputln(mbuf, ML_OPEN, i++, HTML_TAG_TABLE, 1, attr))          if ( ! html_aputln(mbuf, ML_OPEN, i++, HTML_TAG_TABLE, 2, attr))
                 return(0);                  return(0);
         if ( ! html_tputln(mbuf, ML_OPEN, i++, HTML_TAG_TR))          if ( ! html_tputln(mbuf, ML_OPEN, i++, HTML_TAG_TR))
                 return(0);                  return(0);
   
         if ( ! html_tputln(mbuf, ML_OPEN, i, HTML_TAG_TD))          attr[0].attr = HTML_ATTR_ALIGN;
           attr[0].val = "left";
           attr[1].attr = HTML_ATTR_CLASS;
           attr[1].val = "header-section";
   
           if ( ! html_aputln(mbuf, ML_OPEN, i, HTML_TAG_TD, 2, attr))
                 return(0);                  return(0);
         if ( ! ml_putstring(mbuf, ts, NULL))          if ( ! ml_putstring(mbuf, ts, NULL))
                 return(0);                  return(0);
         if ( ! html_tputln(mbuf, ML_CLOSE, i, HTML_TAG_TD))          if ( ! html_tputln(mbuf, ML_CLOSE, i, HTML_TAG_TD))
                 return(0);                  return(0);
   
         if ( ! html_tputln(mbuf, ML_OPEN, i, HTML_TAG_TD))          attr[0].attr = HTML_ATTR_ALIGN;
           attr[0].val = "center";
           attr[1].attr = HTML_ATTR_CLASS;
           attr[1].val = "header-volume";
   
           if ( ! html_aputln(mbuf, ML_OPEN, i, HTML_TAG_TD, 2, attr))
                 return(0);                  return(0);
         /* TODO: middle. */          if ( ! ml_putstring(mbuf, title, NULL))
                   return(0);
         if ( ! html_tputln(mbuf, ML_CLOSE, i, HTML_TAG_TD))          if ( ! html_tputln(mbuf, ML_CLOSE, i, HTML_TAG_TD))
                 return(0);                  return(0);
   
         attr[0].attr = HTML_ATTR_ALIGN;          attr[0].attr = HTML_ATTR_ALIGN;
         attr[0].val = "right";          attr[0].val = "right";
           attr[1].attr = HTML_ATTR_CLASS;
           attr[1].val = "header-section";
   
         if ( ! html_aputln(mbuf, ML_OPEN, i, HTML_TAG_TD, 1, attr))          if ( ! html_aputln(mbuf, ML_OPEN, i, HTML_TAG_TD, 2, attr))
                 return(0);                  return(0);
         if ( ! ml_putstring(mbuf, ts, NULL))          if ( ! ml_putstring(mbuf, ts, NULL))
                 return(0);                  return(0);
Line 511  html_begin(struct md_mbuf *mbuf, const struct md_args 
Line 566  html_begin(struct md_mbuf *mbuf, const struct md_args 
   
 /* ARGSUSED */  /* ARGSUSED */
 static int  static int
 html_end(struct md_mbuf *mbuf, const struct md_args *args)  html_end(struct md_mbuf *mbuf, const struct md_args *args,
                   const struct tm *tm, const char *os,
                   const char *name, enum roffmsec msec, enum roffvol vol)
 {  {
           struct html_pair attr[4];
           int              i;
           char             ts[64];
   
           if (0 == strftime(ts, sizeof(ts), "%B %d, %Y", tm)) {
                   warn("strftime");
                   return(0);
           }
   
           i = 0;
   
           attr[0].attr = HTML_ATTR_WIDTH;
           attr[0].val = "100%";
           attr[1].attr = HTML_ATTR_CLASS;
           attr[1].val = "header-footer";
   
           if ( ! html_aputln(mbuf, ML_OPEN, i++, HTML_TAG_TABLE, 2, attr))
                   return(0);
           if ( ! html_tputln(mbuf, ML_OPEN, i++, HTML_TAG_TR))
                   return(0);
   
           attr[0].attr = HTML_ATTR_ALIGN;
           attr[0].val = "left";
           attr[1].attr = HTML_ATTR_CLASS;
           attr[1].val = "footer-os";
   
           if ( ! html_aputln(mbuf, ML_OPEN, i, HTML_TAG_TD, 2, attr))
                   return(0);
           if ( ! ml_putstring(mbuf, os, NULL))
                   return(0);
           if ( ! html_tputln(mbuf, ML_CLOSE, i, HTML_TAG_TD))
                   return(0);
   
           attr[0].attr = HTML_ATTR_ALIGN;
           attr[0].val = "right";
           attr[1].attr = HTML_ATTR_CLASS;
           attr[1].val = "footer-date";
   
           if ( ! html_aputln(mbuf, ML_OPEN, i, HTML_TAG_TD, 2, attr))
                   return(0);
           if ( ! ml_putstring(mbuf, ts, NULL))
                   return(0);
           if ( ! html_tputln(mbuf, ML_CLOSE, i, HTML_TAG_TD))
                   return(0);
   
           if ( ! html_tputln(mbuf, ML_CLOSE, --i, HTML_TAG_TR))
                   return(0);
           if ( ! html_tputln(mbuf, ML_CLOSE, --i, HTML_TAG_TABLE))
                   return(0);
   
         if ( ! html_tputln(mbuf, ML_CLOSE, 0, HTML_TAG_DIV))          if ( ! html_tputln(mbuf, ML_CLOSE, 0, HTML_TAG_DIV))
                 return(0);                  return(0);

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.22

CVSweb