[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.136 and 1.141

version 1.136, 2010/06/01 14:51:09 version 1.141, 2010/06/06 10:50:56
Line 82  static void   termp_dq_post(DECL_ARGS);
Line 82  static void   termp_dq_post(DECL_ARGS);
 static  void      termp_fd_post(DECL_ARGS);  static  void      termp_fd_post(DECL_ARGS);
 static  void      termp_fn_post(DECL_ARGS);  static  void      termp_fn_post(DECL_ARGS);
 static  void      termp_fo_post(DECL_ARGS);  static  void      termp_fo_post(DECL_ARGS);
 static  void      termp_ft_post(DECL_ARGS);  
 static  void      termp_in_post(DECL_ARGS);  static  void      termp_in_post(DECL_ARGS);
 static  void      termp_it_post(DECL_ARGS);  static  void      termp_it_post(DECL_ARGS);
 static  void      termp_lb_post(DECL_ARGS);  static  void      termp_lb_post(DECL_ARGS);
Line 166  static const struct termact termacts[MDOC_MAX] = {
Line 165  static const struct termact termacts[MDOC_MAX] = {
         { termp_bold_pre, termp_fd_post }, /* Fd */          { termp_bold_pre, termp_fd_post }, /* Fd */
         { termp_fl_pre, NULL }, /* Fl */          { termp_fl_pre, NULL }, /* Fl */
         { termp_fn_pre, termp_fn_post }, /* Fn */          { termp_fn_pre, termp_fn_post }, /* Fn */
         { termp_ft_pre, termp_ft_post }, /* Ft */          { termp_ft_pre, NULL }, /* Ft */
         { termp_bold_pre, NULL }, /* Ic */          { termp_bold_pre, NULL }, /* Ic */
         { termp_in_pre, termp_in_post }, /* In */          { termp_in_pre, termp_in_post }, /* In */
         { termp_li_pre, NULL }, /* Li */          { termp_li_pre, NULL }, /* Li */
Line 1358  static void
Line 1357  static void
 termp_fd_post(DECL_ARGS)  termp_fd_post(DECL_ARGS)
 {  {
   
         if (n->sec != SEC_SYNOPSIS || ! (MDOC_LINE & n->flags))  
                 return;  
   
         term_newln(p);          term_newln(p);
         if (n->next && MDOC_Fd != n->next->tok)  
                 term_vspace(p);  
 }  }
   
   
Line 1516  static int
Line 1510  static int
 termp_ft_pre(DECL_ARGS)  termp_ft_pre(DECL_ARGS)
 {  {
   
         if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags)          /* NB: MDOC_LINE does not effect this! */
                 if (n->prev && MDOC_Fo == n->prev->tok)          if (SEC_SYNOPSIS == n->sec && n->prev)
                         term_vspace(p);                  term_vspace(p);
   
         term_fontpush(p, TERMFONT_UNDER);          term_fontpush(p, TERMFONT_UNDER);
         return(1);          return(1);
Line 1526  termp_ft_pre(DECL_ARGS)
Line 1520  termp_ft_pre(DECL_ARGS)
   
   
 /* ARGSUSED */  /* ARGSUSED */
 static void  
 termp_ft_post(DECL_ARGS)  
 {  
   
         if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags)  
                 term_newln(p);  
 }  
   
   
 /* ARGSUSED */  
 static int  static int
 termp_fn_pre(DECL_ARGS)  termp_fn_pre(DECL_ARGS)
 {  {
         const struct mdoc_node  *nn;          const struct mdoc_node  *nn;
   
           /* NB: MDOC_LINE has no effect on this macro! */
           if (SEC_SYNOPSIS == n->sec) {
                   if (n->prev && MDOC_Ft == n->prev->tok)
                           term_newln(p);
                   else if (n->prev)
                           term_vspace(p);
           }
   
         term_fontpush(p, TERMFONT_BOLD);          term_fontpush(p, TERMFONT_BOLD);
         term_word(p, n->child->string);          term_word(p, n->child->string);
         term_fontpop(p);          term_fontpop(p);
Line 1571  static void
Line 1563  static void
 termp_fn_post(DECL_ARGS)  termp_fn_post(DECL_ARGS)
 {  {
   
         if (n->sec == SEC_SYNOPSIS && n->next && MDOC_LINE & n->flags)          /* NB: MDOC_LINE has no effect on this macro! */
                 term_vspace(p);          if (SEC_SYNOPSIS == n->sec)
                   term_newln(p);
 }  }
   
   
Line 1852  static int
Line 1845  static int
 termp_in_pre(DECL_ARGS)  termp_in_pre(DECL_ARGS)
 {  {
   
         term_fontpush(p, TERMFONT_BOLD);          if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags) {
         if (SEC_SYNOPSIS == n->sec)                  term_fontpush(p, TERMFONT_BOLD);
                 term_word(p, "#include");                  term_word(p, "#include");
                   term_word(p, "<");
           } else {
                   term_word(p, "<");
                   term_fontpush(p, TERMFONT_UNDER);
           }
   
         term_word(p, "<");  
         p->flags |= TERMP_NOSPACE;          p->flags |= TERMP_NOSPACE;
         return(1);          return(1);
 }  }
Line 1867  static void
Line 1864  static void
 termp_in_post(DECL_ARGS)  termp_in_post(DECL_ARGS)
 {  {
   
         term_fontpush(p, TERMFONT_BOLD);          if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags)
                   term_fontpush(p, TERMFONT_BOLD);
   
         p->flags |= TERMP_NOSPACE;          p->flags |= TERMP_NOSPACE;
         term_word(p, ">");          term_word(p, ">");
         term_fontpop(p);  
   
         if (SEC_SYNOPSIS != n->sec || ! (MDOC_LINE & n->flags))          if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags) {
                 return;                  term_fontpop(p);
                   term_newln(p);
         term_newln(p);          }
         /*  
          * XXX Not entirely correct.  If `.In foo bar' is specified in  
          * the SYNOPSIS section, then it produces a single break after  
          * the <foo>; mandoc asserts a vertical space.  Since this  
          * construction is rarely used, I think it's fine.  
          */  
         if (n->next && MDOC_In != n->next->tok)  
                 term_vspace(p);  
 }  }
   
   
Line 1992  termp_pq_post(DECL_ARGS)
Line 1982  termp_pq_post(DECL_ARGS)
 static int  static int
 termp_fo_pre(DECL_ARGS)  termp_fo_pre(DECL_ARGS)
 {  {
         const struct mdoc_node *nn;  
   
         if (MDOC_BODY == n->type) {          if (MDOC_BLOCK == n->type) {
                   /* NB: MDOC_LINE has no effect on this macro! */
                   if (SEC_SYNOPSIS != n->sec)
                           return(1);
                   if (n->prev && MDOC_Ft == n->prev->tok)
                           term_newln(p);
                   else if (n->prev)
                           term_vspace(p);
                   return(1);
           } else if (MDOC_BODY == n->type) {
                 p->flags |= TERMP_NOSPACE;                  p->flags |= TERMP_NOSPACE;
                 term_word(p, "(");                  term_word(p, "(");
                 p->flags |= TERMP_NOSPACE;                  p->flags |= TERMP_NOSPACE;
                 return(1);                  return(1);
         } else if (MDOC_HEAD != n->type)          }
                 return(1);  
   
         term_fontpush(p, TERMFONT_BOLD);          /* XXX: we drop non-initial arguments as per groff. */
         for (nn = n->child; nn; nn = nn->next) {  
                 assert(MDOC_TEXT == nn->type);  
                 term_word(p, nn->string);  
         }  
         term_fontpop(p);  
   
           assert(n->child);
           assert(n->child->string);
           term_fontpush(p, TERMFONT_BOLD);
           term_word(p, n->child->string);
         return(0);          return(0);
 }  }
   
Line 2018  static void
Line 2014  static void
 termp_fo_post(DECL_ARGS)  termp_fo_post(DECL_ARGS)
 {  {
   
         if (MDOC_BODY != n->type)          if (MDOC_BLOCK == n->type) {
                 return;                  /* NB: MDOC_LINE has no effect on this macro! */
         p->flags |= TERMP_NOSPACE;                  if (SEC_SYNOPSIS == n->sec)
         term_word(p, ")");                          term_newln(p);
         p->flags |= TERMP_NOSPACE;          } else if (MDOC_BODY == n->type) {
         term_word(p, ";");                  p->flags |= TERMP_NOSPACE;
         term_newln(p);                  term_word(p, ")");
                   if (SEC_SYNOPSIS == n->sec) {
                           p->flags |= TERMP_NOSPACE;
                           term_word(p, ";");
                   }
           }
 }  }
   
   

Legend:
Removed from v.1.136  
changed lines
  Added in v.1.141

CVSweb