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

Diff for /mandoc/tbl_term.c between version 1.21 and 1.22

version 1.21, 2011/09/20 23:05:49 version 1.22, 2012/05/27 17:54:54
Line 126  term_tbl(struct termp *tp, const struct tbl_span *sp)
Line 126  term_tbl(struct termp *tp, const struct tbl_span *sp)
                 dp = sp->first;                  dp = sp->first;
                 spans = 0;                  spans = 0;
                 for (hp = sp->head; hp; hp = hp->next) {                  for (hp = sp->head; hp; hp = hp->next) {
   
                         /*                          /*
                          * If the current data header is invoked during                           * If the current data header is invoked during
                          * a spanner ("spans" > 0), don't emit anything                           * a spanner ("spans" > 0), don't emit anything
                          * at all.                           * at all.
                          */                           */
                         switch (hp->pos) {  
                         case (TBL_HEAD_VERT):  
                                 /* FALLTHROUGH */  
                         case (TBL_HEAD_DVERT):  
                                 if (spans <= 0)  
                                         tbl_vrule(tp, hp);  
                                 continue;  
                         case (TBL_HEAD_DATA):  
                                 break;  
                         }  
   
                         if (--spans >= 0)                          if (--spans >= 0)
                                 continue;                                  continue;
   
                         /*                          /* Separate columns. */
                          * All cells get a leading blank, except the  
                          * first one and those after double rulers.  
                          */  
   
                         if (hp->prev && TBL_HEAD_DVERT != hp->prev->pos)                          if (NULL != hp->prev)
                                 tbl_char(tp, ASCII_NBRSP, 1);                                  tbl_vrule(tp, hp);
   
                         col = &tp->tbl.cols[hp->ident];                          col = &tp->tbl.cols[hp->ident];
                         tbl_data(tp, sp->tbl, dp, col);                          tbl_data(tp, sp->tbl, dp, col);
   
                         /* No trailing blanks. */  
   
                         if (NULL == hp->next)  
                                 break;  
   
                         /*  
                          * Add another blank between cells,  
                          * or two when there is no vertical ruler.  
                          */  
   
                         tbl_char(tp, ASCII_NBRSP,  
                             TBL_HEAD_VERT  == hp->next->pos ||  
                             TBL_HEAD_DVERT == hp->next->pos ? 1 : 2);  
   
                         /*                          /*
                          * Go to the next data cell and assign the                           * Go to the next data cell and assign the
                          * number of subsequent spans, if applicable.                           * number of subsequent spans, if applicable.
Line 222  tbl_rulewidth(struct termp *tp, const struct tbl_head 
Line 196  tbl_rulewidth(struct termp *tp, const struct tbl_head 
         size_t           width;          size_t           width;
   
         width = tp->tbl.cols[hp->ident].width;          width = tp->tbl.cols[hp->ident].width;
         if (TBL_HEAD_DATA == hp->pos) {  
                 /* Account for leading blanks. */          /* Account for leading blanks. */
                 if (hp->prev && TBL_HEAD_DVERT != hp->prev->pos)          if (hp->prev)
                         width++;                  width += 2 - hp->vert;
                 /* Account for trailing blanks. */  
                 width++;          /* Account for trailing blank. */
                 if (hp->next &&          width++;
                     TBL_HEAD_VERT  != hp->next->pos &&  
                     TBL_HEAD_DVERT != hp->next->pos)  
                         width++;  
         }  
         return(width);          return(width);
 }  }
   
Line 250  tbl_hrule(struct termp *tp, const struct tbl_span *sp)
Line 221  tbl_hrule(struct termp *tp, const struct tbl_span *sp)
         if (TBL_SPAN_DHORIZ == sp->pos)          if (TBL_SPAN_DHORIZ == sp->pos)
                 c = '=';                  c = '=';
   
         for (hp = sp->head; hp; hp = hp->next)          for (hp = sp->head; hp; hp = hp->next) {
                 tbl_char(tp,                  if (hp->prev && hp->vert)
                     TBL_HEAD_DATA == hp->pos ? c : '+',                          tbl_char(tp, '+', hp->vert);
                     tbl_rulewidth(tp, hp));                  tbl_char(tp, c, tbl_rulewidth(tp, hp));
           }
 }  }
   
 /*  /*
Line 268  tbl_hframe(struct termp *tp, const struct tbl_span *sp
Line 240  tbl_hframe(struct termp *tp, const struct tbl_span *sp
         const struct tbl_head *hp;          const struct tbl_head *hp;
   
         term_word(tp, "+");          term_word(tp, "+");
         for (hp = sp->head; hp; hp = hp->next)          for (hp = sp->head; hp; hp = hp->next) {
                 tbl_char(tp,                  if (hp->prev && hp->vert)
                     outer || TBL_HEAD_DATA == hp->pos ? '-' : '+',                          tbl_char(tp, (outer ? '-' : '+'), hp->vert);
                     tbl_rulewidth(tp, hp));                  tbl_char(tp, '-', tbl_rulewidth(tp, hp));
           }
         term_word(tp, "+");          term_word(tp, "+");
         term_flushln(tp);          term_flushln(tp);
 }  }
Line 338  static void
Line 311  static void
 tbl_vrule(struct termp *tp, const struct tbl_head *hp)  tbl_vrule(struct termp *tp, const struct tbl_head *hp)
 {  {
   
         switch (hp->pos) {          tbl_char(tp, ASCII_NBRSP, 1);
         case (TBL_HEAD_VERT):          if (0 < hp->vert)
                 term_word(tp, "|");                  tbl_char(tp, '|', hp->vert);
                 break;          if (2 > hp->vert)
         case (TBL_HEAD_DVERT):                  tbl_char(tp, ASCII_NBRSP, 2 - hp->vert);
                 term_word(tp, "||");  
                 break;  
         default:  
                 break;  
         }  
 }  }
   
 static void  static void

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.22

CVSweb