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

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

version 1.213, 2017/06/08 12:54:58 version 1.214, 2017/06/14 01:31:26
Line 345  static int
Line 345  static int
 print_encode(struct html *h, const char *p, const char *pend, int norecurse)  print_encode(struct html *h, const char *p, const char *pend, int norecurse)
 {  {
         char             numbuf[16];          char             numbuf[16];
         size_t           sz;          struct tag      *t;
         int              c, len, nospace;  
         const char      *seq;          const char      *seq;
           size_t           sz;
           int              c, len, breakline, nospace;
         enum mandoc_esc  esc;          enum mandoc_esc  esc;
         static const char rejs[9] = { '\\', '<', '>', '&', '"',          static const char rejs[10] = { ' ', '\\', '<', '>', '&', '"',
                 ASCII_NBRSP, ASCII_HYPH, ASCII_BREAK, '\0' };                  ASCII_NBRSP, ASCII_HYPH, ASCII_BREAK, '\0' };
   
         if (pend == NULL)          if (pend == NULL)
                 pend = strchr(p, '\0');                  pend = strchr(p, '\0');
   
           breakline = 0;
         nospace = 0;          nospace = 0;
   
         while (p < pend) {          while (p < pend) {
Line 365  print_encode(struct html *h, const char *p, const char
Line 367  print_encode(struct html *h, const char *p, const char
                 }                  }
   
                 for (sz = strcspn(p, rejs); sz-- && p < pend; p++)                  for (sz = strcspn(p, rejs); sz-- && p < pend; p++)
                         if (*p == ' ')                          print_byte(h, *p);
                                 print_endword(h);  
                         else  
                                 print_byte(h, *p);  
   
                   if (breakline &&
                       (p >= pend || *p == ' ' || *p == ASCII_NBRSP)) {
                           t = print_otag(h, TAG_DIV, "");
                           print_text(h, "\\~");
                           print_tagq(h, t);
                           breakline = 0;
                           while (p < pend && (*p == ' ' || *p == ASCII_NBRSP))
                                   p++;
                           continue;
                   }
   
                 if (p >= pend)                  if (p >= pend)
                         break;                          break;
   
                   if (*p == ' ') {
                           print_endword(h);
                           p++;
                           continue;
                   }
   
                 if (print_escape(h, *p++))                  if (print_escape(h, *p++))
                         continue;                          continue;
   
Line 417  print_encode(struct html *h, const char *p, const char
Line 433  print_encode(struct html *h, const char *p, const char
                         if (c <= 0)                          if (c <= 0)
                                 continue;                                  continue;
                         break;                          break;
                   case ESCAPE_BREAK:
                           breakline = 1;
                           continue;
                 case ESCAPE_NOSPACE:                  case ESCAPE_NOSPACE:
                         if ('\0' == *p)                          if ('\0' == *p)
                                 nospace = 1;                                  nospace = 1;

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

CVSweb