[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.330 and 1.331

version 1.330, 2015/10/12 15:29:35 version 1.331, 2016/01/08 17:48:09
Line 1 
Line 1 
 /*      $Id$ */  /*      $Id$ */
 /*  /*
  * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>   * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org>   * Copyright (c) 2010, 2012-2016 Ingo Schwarze <schwarze@openbsd.org>
  * Copyright (c) 2013 Franco Fichtner <franco@lastsummer.de>   * Copyright (c) 2013 Franco Fichtner <franco@lastsummer.de>
  *   *
  * Permission to use, copy, modify, and distribute this software for any   * Permission to use, copy, modify, and distribute this software for any
Line 357  print_mdoc_node(DECL_ARGS)
Line 357  print_mdoc_node(DECL_ARGS)
                 break;                  break;
         default:          default:
                 if (termacts[n->tok].pre &&                  if (termacts[n->tok].pre &&
                     (n->end == ENDBODY_NOT || n->nchild))                      (n->end == ENDBODY_NOT || n->child != NULL))
                         chld = (*termacts[n->tok].pre)                          chld = (*termacts[n->tok].pre)
                                 (p, &npair, meta, n);                                  (p, &npair, meta, n);
                 break;                  break;
Line 598  static int
Line 598  static int
 termp_ll_pre(DECL_ARGS)  termp_ll_pre(DECL_ARGS)
 {  {
   
         term_setwidth(p, n->nchild ? n->child->string : NULL);          term_setwidth(p, n->child != NULL ? n->child->string : NULL);
         return 0;          return 0;
 }  }
   
Line 731  termp_it_pre(DECL_ARGS)
Line 731  termp_it_pre(DECL_ARGS)
                         term_word(p, "\\ \\ ");                          term_word(p, "\\ \\ ");
                 break;                  break;
         case LIST_inset:          case LIST_inset:
                 if (n->type == ROFFT_BODY && n->parent->head->nchild)                  if (n->type == ROFFT_BODY && n->parent->head->child != NULL)
                         term_word(p, "\\ ");                          term_word(p, "\\ ");
                 break;                  break;
         default:          default:
Line 1039  termp_fl_pre(DECL_ARGS)
Line 1039  termp_fl_pre(DECL_ARGS)
         term_fontpush(p, TERMFONT_BOLD);          term_fontpush(p, TERMFONT_BOLD);
         term_word(p, "\\-");          term_word(p, "\\-");
   
         if ( ! (n->nchild == 0 &&          if (!(n->child == NULL &&
             (n->next == NULL ||              (n->next == NULL ||
              n->next->type == ROFFT_TEXT ||               n->next->type == ROFFT_TEXT ||
              n->next->flags & MDOC_LINE)))               n->next->flags & MDOC_LINE)))
Line 1106  termp_rs_pre(DECL_ARGS)
Line 1106  termp_rs_pre(DECL_ARGS)
 static int  static int
 termp_rv_pre(DECL_ARGS)  termp_rv_pre(DECL_ARGS)
 {  {
         int              nchild;          struct roff_node *nch;
   
         term_newln(p);          term_newln(p);
   
         nchild = n->nchild;          if (n->child != NULL) {
         if (nchild > 0) {  
                 term_word(p, "The");                  term_word(p, "The");
   
                 for (n = n->child; n; n = n->next) {                  for (nch = n->child; nch != NULL; nch = nch->next) {
                         term_fontpush(p, TERMFONT_BOLD);                          term_fontpush(p, TERMFONT_BOLD);
                         term_word(p, n->string);                          term_word(p, nch->string);
                         term_fontpop(p);                          term_fontpop(p);
   
                         p->flags |= TERMP_NOSPACE;                          p->flags |= TERMP_NOSPACE;
                         term_word(p, "()");                          term_word(p, "()");
   
                         if (n->next == NULL)                          if (nch->next == NULL)
                                 continue;                                  continue;
   
                         if (nchild > 2) {                          if (nch->prev != NULL || nch->next->next != NULL) {
                                 p->flags |= TERMP_NOSPACE;                                  p->flags |= TERMP_NOSPACE;
                                 term_word(p, ",");                                  term_word(p, ",");
                         }                          }
                         if (n->next->next == NULL)                          if (nch->next->next == NULL)
                                 term_word(p, "and");                                  term_word(p, "and");
                 }                  }
   
                 if (nchild > 1)                  if (n->child != NULL && n->child->next != NULL)
                         term_word(p, "functions return");                          term_word(p, "functions return");
                 else                  else
                         term_word(p, "function returns");                          term_word(p, "function returns");
Line 1159  termp_rv_pre(DECL_ARGS)
Line 1158  termp_rv_pre(DECL_ARGS)
 static int  static int
 termp_ex_pre(DECL_ARGS)  termp_ex_pre(DECL_ARGS)
 {  {
         int              nchild;          struct roff_node *nch;
   
         term_newln(p);          term_newln(p);
         term_word(p, "The");          term_word(p, "The");
   
         nchild = n->nchild;          for (nch = n->child; nch != NULL; nch = nch->next) {
         for (n = n->child; n; n = n->next) {  
                 term_fontpush(p, TERMFONT_BOLD);                  term_fontpush(p, TERMFONT_BOLD);
                 term_word(p, n->string);                  term_word(p, nch->string);
                 term_fontpop(p);                  term_fontpop(p);
   
                 if (nchild > 2 && n->next) {                  if (nch->next == NULL)
                           continue;
   
                   if (nch->prev != NULL || nch->next->next != NULL) {
                         p->flags |= TERMP_NOSPACE;                          p->flags |= TERMP_NOSPACE;
                         term_word(p, ",");                          term_word(p, ",");
                 }                  }
   
                 if (n->next && NULL == n->next->next)                  if (nch->next->next == NULL)
                         term_word(p, "and");                          term_word(p, "and");
         }          }
   
         if (nchild > 1)          if (n->child != NULL && n->child->next != NULL)
                 term_word(p, "utilities exit\\~0");                  term_word(p, "utilities exit\\~0");
         else          else
                 term_word(p, "utility exits\\~0");                  term_word(p, "utility exits\\~0");
Line 1838  termp_quote_pre(DECL_ARGS)
Line 1839  termp_quote_pre(DECL_ARGS)
         switch (n->tok) {          switch (n->tok) {
         case MDOC_Ao:          case MDOC_Ao:
         case MDOC_Aq:          case MDOC_Aq:
                 term_word(p, n->nchild == 1 &&                  term_word(p, n->child != NULL && n->child->next == NULL &&
                     n->child->tok == MDOC_Mt ? "<" : "\\(la");                      n->child->tok == MDOC_Mt ? "<" : "\\(la");
                 break;                  break;
         case MDOC_Bro:          case MDOC_Bro:
Line 1895  termp_quote_post(DECL_ARGS)
Line 1896  termp_quote_post(DECL_ARGS)
         switch (n->tok) {          switch (n->tok) {
         case MDOC_Ao:          case MDOC_Ao:
         case MDOC_Aq:          case MDOC_Aq:
                 term_word(p, n->nchild == 1 &&                  term_word(p, n->child != NULL && n->child->next == NULL &&
                     n->child->tok == MDOC_Mt ? ">" : "\\(ra");                      n->child->tok == MDOC_Mt ? ">" : "\\(ra");
                 break;                  break;
         case MDOC_Bro:          case MDOC_Bro:
Line 2159  termp_bk_pre(DECL_ARGS)
Line 2160  termp_bk_pre(DECL_ARGS)
         case ROFFT_HEAD:          case ROFFT_HEAD:
                 return 0;                  return 0;
         case ROFFT_BODY:          case ROFFT_BODY:
                 if (n->parent->args || 0 == n->prev->nchild)                  if (n->parent->args != NULL || n->prev->child == NULL)
                         p->flags |= TERMP_PREKEEP;                          p->flags |= TERMP_PREKEEP;
                 break;                  break;
         default:          default:

Legend:
Removed from v.1.330  
changed lines
  Added in v.1.331

CVSweb