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

Diff for /mandoc/mdoc_markdown.c between version 1.22 and 1.25

version 1.22, 2017/05/30 16:31:29 version 1.25, 2018/08/16 13:54:06
Line 1 
Line 1 
 /*      $Id$ */  /*      $Id$ */
 /*  /*
  * Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>   * Copyright (c) 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
  *   *
  * Permission to use, copy, modify, and distribute this software for any   * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above   * purpose with or without fee is hereby granted, provided that the above
Line 294  md_node(struct roff_node *n)
Line 294  md_node(struct roff_node *n)
         const struct md_act     *act;          const struct md_act     *act;
         int                      cond, process_children;          int                      cond, process_children;
   
         if (n->flags & NODE_NOPRT)          if (n->type == ROFFT_COMMENT || n->flags & NODE_NOPRT)
                 return;                  return;
   
         if (outflags & MD_nonl)          if (outflags & MD_nonl)
Line 493  md_word(const char *s)
Line 493  md_word(const char *s)
 {  {
         const char      *seq, *prevfont, *currfont, *nextfont;          const char      *seq, *prevfont, *currfont, *nextfont;
         char             c;          char             c;
         int              bs, sz, uc;          int              bs, sz, uc, breakline;
   
         /* No spacing before closing delimiters. */          /* No spacing before closing delimiters. */
         if (s[0] != '\0' && s[1] == '\0' &&          if (s[0] != '\0' && s[1] == '\0' &&
Line 510  md_word(const char *s)
Line 510  md_word(const char *s)
         if ((s[0] == '(' || s[0] == '[') && s[1] == '\0')          if ((s[0] == '(' || s[0] == '[') && s[1] == '\0')
                 outflags &= ~MD_spc;                  outflags &= ~MD_spc;
   
           breakline = 0;
         prevfont = currfont = "";          prevfont = currfont = "";
         while ((c = *s++) != '\0') {          while ((c = *s++) != '\0') {
                 bs = 0;                  bs = 0;
Line 579  md_word(const char *s)
Line 580  md_word(const char *s)
                         case ESCAPE_SPECIAL:                          case ESCAPE_SPECIAL:
                                 uc = mchars_spec2cp(seq, sz);                                  uc = mchars_spec2cp(seq, sz);
                                 break;                                  break;
                           case ESCAPE_DEVICE:
                                   md_rawword("markdown");
                                   continue;
                         case ESCAPE_FONTBOLD:                          case ESCAPE_FONTBOLD:
                                 nextfont = "**";                                  nextfont = "**";
                                 break;                                  break;
Line 595  md_word(const char *s)
Line 599  md_word(const char *s)
                         case ESCAPE_FONTPREV:                          case ESCAPE_FONTPREV:
                                 nextfont = prevfont;                                  nextfont = prevfont;
                                 break;                                  break;
                           case ESCAPE_BREAK:
                                   breakline = 1;
                                   break;
                         case ESCAPE_NOSPACE:                          case ESCAPE_NOSPACE:
                         case ESCAPE_SKIPCHAR:                          case ESCAPE_SKIPCHAR:
                         case ESCAPE_OVERSTRIKE:                          case ESCAPE_OVERSTRIKE:
Line 642  md_word(const char *s)
Line 649  md_word(const char *s)
                 if (bs)                  if (bs)
                         putchar('\\');                          putchar('\\');
                 md_char(c);                  md_char(c);
                   if (breakline &&
                       (*s == '\0' || *s == ' ' || *s == ASCII_NBRSP)) {
                           printf("  \n");
                           breakline = 0;
                           while (*s == ' ' || *s == ASCII_NBRSP)
                                   s++;
                   }
         }          }
         if (*currfont != '\0') {          if (*currfont != '\0') {
                 outflags &= ~MD_spc;                  outflags &= ~MD_spc;

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.25

CVSweb