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

Diff for /mandoc/html.c between version 1.202 and 1.203

version 1.202, 2017/01/26 18:28:18 version 1.203, 2017/01/28 22:36:38
Line 449  print_otag(struct html *h, enum htmltag tag, const cha
Line 449  print_otag(struct html *h, enum htmltag tag, const cha
         char             numbuf[16];          char             numbuf[16];
         struct tag      *t;          struct tag      *t;
         const char      *attr;          const char      *attr;
         char            *s;          char            *arg1, *arg2;
         double           v;          double           v;
         int              i, have_style, tflags;          int              i, have_style, tflags;
   
Line 494  print_otag(struct html *h, enum htmltag tag, const cha
Line 494  print_otag(struct html *h, enum htmltag tag, const cha
         have_style = 0;          have_style = 0;
         while (*fmt != '\0') {          while (*fmt != '\0') {
                 if (*fmt == 's') {                  if (*fmt == 's') {
                         print_word(h, " style=\"");  
                         have_style = 1;                          have_style = 1;
                         fmt++;                          fmt++;
                         break;                          break;
                 }                  }
                 s = va_arg(ap, char *);  
                   /* Parse a non-style attribute and its arguments. */
   
                   arg1 = va_arg(ap, char *);
                 switch (*fmt++) {                  switch (*fmt++) {
                 case 'c':                  case 'c':
                         attr = "class";                          attr = "class";
Line 511  print_otag(struct html *h, enum htmltag tag, const cha
Line 513  print_otag(struct html *h, enum htmltag tag, const cha
                         attr = "id";                          attr = "id";
                         break;                          break;
                 case '?':                  case '?':
                         attr = s;                          attr = arg1;
                         s = va_arg(ap, char *);                          arg1 = va_arg(ap, char *);
                         break;                          break;
                 default:                  default:
                         abort();                          abort();
                 }                  }
                   arg2 = NULL;
                   if (*fmt == 'M')
                           arg2 = va_arg(ap, char *);
                   if (arg1 == NULL)
                           continue;
   
                   /* Print the non-style attributes. */
   
                 print_byte(h, ' ');                  print_byte(h, ' ');
                 print_word(h, attr);                  print_word(h, attr);
                 print_byte(h, '=');                  print_byte(h, '=');
                 print_byte(h, '"');                  print_byte(h, '"');
                 switch (*fmt) {                  switch (*fmt) {
                 case 'M':                  case 'M':
                         print_href(h, s, va_arg(ap, char *), 1);                          print_href(h, arg1, arg2, 1);
                         fmt++;                          fmt++;
                         break;                          break;
                 case 'I':                  case 'I':
                         print_href(h, s, NULL, 0);                          print_href(h, arg1, NULL, 0);
                         fmt++;                          fmt++;
                         break;                          break;
                 case 'R':                  case 'R':
Line 535  print_otag(struct html *h, enum htmltag tag, const cha
Line 545  print_otag(struct html *h, enum htmltag tag, const cha
                         fmt++;                          fmt++;
                         /* FALLTHROUGH */                          /* FALLTHROUGH */
                 default:                  default:
                         print_encode(h, s, NULL, 1);                          print_encode(h, arg1, NULL, 1);
                         break;                          break;
                 }                  }
                 print_byte(h, '"');                  print_byte(h, '"');
Line 543  print_otag(struct html *h, enum htmltag tag, const cha
Line 553  print_otag(struct html *h, enum htmltag tag, const cha
   
         /* Print out styles. */          /* Print out styles. */
   
         s = NULL;  
         su = &mysu;  
         while (*fmt != '\0') {          while (*fmt != '\0') {
                   arg1 = NULL;
                   su = NULL;
   
                 /* First letter: input argument type. */                  /* First letter: input argument type. */
   
                 switch (*fmt++) {                  switch (*fmt++) {
                 case 'h':                  case 'h':
                         i = va_arg(ap, int);                          i = va_arg(ap, int);
                           su = &mysu;
                         SCALE_HS_INIT(su, i);                          SCALE_HS_INIT(su, i);
                         break;                          break;
                 case 's':                  case 's':
                         s = va_arg(ap, char *);                          arg1 = va_arg(ap, char *);
                         break;                          break;
                 case 'u':                  case 'u':
                         su = va_arg(ap, struct roffsu *);                          su = va_arg(ap, struct roffsu *);
                         break;                          break;
                 case 'v':                  case 'v':
                         i = va_arg(ap, int);                          i = va_arg(ap, int);
                           su = &mysu;
                         SCALE_VS_INIT(su, i);                          SCALE_VS_INIT(su, i);
                         break;                          break;
                 case 'w':                  case 'w':
                 case 'W':                  case 'W':
                         s = va_arg(ap, char *);                          if ((arg2 = va_arg(ap, char *)) == NULL)
                         a2width(s, su);                                  break;
                           su = &mysu;
                           a2width(arg2, su);
                         if (fmt[-1] == 'W')                          if (fmt[-1] == 'W')
                                 su->scale *= -1.0;                                  su->scale *= -1.0;
                         break;                          break;
Line 600  print_otag(struct html *h, enum htmltag tag, const cha
Line 614  print_otag(struct html *h, enum htmltag tag, const cha
                         attr = "min-width";                          attr = "min-width";
                         break;                          break;
                 case '?':                  case '?':
                         print_word(h, s);                          attr = arg1;
                         print_byte(h, ':');                          arg1 = va_arg(ap, char *);
                         print_byte(h, ' ');                          break;
                         print_word(h, va_arg(ap, char *));  
                         print_byte(h, ';');  
                         if (*fmt != '\0')  
                                 print_byte(h, ' ');  
                         continue;  
                 default:                  default:
                         abort();                          abort();
                 }                  }
                 v = su->scale;                  if (su == NULL && arg1 == NULL)
                 if (su->unit == SCALE_MM && (v /= 100.0) == 0.0)                          continue;
                         v = 1.0;  
                 else if (su->unit == SCALE_BU)                  if (have_style == 1)
                         v /= 24.0;                          print_word(h, " style=\"");
                   else
                           print_byte(h, ' ');
                 print_word(h, attr);                  print_word(h, attr);
                 print_byte(h, ':');                  print_byte(h, ':');
                 print_byte(h, ' ');                  print_byte(h, ' ');
                 (void)snprintf(numbuf, sizeof(numbuf), "%.2f", v);                  if (su != NULL) {
                 print_word(h, numbuf);                          v = su->scale;
                 print_word(h, roffscales[su->unit]);                          if (su->unit == SCALE_MM && (v /= 100.0) == 0.0)
                                   v = 1.0;
                           else if (su->unit == SCALE_BU)
                                   v /= 24.0;
                           (void)snprintf(numbuf, sizeof(numbuf), "%.2f", v);
                           print_word(h, numbuf);
                           print_word(h, roffscales[su->unit]);
                   } else
                           print_word(h, arg1);
                 print_byte(h, ';');                  print_byte(h, ';');
                 if (*fmt != '\0')                  have_style = 2;
                         print_byte(h, ' ');  
         }          }
         if (have_style)          if (have_style == 2)
                 print_byte(h, '"');                  print_byte(h, '"');
   
         va_end(ap);          va_end(ap);

Legend:
Removed from v.1.202  
changed lines
  Added in v.1.203

CVSweb