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

Diff for /mandoc/mdoc_html.c between version 1.92 and 1.96

version 1.92, 2010/07/02 12:54:33 version 1.96, 2010/07/13 23:53:20
Line 1 
Line 1 
 /*      $Id$ */  /*      $Id$ */
 /*  /*
  * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv>   * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
  *   *
  * 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 30 
Line 30 
 #include "mandoc.h"  #include "mandoc.h"
 #include "out.h"  #include "out.h"
 #include "html.h"  #include "html.h"
 #include "regs.h"  
 #include "mdoc.h"  #include "mdoc.h"
 #include "main.h"  #include "main.h"
   
Line 73  static int    mdoc_aq_pre(MDOC_ARGS);
Line 72  static int    mdoc_aq_pre(MDOC_ARGS);
 static  int               mdoc_ar_pre(MDOC_ARGS);  static  int               mdoc_ar_pre(MDOC_ARGS);
 static  int               mdoc_bd_pre(MDOC_ARGS);  static  int               mdoc_bd_pre(MDOC_ARGS);
 static  int               mdoc_bf_pre(MDOC_ARGS);  static  int               mdoc_bf_pre(MDOC_ARGS);
   static  void              mdoc_bk_post(MDOC_ARGS);
   static  int               mdoc_bk_pre(MDOC_ARGS);
 static  void              mdoc_bl_post(MDOC_ARGS);  static  void              mdoc_bl_post(MDOC_ARGS);
 static  int               mdoc_bl_pre(MDOC_ARGS);  static  int               mdoc_bl_pre(MDOC_ARGS);
 static  void              mdoc_bq_post(MDOC_ARGS);  static  void              mdoc_bq_post(MDOC_ARGS);
Line 237  static const struct htmlmdoc mdocs[MDOC_MAX] = {
Line 238  static const struct htmlmdoc mdocs[MDOC_MAX] = {
         {NULL, NULL}, /* Fc */          {NULL, NULL}, /* Fc */
         {mdoc_op_pre, mdoc_op_post}, /* Oo */          {mdoc_op_pre, mdoc_op_post}, /* Oo */
         {NULL, NULL}, /* Oc */          {NULL, NULL}, /* Oc */
         {NULL, NULL}, /* Bk */          {mdoc_bk_pre, mdoc_bk_post}, /* Bk */
         {NULL, NULL}, /* Ek */          {NULL, NULL}, /* Ek */
         {mdoc_bt_pre, NULL}, /* Bt */          {mdoc_bt_pre, NULL}, /* Bt */
         {NULL, NULL}, /* Hf */          {NULL, NULL}, /* Hf */
Line 442  print_mdoc_node(MDOC_ARGS)
Line 443  print_mdoc_node(MDOC_ARGS)
                 break;                  break;
         }          }
   
           if (HTML_KEEP & h->flags) {
                   if (n->prev && n->prev->line != n->line) {
                           h->flags &= ~HTML_KEEP;
                           h->flags |= HTML_PREKEEP;
                   } else if (NULL == n->prev) {
                           if (n->parent && n->parent->line != n->line) {
                                   h->flags &= ~HTML_KEEP;
                                   h->flags |= HTML_PREKEEP;
                           }
                   }
           }
   
         if (child && n->child)          if (child && n->child)
                 print_mdoc_nodelist(m, n->child, h);                  print_mdoc_nodelist(m, n->child, h);
   
Line 1074  mdoc_it_head_pre(MDOC_ARGS, enum mdoc_list type, struc
Line 1087  mdoc_it_head_pre(MDOC_ARGS, enum mdoc_list type, struc
 static int  static int
 mdoc_it_pre(MDOC_ARGS)  mdoc_it_pre(MDOC_ARGS)
 {  {
         int                      i, wp, comp;          int                      i, comp;
         const struct mdoc_node  *bl, *nn;          const struct mdoc_node  *bl, *nn;
         struct roffsu            width, offs;          struct roffsu            width, offs;
         enum mdoc_list           type;          enum mdoc_list           type;
Line 1116  mdoc_it_pre(MDOC_ARGS)
Line 1129  mdoc_it_pre(MDOC_ARGS)
         if (bl->data.Bl->width)          if (bl->data.Bl->width)
                 a2width(bl->data.Bl->width, &width);                  a2width(bl->data.Bl->width, &width);
   
         wp = -1;  
         for (i = 0; bl->args && i < (int)bl->args->argc; i++)  
                 switch (bl->args->argv[i].arg) {  
                 case (MDOC_Column):  
                         wp = i; /* Save for later. */  
                         break;  
                 default:  
                         break;  
                 }  
   
         /* Override width in some cases. */          /* Override width in some cases. */
   
         switch (type) {          switch (type) {
Line 1149  mdoc_it_pre(MDOC_ARGS)
Line 1152  mdoc_it_pre(MDOC_ARGS)
                 for (i = 0; nn && nn != n; nn = nn->next)                  for (i = 0; nn && nn != n; nn = nn->next)
                         if (MDOC_BODY == nn->type)                          if (MDOC_BODY == nn->type)
                                 i++;                                  i++;
                 if (i < (int)bl->args->argv[wp].sz)                  if (i < (int)bl->data.Bl->ncols)
                         a2width(bl->args->argv[wp].value[i], &width);                          a2width(bl->data.Bl->cols[i], &width);
         }          }
   
         if (MDOC_HEAD == n->type)          if (MDOC_HEAD == n->type)
Line 2236  mdoc__x_post(MDOC_ARGS)
Line 2239  mdoc__x_post(MDOC_ARGS)
   
         h->flags |= HTML_NOSPACE;          h->flags |= HTML_NOSPACE;
         print_text(h, n->next ? "," : ".");          print_text(h, n->next ? "," : ".");
   }
   
   
   /* ARGSUSED */
   static int
   mdoc_bk_pre(MDOC_ARGS)
   {
   
           switch (n->type) {
           case (MDOC_BLOCK):
                   break;
           case (MDOC_HEAD):
                   return(0);
           case (MDOC_BODY):
                   h->flags |= HTML_PREKEEP;
                   break;
           default:
                   abort();
                   /* NOTREACHED */
           }
   
           return(1);
   }
   
   
   /* ARGSUSED */
   static void
   mdoc_bk_post(MDOC_ARGS)
   {
   
           if (MDOC_BODY == n->type)
                   h->flags &= ~(HTML_KEEP | HTML_PREKEEP);
 }  }

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

CVSweb