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

Diff for /mandoc/html.c between version 1.58 and 1.65

version 1.58, 2009/10/07 12:35:23 version 1.65, 2009/10/20 05:45:21
Line 21 
Line 21 
 #include <err.h>  #include <err.h>
 #include <stdio.h>  #include <stdio.h>
 #include <stdarg.h>  #include <stdarg.h>
   #include <stdint.h>
 #include <stdlib.h>  #include <stdlib.h>
 #include <string.h>  #include <string.h>
 #include <unistd.h>  #include <unistd.h>
Line 28 
Line 29 
 #include "out.h"  #include "out.h"
 #include "chars.h"  #include "chars.h"
 #include "html.h"  #include "html.h"
   #include "main.h"
   
   #define UNCONST(a)      ((void *)(uintptr_t)(const void *)(a))
   
 #define DOCTYPE         "-//W3C//DTD HTML 4.01//EN"  #define DOCTYPE         "-//W3C//DTD HTML 4.01//EN"
 #define DTD             "http://www.w3.org/TR/html4/strict.dtd"  #define DTD             "http://www.w3.org/TR/html4/strict.dtd"
   
 struct  htmldata {  struct  htmldata {
         char             *name;          const char       *name;
         int               flags;          int               flags;
 #define HTML_CLRLINE     (1 << 0)  #define HTML_CLRLINE     (1 << 0)
 #define HTML_NOSTACK     (1 << 1)  #define HTML_NOSTACK     (1 << 1)
Line 87  void *
Line 91  void *
 html_alloc(char *outopts)  html_alloc(char *outopts)
 {  {
         struct html     *h;          struct html     *h;
         char            *toks[4], *v;          const char      *toks[4];
           char            *v;
   
         toks[0] = "style";          toks[0] = "style";
         toks[1] = "man";          toks[1] = "man";
Line 106  html_alloc(char *outopts)
Line 111  html_alloc(char *outopts)
         }          }
   
         while (outopts && *outopts)          while (outopts && *outopts)
                 switch (getsubopt(&outopts, toks, &v)) {                  switch (getsubopt(&outopts, UNCONST(toks), &v)) {
                 case (0):                  case (0):
                         h->style = v;                          h->style = v;
                         break;                          break;
Line 549  buffmt_includes(struct html *h, const char *name)
Line 554  buffmt_includes(struct html *h, const char *name)
         const char      *p, *pp;          const char      *p, *pp;
   
         pp = h->base_includes;          pp = h->base_includes;
         while ((p = strchr(pp, '%'))) {  
           while (NULL != (p = strchr(pp, '%'))) {
                 bufncat(h, pp, (size_t)(p - pp));                  bufncat(h, pp, (size_t)(p - pp));
                 switch (*(p + 1)) {                  switch (*(p + 1)) {
                 case('I'):                  case('I'):
Line 573  buffmt_man(struct html *h, 
Line 579  buffmt_man(struct html *h, 
         const char      *p, *pp;          const char      *p, *pp;
   
         pp = h->base_man;          pp = h->base_man;
         while ((p = strchr(pp, '%'))) {  
           /* LINTED */
           while (NULL != (p = strchr(pp, '%'))) {
                 bufncat(h, pp, (size_t)(p - pp));                  bufncat(h, pp, (size_t)(p - pp));
                 switch (*(p + 1)) {                  switch (*(p + 1)) {
                 case('S'):                  case('S'):
Line 596  buffmt_man(struct html *h, 
Line 604  buffmt_man(struct html *h, 
 void  void
 bufcat_su(struct html *h, const char *p, const struct roffsu *su)  bufcat_su(struct html *h, const char *p, const struct roffsu *su)
 {  {
         int              v;          double           v;
         char            *u;          const char      *u;
   
         v = su->scale;          v = su->scale;
   
Line 614  bufcat_su(struct html *h, const char *p, const struct 
Line 622  bufcat_su(struct html *h, const char *p, const struct 
         case (SCALE_PT):          case (SCALE_PT):
                 u = "pt";                  u = "pt";
                 break;                  break;
           case (SCALE_EM):
                   u = "em";
                   break;
         case (SCALE_MM):          case (SCALE_MM):
                 if (0 == (v /= 100))                  if (0 == (v /= 100))
                         v = 1;                          v = 1;
                 u = "em";                  u = "em";
                 break;                  break;
           case (SCALE_EN):
                   u = "ex";
                   break;
           case (SCALE_BU):
                   u = "ex";
                   break;
         case (SCALE_VS):          case (SCALE_VS):
                 /* FALLTHROUGH */  
         case (SCALE_EM):  
                 u = "em";                  u = "em";
                 break;                  break;
         default:          default:
Line 629  bufcat_su(struct html *h, const char *p, const struct 
Line 644  bufcat_su(struct html *h, const char *p, const struct 
                 break;                  break;
         }          }
   
         buffmt(h, "%s: %d%s;", p, v, u);          if (su->pt)
                   buffmt(h, "%s: %f%s;", p, v, u);
           else
                   /* LINTED */
                   buffmt(h, "%s: %d%s;", p, (int)v, u);
 }  }
   

Legend:
Removed from v.1.58  
changed lines
  Added in v.1.65

CVSweb