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

Diff for /mandoc/mdoc_term.c between version 1.212 and 1.217

version 1.212, 2011/01/25 15:28:56 version 1.217, 2011/02/06 22:33:38
Line 1 
Line 1 
 /*      $Id$ */  /*      $Id$ */
 /*  /*
  * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>   * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>   * Copyright (c) 2010 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
Line 312  print_mdoc_node(DECL_ARGS)
Line 312  print_mdoc_node(DECL_ARGS)
   
         memset(&npair, 0, sizeof(struct termpair));          memset(&npair, 0, sizeof(struct termpair));
         npair.ppair = pair;          npair.ppair = pair;
   
         switch (n->type) {  
         case (MDOC_TEXT):  
                 if (' ' == *n->string && MDOC_LINE & n->flags)  
                         term_newln(p);  
                 term_word(p, n->string);  
                 break;  
         case (MDOC_TBL):  
                 term_tbl(p, n->span);  
                 break;  
         default:  
                 if (termacts[n->tok].pre && ENDBODY_NOT == n->end)  
                         chld = (*termacts[n->tok].pre)  
                                 (p, &npair, m, n);  
                 break;  
         }  
   
         /*          /*
          * Keeps only work until the end of a line.  If a keep was           * Keeps only work until the end of a line.  If a keep was
Line 359  print_mdoc_node(DECL_ARGS)
Line 343  print_mdoc_node(DECL_ARGS)
              (n->parent && MDOC_SYNPRETTY & n->parent->flags)))               (n->parent && MDOC_SYNPRETTY & n->parent->flags)))
                 p->flags &= ~(TERMP_KEEP | TERMP_PREKEEP);                  p->flags &= ~(TERMP_KEEP | TERMP_PREKEEP);
   
           /*
            * After the keep flags have been set up, we may now
            * produce output.  Note that some pre-handlers do so.
            */
   
           switch (n->type) {
           case (MDOC_TEXT):
                   if (' ' == *n->string && MDOC_LINE & n->flags)
                           term_newln(p);
                   term_word(p, n->string);
                   break;
           case (MDOC_EQN):
                   break;
           case (MDOC_TBL):
                   term_tbl(p, n->span);
                   break;
           default:
                   if (termacts[n->tok].pre && ENDBODY_NOT == n->end)
                           chld = (*termacts[n->tok].pre)
                                   (p, &npair, m, n);
                   break;
           }
   
         if (chld && n->child)          if (chld && n->child)
                 print_mdoc_nodelist(p, &npair, m, n->child);                  print_mdoc_nodelist(p, &npair, m, n->child);
   
Line 369  print_mdoc_node(DECL_ARGS)
Line 376  print_mdoc_node(DECL_ARGS)
                 break;                  break;
         case (MDOC_TBL):          case (MDOC_TBL):
                 break;                  break;
           case (MDOC_EQN):
                   break;
         default:          default:
                 if ( ! termacts[n->tok].post || MDOC_ENDED & n->flags)                  if ( ! termacts[n->tok].post || MDOC_ENDED & n->flags)
                         break;                          break;
Line 1151  static int
Line 1160  static int
 termp_ns_pre(DECL_ARGS)  termp_ns_pre(DECL_ARGS)
 {  {
   
         p->flags |= TERMP_NOSPACE;          if ( ! (MDOC_LINE & n->flags))
                   p->flags |= TERMP_NOSPACE;
         return(1);          return(1);
 }  }
   
Line 1677  termp_bd_post(DECL_ARGS)
Line 1687  termp_bd_post(DECL_ARGS)
 static int  static int
 termp_bx_pre(DECL_ARGS)  termp_bx_pre(DECL_ARGS)
 {  {
         char             buf[3];  
   
         if (NULL != (n = n->child)) {          if (NULL != (n = n->child)) {
                 term_word(p, n->string);                  term_word(p, n->string);
Line 1689  termp_bx_pre(DECL_ARGS)
Line 1698  termp_bx_pre(DECL_ARGS)
         }          }
   
         if (NULL != (n = n->next)) {          if (NULL != (n = n->next)) {
                 buf[0] = '-';  
                 buf[1] = toupper((unsigned char)*n->string);  
                 buf[2] = '\0';  
   
                 p->flags |= TERMP_NOSPACE;                  p->flags |= TERMP_NOSPACE;
                 term_word(p, buf);                  term_word(p, "-");
                 p->flags |= TERMP_NOSPACE;                  p->flags |= TERMP_NOSPACE;
                 term_word(p, n->string + 1);                  term_word(p, n->string);
         }          }
   
         return(0);          return(0);
Line 1733  termp_xx_pre(DECL_ARGS)
Line 1738  termp_xx_pre(DECL_ARGS)
                 break;                  break;
         }          }
   
         assert(pp);  
         term_word(p, pp);          term_word(p, pp);
         return(1);          if (n->child) {
                   p->flags |= TERMP_KEEP;
                   term_word(p, n->child->string);
                   p->flags &= ~TERMP_KEEP;
           }
           return(0);
 }  }
   
   
Line 2187  termp__t_post(DECL_ARGS)
Line 2196  termp__t_post(DECL_ARGS)
          * If we're in an `Rs' and there's a journal present, then quote           * If we're in an `Rs' and there's a journal present, then quote
          * us instead of underlining us (for disambiguation).           * us instead of underlining us (for disambiguation).
          */           */
         if (n->parent && MDOC_Rs == n->parent->tok &&          if (n->parent && MDOC_Rs == n->parent->tok &&
                         n->parent->norm->Rs.quote_T)                          n->parent->norm->Rs.quote_T)
                 termp_quote_post(p, pair, m, n);                  termp_quote_post(p, pair, m, n);
   

Legend:
Removed from v.1.212  
changed lines
  Added in v.1.217

CVSweb