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

Diff for /docbook2mdoc/parse.c between version 1.44 and 1.45

version 1.44, 2019/04/14 22:37:56 version 1.45, 2019/04/16 14:58:19
Line 56  struct parse {
Line 56  struct parse {
         int              nline;  /* Line number of next token. */          int              nline;  /* Line number of next token. */
         int              ncol;   /* Column number of next token. */          int              ncol;   /* Column number of next token. */
         int              del;    /* Levels of nested nodes being deleted. */          int              del;    /* Levels of nested nodes being deleted. */
           int              nofill; /* Levels of open no-fill displays. */
         int              flags;          int              flags;
 #define PFLAG_WARN       (1 << 0)  /* Print warning messages. */  #define PFLAG_WARN       (1 << 0)  /* Print warning messages. */
 #define PFLAG_SPC        (1 << 1)  /* Whitespace before the next element. */  #define PFLAG_SPC        (1 << 1)  /* Whitespace before the next element. */
Line 284  xml_text(struct parse *p, const char *word, int sz)
Line 285  xml_text(struct parse *p, const char *word, int sz)
                 case CLASS_VOID:                  case CLASS_VOID:
                 case CLASS_TEXT:                  case CLASS_TEXT:
                 case CLASS_BLOCK:                  case CLASS_BLOCK:
                   case CLASS_NOFILL:
                         np = NULL;                          np = NULL;
                         break;                          break;
                 case CLASS_TRANS:                  case CLASS_TRANS:
Line 525  xml_elem_start(struct parse *p, const char *name)
Line 527  xml_elem_start(struct parse *p, const char *name)
         case CLASS_ENCL:          case CLASS_ENCL:
                 n->spc = (p->flags & PFLAG_SPC) != 0;                  n->spc = (p->flags & PFLAG_SPC) != 0;
                 break;                  break;
           case CLASS_NOFILL:
                   p->nofill++;
                   /* FALLTHROUGH */
         default:          default:
                 n->spc = 1;                  n->spc = 1;
                 break;                  break;
Line 649  xml_elem_end(struct parse *p, const char *name)
Line 654  xml_elem_end(struct parse *p, const char *name)
                         warn_msg(p, "element not open: </%s>", name);                          warn_msg(p, "element not open: </%s>", name);
                         break;                          break;
                 }                  }
                   if (pnode_class(node) == CLASS_NOFILL)
                           p->nofill--;
   
                 /*                  /*
                  * Refrain from actually closing the document element.                   * Refrain from actually closing the document element.
Line 756  parse_string(struct parse *p, char *b, size_t rlen,
Line 763  parse_string(struct parse *p, char *b, size_t rlen,
     enum pstate *pstate, int refill)      enum pstate *pstate, int refill)
 {  {
         char            *cp;          char            *cp;
           size_t           pws;   /* Parse offset including whitespace. */
         size_t           poff;  /* Parse offset in b[]. */          size_t           poff;  /* Parse offset in b[]. */
         size_t           pend;  /* Offset of the end of the current word. */          size_t           pend;  /* Offset of the end of the current word. */
         int              elem_end;          int              elem_end;
   
         pend = 0;          pend = pws = 0;
         for (;;) {          for (;;) {
   
                 /* Proceed to the next token, skipping whitespace. */                  /* Proceed to the next token, skipping whitespace. */
Line 773  parse_string(struct parse *p, char *b, size_t rlen,
Line 781  parse_string(struct parse *p, char *b, size_t rlen,
                         break;                          break;
                 if (isspace((unsigned char)b[pend])) {                  if (isspace((unsigned char)b[pend])) {
                         p->flags |= PFLAG_SPC;                          p->flags |= PFLAG_SPC;
                           if (b[pend] == '\n')
                                   pws = pend + 1;
                         increment(p, b, &pend, refill);                          increment(p, b, &pend, refill);
                         continue;                          continue;
                 }                  }
Line 934  parse_string(struct parse *p, char *b, size_t rlen,
Line 944  parse_string(struct parse *p, char *b, size_t rlen,
                         advance(p, b, rlen, &pend,                          advance(p, b, rlen, &pend,
                             p->ncur == NODE_DOCTYPE ? "<&]\n" : "<&\n",                              p->ncur == NODE_DOCTYPE ? "<&]\n" : "<&\n",
                             refill);                              refill);
                           if (p->nofill)
                                   poff = pws;
                         xml_text(p, b + poff, pend - poff);                          xml_text(p, b + poff, pend - poff);
                         if (b[pend] == '\n')                          if (b[pend] == '\n')
                                 pnode_closetext(p, 0);                                  pnode_closetext(p, 0);
                 }                  }
                   pws = pend;
         }          }
         return poff;          return poff;
 }  }

Legend:
Removed from v.1.44  
changed lines
  Added in v.1.45

CVSweb