[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.46 and 1.47

version 1.46, 2012/11/19 02:14:45 version 1.47, 2012/12/31 22:34:48
Line 43  static int   cond_body(DECL_ARGS);
Line 43  static int   cond_body(DECL_ARGS);
 static  int       cond_head(DECL_ARGS);  static  int       cond_head(DECL_ARGS);
 static  void      font_push(char);  static  void      font_push(char);
 static  void      font_pop(void);  static  void      font_pop(void);
   static  void      mid_it(void);
 static  void      post__t(DECL_ARGS);  static  void      post__t(DECL_ARGS);
 static  void      post_bd(DECL_ARGS);  static  void      post_bd(DECL_ARGS);
 static  void      post_bf(DECL_ARGS);  static  void      post_bf(DECL_ARGS);
Line 442  print_offs(const char *v)
Line 443  print_offs(const char *v)
         print_word(buf);          print_word(buf);
 }  }
   
   /*
    * Set up the indentation for a list item; used from pre_it().
    */
 void  void
 print_width(const char *v, const struct mdoc_node *child, size_t defsz)  print_width(const char *v, const struct mdoc_node *child, size_t defsz)
 {  {
Line 470  print_width(const char *v, const struct mdoc_node *chi
Line 474  print_width(const char *v, const struct mdoc_node *chi
         chsz = (NULL != child && MDOC_TEXT == child->type) ?          chsz = (NULL != child && MDOC_TEXT == child->type) ?
                         strlen(child->string) : 0;                          strlen(child->string) : 0;
   
         /*          /* Maybe we are inside an enclosing list? */
          * If we are inside an enclosing list,          mid_it();
          * preserve its indentation.  
          */  
         if (Bl_stack_len && Bl_stack[Bl_stack_len - 1]) {  
                 print_line(".RS", MMAN_Bk_susp);  
                 snprintf(buf, sizeof(buf), "%ldn",  
                                 Bl_stack[Bl_stack_len - 1]);  
                 print_word(buf);  
         }  
   
         /*          /*
          * Save our own indentation,           * Save our own indentation,
Line 838  pre_bd(DECL_ARGS)
Line 834  pre_bd(DECL_ARGS)
 static void  static void
 post_bd(DECL_ARGS)  post_bd(DECL_ARGS)
 {  {
         char             buf[24];  
   
         /* Close out this display. */          /* Close out this display. */
         print_line(".RE", MMAN_nl);          print_line(".RE", MMAN_nl);
Line 846  post_bd(DECL_ARGS)
Line 841  post_bd(DECL_ARGS)
             DISP_literal  == n->norm->Bd.type)              DISP_literal  == n->norm->Bd.type)
                 print_line(".fi", MMAN_nl);                  print_line(".fi", MMAN_nl);
   
         /*          /* Maybe we are inside an enclosing list? */
          * If we are inside an enclosing list and the current          if (NULL != n->parent->next)
          * list item is not yet finished, restore the correct                  mid_it();
          * indentation for what remains of that item.  
          */  
         if (NULL != n->parent->next &&  
             Bl_stack_len && Bl_stack[Bl_stack_len - 1]) {  
                 print_line(".RS", MMAN_Bk_susp);  
                 snprintf(buf, sizeof(buf), "%ldn",  
                                 Bl_stack[Bl_stack_len - 1]);  
                 print_word(buf);  
                 /* Remeber to close out this .RS block later. */  
                 Bl_stack_post[Bl_stack_len - 1] = 1;  
         }  
 }  }
   
 static int  static int
Line 958  post_bl(DECL_ARGS)
Line 942  post_bl(DECL_ARGS)
         }          }
         outflags |= MMAN_PP | MMAN_nl;          outflags |= MMAN_PP | MMAN_nl;
         outflags &= ~(MMAN_sp | MMAN_br);          outflags &= ~(MMAN_sp | MMAN_br);
   
           /* Maybe we are inside an enclosing list? */
           if (NULL != n->parent->next)
                   mid_it();
   
 }  }
   
 static int  static int
Line 992  static int
Line 981  static int
 pre_dl(DECL_ARGS)  pre_dl(DECL_ARGS)
 {  {
   
         print_line(".RS 6n", MMAN_nl);          print_line(".RS", MMAN_Bk_susp);
           print_offs("6n");
           outflags |= MMAN_nl;
         return(1);          return(1);
 }  }
   
Line 1001  post_dl(DECL_ARGS)
Line 992  post_dl(DECL_ARGS)
 {  {
   
         print_line(".RE", MMAN_nl);          print_line(".RE", MMAN_nl);
   
           /* Maybe we are inside an enclosing list? */
           if (NULL != n->parent->next)
                   mid_it();
 }  }
   
 static int  static int
Line 1263  pre_it(DECL_ARGS)
Line 1258  pre_it(DECL_ARGS)
         return(1);          return(1);
 }  }
   
   /*
    * This function is called after closing out an indented block.
    * If we are inside an enclosing list, restore its indentation.
    */
 static void  static void
   mid_it(void)
   {
           char             buf[24];
   
           /* Nothing to do outside a list. */
           if (0 == Bl_stack_len || 0 == Bl_stack[Bl_stack_len - 1])
                   return;
   
           /* The indentation has already been set up. */
           if (Bl_stack_post[Bl_stack_len - 1])
                   return;
   
           /* Restore the indentation of the enclosing list. */
           print_line(".RS", MMAN_Bk_susp);
           snprintf(buf, sizeof(buf), "%ldn", Bl_stack[Bl_stack_len - 1]);
           print_word(buf);
   
           /* Remeber to close out this .RS block later. */
           Bl_stack_post[Bl_stack_len - 1] = 1;
   }
   
   static void
 post_it(DECL_ARGS)  post_it(DECL_ARGS)
 {  {
         const struct mdoc_node *bln;          const struct mdoc_node *bln;
Line 1302  post_it(DECL_ARGS)
Line 1323  post_it(DECL_ARGS)
   
                         /*                          /*
                          * Our indentation had to be restored                           * Our indentation had to be restored
                          * after a child display.                           * after a child display or child list.
                          * Close out that indentation block now.                           * Close out that indentation block now.
                          */                           */
                         if (Bl_stack_post[Bl_stack_len]) {                          if (Bl_stack_post[Bl_stack_len]) {
                                 print_line(".RE", MMAN_nl);                                  print_line(".RE", MMAN_nl);
                                 Bl_stack_post[Bl_stack_len] = 0;                                  Bl_stack_post[Bl_stack_len] = 0;
                         }                          }
   
                         /*  
                          * We are inside an enclosing list.  
                          * Restore the indentation of that list.  
                          */  
                         if (Bl_stack_len && Bl_stack[Bl_stack_len - 1])  
                                 print_line(".RE", MMAN_nl);  
                         break;                          break;
                 case (LIST_column):                  case (LIST_column):
                         if (NULL != n->next) {                          if (NULL != n->next) {

Legend:
Removed from v.1.46  
changed lines
  Added in v.1.47

CVSweb