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

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

version 1.55, 2009/10/03 16:36:06 version 1.58, 2009/10/07 12:35:23
Line 25 
Line 25 
 #include <string.h>  #include <string.h>
 #include <unistd.h>  #include <unistd.h>
   
   #include "out.h"
 #include "chars.h"  #include "chars.h"
 #include "html.h"  #include "html.h"
   
Line 75  static const char  *const htmlattrs[ATTR_MAX] = {
Line 76  static const char  *const htmlattrs[ATTR_MAX] = {
         "width",          "width",
         "valign",          "valign",
         "target",          "target",
           "id",
 };  };
   
 #ifdef __linux__  #ifdef __linux__
Line 498  bufinit(struct html *h)
Line 500  bufinit(struct html *h)
   
   
 void  void
   bufcat_style(struct html *h, const char *key, const char *val)
   {
   
           bufcat(h, key);
           bufncat(h, ":", 1);
           bufcat(h, val);
           bufncat(h, ";", 1);
   }
   
   
   void
 bufcat(struct html *h, const char *p)  bufcat(struct html *h, const char *p)
 {  {
   
Line 511  buffmt(struct html *h, const char *fmt, ...)
Line 524  buffmt(struct html *h, const char *fmt, ...)
         va_list          ap;          va_list          ap;
   
         va_start(ap, fmt);          va_start(ap, fmt);
         (void)vsnprintf(h->buf + h->buflen,          (void)vsnprintf(h->buf + (int)h->buflen,
                         BUFSIZ - h->buflen - 1, fmt, ap);                          BUFSIZ - h->buflen - 1, fmt, ap);
         va_end(ap);          va_end(ap);
         h->buflen = strlen(h->buf);          h->buflen = strlen(h->buf);
         assert('\0' == h->buf[h->buflen]);  
 }  }
   
   
Line 528  bufncat(struct html *h, const char *p, size_t sz)
Line 540  bufncat(struct html *h, const char *p, size_t sz)
   
         (void)strncat(h->buf, p, sz);          (void)strncat(h->buf, p, sz);
         h->buflen += sz;          h->buflen += sz;
         assert('\0' == h->buf[h->buflen]);  
 }  }
   
   
Line 539  buffmt_includes(struct html *h, const char *name)
Line 550  buffmt_includes(struct html *h, const char *name)
   
         pp = h->base_includes;          pp = h->base_includes;
         while ((p = strchr(pp, '%'))) {          while ((p = strchr(pp, '%'))) {
                 bufncat(h, pp, p - pp);                  bufncat(h, pp, (size_t)(p - pp));
                 switch (*(p + 1)) {                  switch (*(p + 1)) {
                 case('I'):                  case('I'):
                         bufcat(h, name);                          bufcat(h, name);
Line 563  buffmt_man(struct html *h, 
Line 574  buffmt_man(struct html *h, 
   
         pp = h->base_man;          pp = h->base_man;
         while ((p = strchr(pp, '%'))) {          while ((p = strchr(pp, '%'))) {
                 bufncat(h, pp, p - pp);                  bufncat(h, pp, (size_t)(p - pp));
                 switch (*(p + 1)) {                  switch (*(p + 1)) {
                 case('S'):                  case('S'):
                         bufcat(h, sec);                          bufcat(h, sec ? sec : "1");
                         break;                          break;
                 case('N'):                  case('N'):
                         buffmt(h, name ? name : "1");                          buffmt(h, name);
                         break;                          break;
                 default:                  default:
                         bufncat(h, p, 2);                          bufncat(h, p, 2);
Line 579  buffmt_man(struct html *h, 
Line 590  buffmt_man(struct html *h, 
         }          }
         if (pp)          if (pp)
                 bufcat(h, pp);                  bufcat(h, pp);
   }
   
   
   void
   bufcat_su(struct html *h, const char *p, const struct roffsu *su)
   {
           int              v;
           char            *u;
   
           v = su->scale;
   
           switch (su->unit) {
           case (SCALE_CM):
                   u = "cm";
                   break;
           case (SCALE_IN):
                   u = "in";
                   break;
           case (SCALE_PC):
                   u = "pc";
                   break;
           case (SCALE_PT):
                   u = "pt";
                   break;
           case (SCALE_MM):
                   if (0 == (v /= 100))
                           v = 1;
                   u = "em";
                   break;
           case (SCALE_VS):
                   /* FALLTHROUGH */
           case (SCALE_EM):
                   u = "em";
                   break;
           default:
                   u = "ex";
                   break;
           }
   
           buffmt(h, "%s: %d%s;", p, v, u);
 }  }

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

CVSweb