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

Diff for /docbook2mdoc/docbook2mdoc.c between version 1.106 and 1.107

version 1.106, 2019/04/12 07:05:19 version 1.107, 2019/04/12 08:48:16
Line 38  pnode_printtext(struct format *f, struct pnode *n)
Line 38  pnode_printtext(struct format *f, struct pnode *n)
         struct pnode    *nn;          struct pnode    *nn;
         char            *cp;          char            *cp;
         int              accept_arg;          int              accept_arg;
         char             last;  
   
         cp = n->b;          cp = n->b;
         accept_arg = f->flags & FMT_ARG;          accept_arg = f->flags & FMT_ARG;
         if (f->linestate == LINE_MACRO && n->spc == 0 && !accept_arg) {          if (f->linestate == LINE_MACRO && !n->spc && !accept_arg) {
                 for (;;) {                  for (;;) {
                         if (*cp == '\0')                          if (*cp == '\0')
                                 return;                                  return;
Line 80  pnode_printtext(struct format *f, struct pnode *n)
Line 79  pnode_printtext(struct format *f, struct pnode *n)
         }          }
   
         switch (f->linestate) {          switch (f->linestate) {
           case LINE_NEW:
                   break;
         case LINE_TEXT:          case LINE_TEXT:
                 if (n->spc) {                  if (n->spc) {
                         if (n->node == NODE_TEXT) {                          if (n->node == NODE_TEXT)
                                 putchar('\n');                                  macro_close(f);
                                 last = '\n';                          else
                                 break;                                  putchar(' ');
                         }  
                         putchar(' ');  
                 }                  }
                 last = ' ';  
                 break;                  break;
         case LINE_MACRO:          case LINE_MACRO:
                 if (accept_arg) {                  if (accept_arg)
                         putchar(' ');                          putchar(' ');
                         last = ' ';                  else
                         break;                          macro_close(f);
                 }  
                 macro_close(f);  
                 /* FALLTHROUGH */  
         case LINE_NEW:  
                 f->linestate = LINE_TEXT;  
                 last = '\n';  
                 break;                  break;
         }          }
   
         if (n->node == NODE_ESCAPE) {          if (n->node == NODE_ESCAPE) {
                 fputs(n->b, stdout);                  fputs(n->b, stdout);
                   if (f->linestate == LINE_NEW)
                           f->linestate = LINE_TEXT;
                 return;                  return;
         }          }
   
Line 118  pnode_printtext(struct format *f, struct pnode *n)
Line 112  pnode_printtext(struct format *f, struct pnode *n)
         if (n->parent != NULL && n->parent->node == NODE_OPTION && *cp == '-')          if (n->parent != NULL && n->parent->node == NODE_OPTION && *cp == '-')
                 cp++;                  cp++;
   
         /*          if (f->linestate == LINE_MACRO)
          * Print the text, skipping whitespace on new lines,                  macro_addarg(f, cp, 0);
          * escaping control characters on new lines,          else
          * and escaping backslashes.                  print_text(f, cp, 0);
          */  
   
         for (; *cp != '\0'; cp++) {  
                 if (last == '\n') {  
                         if (isspace((unsigned char)*cp))  
                                 continue;  
                         if (*cp == '\'' || *cp == '.')  
                                 fputs("\\&", stdout);  
                 }  
                 putchar(last = *cp);  
                 if (last == '\\')  
                         putchar('e');  
         }  
 }  }
   
 static void  static void

Legend:
Removed from v.1.106  
changed lines
  Added in v.1.107

CVSweb