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

Diff for /mandoc/html.c between version 1.205 and 1.213

version 1.205, 2017/02/05 18:15:39 version 1.213, 2017/06/08 12:54:58
Line 28 
Line 28 
 #include <string.h>  #include <string.h>
 #include <unistd.h>  #include <unistd.h>
   
 #include "mandoc.h"  
 #include "mandoc_aux.h"  #include "mandoc_aux.h"
   #include "mandoc.h"
   #include "roff.h"
 #include "out.h"  #include "out.h"
 #include "html.h"  #include "html.h"
 #include "manconf.h"  #include "manconf.h"
Line 76  static const struct htmldata htmltags[TAG_MAX] = {
Line 77  static const struct htmldata htmltags[TAG_MAX] = {
         {"dt",          HTML_NLAROUND},          {"dt",          HTML_NLAROUND},
         {"dd",          HTML_NLAROUND | HTML_INDENT},          {"dd",          HTML_NLAROUND | HTML_INDENT},
         {"pre",         HTML_NLALL | HTML_NOINDENT},          {"pre",         HTML_NLALL | HTML_NOINDENT},
           {"var",         0},
           {"cite",        0},
         {"b",           0},          {"b",           0},
         {"i",           0},          {"i",           0},
         {"code",        0},          {"code",        0},
Line 234  print_metaf(struct html *h, enum mandoc_esc deco)
Line 237  print_metaf(struct html *h, enum mandoc_esc deco)
         }          }
 }  }
   
   char *
   html_make_id(const struct roff_node *n)
   {
           const struct roff_node  *nch;
           char                    *buf, *cp;
   
           for (nch = n->child; nch != NULL; nch = nch->next)
                   if (nch->type != ROFFT_TEXT)
                           return NULL;
   
           buf = NULL;
           deroff(&buf, n);
   
           /* http://www.w3.org/TR/html5/dom.html#the-id-attribute */
   
           for (cp = buf; *cp != '\0'; cp++)
                   if (*cp == ' ')
                           *cp = '_';
   
           return buf;
   }
   
 int  int
 html_strlen(const char *cp)  html_strlen(const char *cp)
 {  {
Line 532  print_otag(struct html *h, enum htmltag tag, const cha
Line 557  print_otag(struct html *h, enum htmltag tag, const cha
                 print_byte(h, '=');                  print_byte(h, '=');
                 print_byte(h, '"');                  print_byte(h, '"');
                 switch (*fmt) {                  switch (*fmt) {
                 case 'M':  
                         print_href(h, arg1, arg2, 1);  
                         fmt++;  
                         break;  
                 case 'I':                  case 'I':
                         print_href(h, arg1, NULL, 0);                          print_href(h, arg1, NULL, 0);
                         fmt++;                          fmt++;
                         break;                          break;
                   case 'M':
                           print_href(h, arg1, arg2, 1);
                           fmt++;
                           break;
                 case 'R':                  case 'R':
                         print_byte(h, '#');                          print_byte(h, '#');
                           print_encode(h, arg1, NULL, 1);
                         fmt++;                          fmt++;
                         /* FALLTHROUGH */                          break;
                   case 'T':
                           print_encode(h, arg1, NULL, 1);
                           print_word(h, "\" title=\"");
                           print_encode(h, arg1, NULL, 1);
                           fmt++;
                           break;
                 default:                  default:
                         print_encode(h, arg1, NULL, 1);                          print_encode(h, arg1, NULL, 1);
                         break;                          break;
Line 577  print_otag(struct html *h, enum htmltag tag, const cha
Line 609  print_otag(struct html *h, enum htmltag tag, const cha
                         SCALE_VS_INIT(su, i);                          SCALE_VS_INIT(su, i);
                         break;                          break;
                 case 'w':                  case 'w':
                 case 'W':  
                         if ((arg2 = va_arg(ap, char *)) == NULL)                          if ((arg2 = va_arg(ap, char *)) == NULL)
                                 break;                                  break;
                         su = &mysu;                          su = &mysu;
                         a2width(arg2, su);                          a2width(arg2, su);
                         if (fmt[-1] == 'W')                          if (*fmt == '+') {
                                   /* Increase to make even bold text fit. */
                                   su->scale *= 1.2;
                                   /* Add padding. */
                                   su->scale += 3.0;
                                   fmt++;
                           }
                           if (*fmt == '-') {
                                 su->scale *= -1.0;                                  su->scale *= -1.0;
                                   fmt++;
                           }
                         break;                          break;
                 default:                  default:
                         abort();                          abort();
Line 910  print_word(struct html *h, const char *cp)
Line 950  print_word(struct html *h, const char *cp)
 static void  static void
 a2width(const char *p, struct roffsu *su)  a2width(const char *p, struct roffsu *su)
 {  {
         if (a2roffsu(p, su, SCALE_MAX) < 2) {          const char      *end;
   
           end = a2roffsu(p, su, SCALE_MAX);
           if (end == NULL || *end != '\0') {
                 su->unit = SCALE_EN;                  su->unit = SCALE_EN;
                 su->scale = html_strlen(p);                  su->scale = html_strlen(p);
         } else if (su->scale < 0.0)          } else if (su->scale < 0.0)

Legend:
Removed from v.1.205  
changed lines
  Added in v.1.213

CVSweb