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

Diff for /mandoc/mdoc_man.c between version 1.95 and 1.96

version 1.95, 2015/10/12 00:08:15 version 1.96, 2016/01/08 17:48:09
Line 1 
Line 1 
 /*      $Id$ */  /*      $Id$ */
 /*  /*
  * Copyright (c) 2011-2015 Ingo Schwarze <schwarze@openbsd.org>   * Copyright (c) 2011-2016 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 610  print_node(DECL_ARGS)
Line 610  print_node(DECL_ARGS)
                  */                   */
                 act = manacts + n->tok;                  act = manacts + n->tok;
                 cond = act->cond == NULL || (*act->cond)(meta, n);                  cond = act->cond == NULL || (*act->cond)(meta, n);
                 if (cond && act->pre && (n->end == ENDBODY_NOT || n->nchild))                  if (cond && act->pre != NULL &&
                       (n->end == ENDBODY_NOT || n->child != NULL))
                         do_sub = (*act->pre)(meta, n);                          do_sub = (*act->pre)(meta, n);
         }          }
   
Line 681  post_enc(DECL_ARGS)
Line 682  post_enc(DECL_ARGS)
 static int  static int
 pre_ex(DECL_ARGS)  pre_ex(DECL_ARGS)
 {  {
         int      nchild;          struct roff_node *nch;
   
         outflags |= MMAN_br | MMAN_nl;          outflags |= MMAN_br | MMAN_nl;
   
         print_word("The");          print_word("The");
   
         nchild = n->nchild;          for (nch = n->child; nch != NULL; nch = nch->next) {
         for (n = n->child; n; n = n->next) {  
                 font_push('B');                  font_push('B');
                 print_word(n->string);                  print_word(nch->string);
                 font_pop();                  font_pop();
   
                 if (n->next == NULL)                  if (nch->next == NULL)
                         continue;                          continue;
   
                 if (nchild > 2) {                  if (nch->prev != NULL || nch->next->next != NULL) {
                         outflags &= ~MMAN_spc;                          outflags &= ~MMAN_spc;
                         print_word(",");                          print_word(",");
                 }                  }
                 if (n->next->next == NULL)                  if (nch->next->next == NULL)
                         print_word("and");                          print_word("and");
         }          }
   
         if (nchild > 1)          if (n->child != NULL && n->child->next != NULL)
                 print_word("utilities exit\\~0");                  print_word("utilities exit\\~0");
         else          else
                 print_word("utility exits\\~0");                  print_word("utility exits\\~0");
Line 873  static int
Line 873  static int
 pre_aq(DECL_ARGS)  pre_aq(DECL_ARGS)
 {  {
   
         print_word(n->nchild == 1 &&          print_word(n->child != NULL && n->child->next == NULL &&
             n->child->tok == MDOC_Mt ?  "<" : "\\(la");              n->child->tok == MDOC_Mt ?  "<" : "\\(la");
         outflags &= ~MMAN_spc;          outflags &= ~MMAN_spc;
         return 1;          return 1;
Line 884  post_aq(DECL_ARGS)
Line 884  post_aq(DECL_ARGS)
 {  {
   
         outflags &= ~(MMAN_spc | MMAN_nl);          outflags &= ~(MMAN_spc | MMAN_nl);
         print_word(n->nchild == 1 &&          print_word(n->child != NULL && n->child->next == NULL &&
             n->child->tok == MDOC_Mt ?  ">" : "\\(ra");              n->child->tok == MDOC_Mt ?  ">" : "\\(ra");
 }  }
   
Line 1000  pre_bl(DECL_ARGS)
Line 1000  pre_bl(DECL_ARGS)
                 return 1;                  return 1;
         }          }
   
         if (n->nchild) {          if (n->child != NULL) {
                 print_line(".TS", MMAN_nl);                  print_line(".TS", MMAN_nl);
                 for (icol = 0; icol < n->norm->Bl.ncols; icol++)                  for (icol = 0; icol < n->norm->Bl.ncols; icol++)
                         print_word("l");                          print_word("l");
Line 1016  post_bl(DECL_ARGS)
Line 1016  post_bl(DECL_ARGS)
   
         switch (n->norm->Bl.type) {          switch (n->norm->Bl.type) {
         case LIST_column:          case LIST_column:
                 if (n->nchild)                  if (n->child != NULL)
                         print_line(".TE", 0);                          print_line(".TE", 0);
                 break;                  break;
         case LIST_enum:          case LIST_enum:
Line 1214  pre_fl(DECL_ARGS)
Line 1214  pre_fl(DECL_ARGS)
   
         font_push('B');          font_push('B');
         print_word("\\-");          print_word("\\-");
         if (n->nchild)          if (n->child != NULL)
                 outflags &= ~MMAN_spc;                  outflags &= ~MMAN_spc;
         return 1;          return 1;
 }  }
Line 1224  post_fl(DECL_ARGS)
Line 1224  post_fl(DECL_ARGS)
 {  {
   
         font_pop();          font_pop();
         if ( ! (n->nchild ||          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 1645  pre_rs(DECL_ARGS)
Line 1645  pre_rs(DECL_ARGS)
 static int  static int
 pre_rv(DECL_ARGS)  pre_rv(DECL_ARGS)
 {  {
         int      nchild;          struct roff_node *nch;
   
         outflags |= MMAN_br | MMAN_nl;          outflags |= MMAN_br | MMAN_nl;
   
         nchild = n->nchild;          if (n->child != NULL) {
         if (nchild > 0) {  
                 print_word("The");                  print_word("The");
   
                 for (n = n->child; n; n = n->next) {                  for (nch = n->child; nch != NULL; nch = nch->next) {
                         font_push('B');                          font_push('B');
                         print_word(n->string);                          print_word(nch->string);
                         font_pop();                          font_pop();
   
                         outflags &= ~MMAN_spc;                          outflags &= ~MMAN_spc;
                         print_word("()");                          print_word("()");
   
                         if (n->next == NULL)                          if (nch->next == NULL)
                                 continue;                                  continue;
   
                         if (nchild > 2) {                          if (nch->prev != NULL || nch->next->next != NULL) {
                                 outflags &= ~MMAN_spc;                                  outflags &= ~MMAN_spc;
                                 print_word(",");                                  print_word(",");
                         }                          }
                         if (n->next->next == NULL)                          if (nch->next->next == NULL)
                                 print_word("and");                                  print_word("and");
                 }                  }
   
                 if (nchild > 1)                  if (n->child != NULL && n->child->next != NULL)
                         print_word("functions return");                          print_word("functions return");
                 else                  else
                         print_word("function returns");                          print_word("function returns");

Legend:
Removed from v.1.95  
changed lines
  Added in v.1.96

CVSweb