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

Diff for /docbook2mdoc/macro.c between version 1.2 and 1.5

version 1.2, 2019/03/28 20:41:33 version 1.5, 2019/04/03 15:04:03
Line 47  macro_open(struct format *f, const char *name)
Line 47  macro_open(struct format *f, const char *name)
 void  void
 macro_close(struct format *f)  macro_close(struct format *f)
 {  {
         assert(f->linestate == LINE_MACRO);          if (f->linestate == LINE_NEW)
                   return;
         putchar('\n');          putchar('\n');
         f->linestate = LINE_NEW;          f->linestate = LINE_NEW;
 }  }
Line 152  macro_argline(struct format *f, const char *name, cons
Line 153  macro_argline(struct format *f, const char *name, cons
 void  void
 macro_addnode(struct format *f, struct pnode *pn, int flags)  macro_addnode(struct format *f, struct pnode *pn, int flags)
 {  {
           struct pnode    *nc;
         int              quote_now;          int              quote_now;
   
         assert(f->linestate == LINE_MACRO);          assert(f->linestate == LINE_MACRO);
Line 161  macro_addnode(struct format *f, struct pnode *pn, int 
Line 163  macro_addnode(struct format *f, struct pnode *pn, int 
          * that text, letting macro_addarg() decide about quoting.           * that text, letting macro_addarg() decide about quoting.
          */           */
   
         if (pn->node == NODE_TEXT ||          while ((nc = TAILQ_FIRST(&pn->childq)) != NULL &&
             ((pn = TAILQ_FIRST(&pn->childq)) != NULL &&              TAILQ_NEXT(nc, child) == NULL)
              pn->node == NODE_TEXT && TAILQ_NEXT(pn, child) == NULL)) {                  pn = nc;
   
           if (pn->node == NODE_TEXT || pn->node == NODE_ESCAPE) {
                 macro_addarg(f, pn->b, flags);                  macro_addarg(f, pn->b, flags);
                 return;                  return;
         }          }
Line 192  macro_addnode(struct format *f, struct pnode *pn, int 
Line 196  macro_addnode(struct format *f, struct pnode *pn, int 
          * inserting whitespace between nodes.           * inserting whitespace between nodes.
          */           */
   
         while (pn != NULL) {          while (nc != NULL) {
                 macro_addnode(f, pn, flags);                  macro_addnode(f, nc, flags);
                 pn = TAILQ_NEXT(pn, child);                  nc = TAILQ_NEXT(nc, child);
                 flags |= ARG_SPACE;                  flags |= ARG_SPACE;
         }          }
         if (quote_now)          if (quote_now)
Line 239  print_textnode(struct format *f, struct pnode *n)
Line 243  print_textnode(struct format *f, struct pnode *n)
 {  {
         struct pnode    *nc;          struct pnode    *nc;
   
         if (n->node == NODE_TEXT)          if (n->node == NODE_TEXT || n->node == NODE_ESCAPE)
                 print_text(f, n->b, ARG_SPACE);                  print_text(f, n->b, ARG_SPACE);
         else          else
                 TAILQ_FOREACH(nc, &n->childq, child)                  TAILQ_FOREACH(nc, &n->childq, child)

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.5

CVSweb