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

Diff for /mandoc/html.c between version 1.126 and 1.131

version 1.126, 2011/01/30 16:05:37 version 1.131, 2011/03/22 14:05:45
Line 32 
Line 32 
   
 #include "mandoc.h"  #include "mandoc.h"
 #include "out.h"  #include "out.h"
 #include "chars.h"  
 #include "html.h"  #include "html.h"
 #include "main.h"  #include "main.h"
   
Line 120  ml_alloc(char *outopts, enum htmltype type)
Line 119  ml_alloc(char *outopts, enum htmltype type)
         toks[2] = "includes";          toks[2] = "includes";
         toks[3] = NULL;          toks[3] = NULL;
   
         h = calloc(1, sizeof(struct html));          h = mandoc_calloc(1, sizeof(struct html));
         if (NULL == h) {  
                 perror(NULL);  
                 exit((int)MANDOCLEVEL_SYSERR);  
         }  
   
         h->type = type;          h->type = type;
         h->tags.head = NULL;          h->tags.head = NULL;
Line 214  print_gen_head(struct html *h)
Line 209  print_gen_head(struct html *h)
         }          }
 }  }
   
   /* ARGSUSED */
 static void  static void
 print_num(struct html *h, const char *p, size_t len)  print_num(struct html *h, const char *p, size_t len)
 {  {
Line 225  print_num(struct html *h, const char *p, size_t len)
Line 220  print_num(struct html *h, const char *p, size_t len)
                 putchar((int)*rhs);                  putchar((int)*rhs);
 }  }
   
   
 static void  static void
 print_spec(struct html *h, enum roffdeco d, const char *p, size_t len)  print_spec(struct html *h, enum roffdeco d, const char *p, size_t len)
 {  {
Line 401  print_otag(struct html *h, enum htmltag tag, 
Line 395  print_otag(struct html *h, enum htmltag tag, 
         /* Push this tags onto the stack of open scopes. */          /* Push this tags onto the stack of open scopes. */
   
         if ( ! (HTML_NOSTACK & htmltags[tag].flags)) {          if ( ! (HTML_NOSTACK & htmltags[tag].flags)) {
                 t = malloc(sizeof(struct tag));                  t = mandoc_malloc(sizeof(struct tag));
                 if (NULL == t) {  
                         perror(NULL);  
                         exit((int)MANDOCLEVEL_SYSERR);  
                 }  
                 t->tag = tag;                  t->tag = tag;
                 t->next = h->tags.head;                  t->next = h->tags.head;
                 h->tags.head = t;                  h->tags.head = t;
Line 518  print_doctype(struct html *h)
Line 508  print_doctype(struct html *h)
                         name, doctype, dtd);                          name, doctype, dtd);
 }  }
   
   
 void  void
 print_text(struct html *h, const char *word)  print_text(struct html *h, const char *word)
 {  {
   
         if (word[0] && '\0' == word[1])  
                 switch (word[0]) {  
                 case('.'):  
                         /* FALLTHROUGH */  
                 case(','):  
                         /* FALLTHROUGH */  
                 case(';'):  
                         /* FALLTHROUGH */  
                 case(':'):  
                         /* FALLTHROUGH */  
                 case('?'):  
                         /* FALLTHROUGH */  
                 case('!'):  
                         /* FALLTHROUGH */  
                 case(')'):  
                         /* FALLTHROUGH */  
                 case(']'):  
                         if ( ! (HTML_IGNDELIM & h->flags))  
                                 h->flags |= HTML_NOSPACE;  
                         break;  
                 default:  
                         break;  
                 }  
   
         if ( ! (HTML_NOSPACE & h->flags)) {          if ( ! (HTML_NOSPACE & h->flags)) {
                 /* Manage keeps! */                  /* Manage keeps! */
                 if ( ! (HTML_KEEP & h->flags)) {                  if ( ! (HTML_KEEP & h->flags)) {
Line 574  print_text(struct html *h, const char *word)
Line 539  print_text(struct html *h, const char *word)
         }          }
   
         h->flags &= ~HTML_IGNDELIM;          h->flags &= ~HTML_IGNDELIM;
   
         /*  
          * Note that we don't process the pipe: the parser sees it as  
          * punctuation, but we don't in terms of typography.  
          */  
         if (word[0] && '\0' == word[1])  
                 switch (word[0]) {  
                 case('('):  
                         /* FALLTHROUGH */  
                 case('['):  
                         h->flags |= HTML_NOSPACE;  
                         break;  
                 default:  
                         break;  
                 }  
 }  }
   
   

Legend:
Removed from v.1.126  
changed lines
  Added in v.1.131

CVSweb