[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.84 and 1.85

version 1.84, 2009/09/24 23:54:43 version 1.85, 2009/09/26 17:35:49
Line 639  fmt_block_vspace(struct termp *p, 
Line 639  fmt_block_vspace(struct termp *p, 
         const struct mdoc_node *n;          const struct mdoc_node *n;
   
         term_newln(p);          term_newln(p);
           if (arg_hasattr(MDOC_Compact, bl))
         if (MDOC_Bl == bl->tok && arg_hasattr(MDOC_Compact, bl))  
                 return;                  return;
         assert(node);  
   
         /*          /* Do not vspace directly after Ss/Sh. */
          * Search through our prior nodes.  If we follow a `Ss' or `Sh',  
          * then don't vspace.  
          */  
   
         for (n = node; n; n = n->parent) {          for (n = node; n; n = n->parent) {
                 if (MDOC_BLOCK != n->type)                  if (MDOC_BLOCK != n->type)
Line 661  fmt_block_vspace(struct termp *p, 
Line 656  fmt_block_vspace(struct termp *p, 
                 break;                  break;
         }          }
   
         /*          /* A `-column' does not assert vspace within the list. */
          * XXX - not documented: a `-column' does not ever assert vspace  
          * within the list.  
          */  
   
         if (MDOC_Bl == bl->tok && arg_hasattr(MDOC_Column, bl))          if (MDOC_Bl == bl->tok && arg_hasattr(MDOC_Column, bl))
                 if (node->prev && MDOC_It == node->prev->tok)                  if (node->prev && MDOC_It == node->prev->tok)
                         return;                          return;
   
         /*          /* A `-diag' without body does not vspace. */
          * XXX - not documented: a `-diag' without a body does not  
          * assert a vspace prior to the next element.  
          */  
         if (MDOC_Bl == bl->tok && arg_hasattr(MDOC_Diag, bl))          if (MDOC_Bl == bl->tok && arg_hasattr(MDOC_Diag, bl))
                 if (node->prev && MDOC_It == node->prev->tok) {                  if (node->prev && MDOC_It == node->prev->tok) {
                         assert(node->prev->body);                          assert(node->prev->body);
Line 1100  termp_an_pre(DECL_ARGS)
Line 1090  termp_an_pre(DECL_ARGS)
                 return(1);                  return(1);
   
         /*          /*
          * XXX: this is poorly documented.  If not in the AUTHORS           * If not in the AUTHORS section, `An -split' will cause
          * section, `An -split' will cause newlines to occur before the           * newlines to occur before the author name.  If in the AUTHORS
          * author name.  If in the AUTHORS section, by default, the           * section, by default, the first `An' invocation is nosplit,
          * first `An' invocation is nosplit, then all subsequent ones,           * then all subsequent ones, regardless of whether interspersed
          * regardless of whether interspersed with other macros/text,           * with other macros/text, are split.  -split, in this case,
          * are split.  -split, in this case, will override the condition           * will override the condition of the implied first -nosplit.
          * of the implied first -nosplit.  
          */           */
   
         if (node->sec == SEC_AUTHORS) {          if (node->sec == SEC_AUTHORS) {
Line 1352  termp_fd_post(DECL_ARGS)
Line 1341  termp_fd_post(DECL_ARGS)
 static int  static int
 termp_sh_pre(DECL_ARGS)  termp_sh_pre(DECL_ARGS)
 {  {
         /*  
          * XXX: undocumented: using two `Sh' macros in sequence has no          /* No vspace between consecutive `Sh' calls. */
          * vspace between calls, only a newline.  
          */  
         switch (node->type) {          switch (node->type) {
         case (MDOC_BLOCK):          case (MDOC_BLOCK):
                 if (node->prev && MDOC_Sh == node->prev->tok)                  if (node->prev && MDOC_Sh == node->prev->tok)
Line 1584  termp_fa_pre(DECL_ARGS)
Line 1572  termp_fa_pre(DECL_ARGS)
 static int  static int
 termp_bd_pre(DECL_ARGS)  termp_bd_pre(DECL_ARGS)
 {  {
         int              i, type;          int                      i, type;
           const struct mdoc_node  *nn;
   
         /*  
          * This is fairly tricky due primarily to crappy documentation.  
          * If -ragged or -filled are specified, the block does nothing  
          * but change the indentation.  
          *  
          * If, on the other hand, -unfilled or -literal are specified,  
          * then the game changes.  Text is printed exactly as entered in  
          * the display: if a macro line, a newline is appended to the  
          * line.  Blank lines are allowed.  
          */  
   
         if (MDOC_BLOCK == node->type) {          if (MDOC_BLOCK == node->type) {
                 fmt_block_vspace(p, node, node);                  fmt_block_vspace(p, node, node);
                 return(1);                  return(1);
         } else if (MDOC_BODY != node->type)          } else if (MDOC_BODY != node->type)
                 return(1);                  return(1);
   
         assert(node->parent->args);          nn = node->parent;
   
         for (type = -1, i = 0; -1 == type &&          for (type = -1, i = 0; i < (int)nn->args->argc; i++) {
                         i < (int)node->parent->args->argc; i++) {                  switch (nn->args->argv[i].arg) {
                 switch (node->parent->args->argv[i].arg) {  
                 case (MDOC_Ragged):                  case (MDOC_Ragged):
                         /* FALLTHROUGH */                          /* FALLTHROUGH */
                 case (MDOC_Filled):                  case (MDOC_Filled):
Line 1615  termp_bd_pre(DECL_ARGS)
Line 1592  termp_bd_pre(DECL_ARGS)
                 case (MDOC_Unfilled):                  case (MDOC_Unfilled):
                         /* FALLTHROUGH */                          /* FALLTHROUGH */
                 case (MDOC_Literal):                  case (MDOC_Literal):
                         type = node->parent->args->argv[i].arg;                          type = nn->args->argv[i].arg;
                         break;                          break;
                   case (MDOC_Offset):
                           p->offset += arg_offset(&nn->args->argv[i]);
                           break;
                 default:                  default:
                         break;                          break;
                 }                  }
         }          }
   
           /*
            * If -ragged or -filled are specified, the block does nothing
            * but change the indentation.  If -unfilled or -literal are
            * specified, text is printed exactly as entered in the display:
            * for macro lines, a newline is appended to the line.  Blank
            * lines are allowed.
            */
   
         assert(type > -1);          assert(type > -1);
           if (MDOC_Literal != type && MDOC_Unfilled != type)
         i = arg_getattr(MDOC_Offset, node->parent);  
         if (-1 != i)  
                 p->offset += arg_offset(&node->parent->args->argv[i]);  
   
         switch (type) {  
         case (MDOC_Literal):  
                 /* FALLTHROUGH */  
         case (MDOC_Unfilled):  
                 break;  
         default:  
                 return(1);                  return(1);
         }  
   
         for (node = node->child; node; node = node->next) {          for (nn = node->child; nn; nn = nn->next) {
                 p->flags |= TERMP_NOSPACE;                  print_node(p, pair, meta, nn);
                 print_node(p, pair, meta, node);                  if (NULL == nn->next)
                 if (node->next)                          continue;
                   if (nn->prev && nn->prev->line < nn->line)
                         term_flushln(p);                          term_flushln(p);
         }          }
   

Legend:
Removed from v.1.84  
changed lines
  Added in v.1.85

CVSweb