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

Diff for /mandoc/html.c between version 1.109 and 1.117

version 1.109, 2010/07/23 00:08:57 version 1.117, 2010/12/17 08:17:40
Line 57  static const struct htmldata htmltags[TAG_MAX] = {
Line 57  static const struct htmldata htmltags[TAG_MAX] = {
         {"br",          HTML_CLRLINE | HTML_NOSTACK | HTML_AUTOCLOSE}, /* TAG_BR */          {"br",          HTML_CLRLINE | HTML_NOSTACK | HTML_AUTOCLOSE}, /* TAG_BR */
         {"a",           0}, /* TAG_A */          {"a",           0}, /* TAG_A */
         {"table",       HTML_CLRLINE}, /* TAG_TABLE */          {"table",       HTML_CLRLINE}, /* TAG_TABLE */
           {"tbody",       HTML_CLRLINE}, /* TAG_TBODY */
         {"col",         HTML_CLRLINE | HTML_NOSTACK | HTML_AUTOCLOSE}, /* TAG_COL */          {"col",         HTML_CLRLINE | HTML_NOSTACK | HTML_AUTOCLOSE}, /* TAG_COL */
         {"tr",          HTML_CLRLINE}, /* TAG_TR */          {"tr",          HTML_CLRLINE}, /* TAG_TR */
         {"td",          HTML_CLRLINE}, /* TAG_TD */          {"td",          HTML_CLRLINE}, /* TAG_TD */
         {"li",          HTML_CLRLINE}, /* TAG_LI */          {"li",          HTML_CLRLINE}, /* TAG_LI */
         {"ul",          HTML_CLRLINE}, /* TAG_UL */          {"ul",          HTML_CLRLINE}, /* TAG_UL */
         {"ol",          HTML_CLRLINE}, /* TAG_OL */          {"ol",          HTML_CLRLINE}, /* TAG_OL */
           {"dl",          HTML_CLRLINE}, /* TAG_DL */
           {"dt",          HTML_CLRLINE}, /* TAG_DT */
           {"dd",          HTML_CLRLINE}, /* TAG_DD */
           {"blockquote",  HTML_CLRLINE}, /* TAG_BLOCKQUOTE */
           {"p",           HTML_CLRLINE | HTML_NOSTACK | HTML_AUTOCLOSE}, /* TAG_P */
 };  };
   
 static  const char      *const htmlfonts[HTMLFONT_MAX] = {  static  const char      *const htmlfonts[HTMLFONT_MAX] = {
Line 116  ml_alloc(char *outopts, enum htmltype type)
Line 122  ml_alloc(char *outopts, enum htmltype type)
         h = calloc(1, sizeof(struct html));          h = calloc(1, sizeof(struct html));
         if (NULL == h) {          if (NULL == h) {
                 perror(NULL);                  perror(NULL);
                 exit(EXIT_FAILURE);                  exit((int)MANDOCLEVEL_SYSERR);
         }          }
   
         h->type = type;          h->type = type;
         h->tags.head = NULL;          h->tags.head = NULL;
         h->ords.head = NULL;  
         h->symtab = chars_init(CHARS_HTML);          h->symtab = chars_init(CHARS_HTML);
   
         while (outopts && *outopts)          while (outopts && *outopts)
Line 162  void
Line 167  void
 html_free(void *p)  html_free(void *p)
 {  {
         struct tag      *tag;          struct tag      *tag;
         struct ord      *ord;  
         struct html     *h;          struct html     *h;
   
         h = (struct html *)p;          h = (struct html *)p;
   
         while ((ord = h->ords.head) != NULL) {  
                 h->ords.head = ord->next;  
                 free(ord);  
         }  
   
         while ((tag = h->tags.head) != NULL) {          while ((tag = h->tags.head) != NULL) {
                 h->tags.head = tag->next;                  h->tags.head = tag->next;
                 free(tag);                  free(tag);
Line 398  print_otag(struct html *h, enum htmltag tag, 
Line 397  print_otag(struct html *h, enum htmltag tag, 
                 t = malloc(sizeof(struct tag));                  t = malloc(sizeof(struct tag));
                 if (NULL == t) {                  if (NULL == t) {
                         perror(NULL);                          perror(NULL);
                         exit(EXIT_FAILURE);                          exit((int)MANDOCLEVEL_SYSERR);
                 }                  }
                 t->tag = tag;                  t->tag = tag;
                 t->next = h->tags.head;                  t->next = h->tags.head;
Line 419  print_otag(struct html *h, enum htmltag tag, 
Line 418  print_otag(struct html *h, enum htmltag tag, 
   
         if ( ! (h->flags & HTML_NONOSPACE))          if ( ! (h->flags & HTML_NONOSPACE))
                 h->flags &= ~HTML_NOSPACE;                  h->flags &= ~HTML_NOSPACE;
           else
                   h->flags |= HTML_NOSPACE;
   
         /* Print out the tag name and attributes. */          /* Print out the tag name and attributes. */
   
Line 448  print_otag(struct html *h, enum htmltag tag, 
Line 449  print_otag(struct html *h, enum htmltag tag, 
         putchar('>');          putchar('>');
   
         h->flags |= HTML_NOSPACE;          h->flags |= HTML_NOSPACE;
   
           if ((HTML_AUTOCLOSE | HTML_CLRLINE) & htmltags[tag].flags)
                   putchar('\n');
   
         return(t);          return(t);
 }  }
   
Line 549  print_text(struct html *h, const char *word)
Line 554  print_text(struct html *h, const char *word)
         if ( ! print_encode(h, word, 0))          if ( ! print_encode(h, word, 0))
                 if ( ! (h->flags & HTML_NONOSPACE))                  if ( ! (h->flags & HTML_NONOSPACE))
                         h->flags &= ~HTML_NOSPACE;                          h->flags &= ~HTML_NOSPACE;
   
           h->flags &= ~HTML_IGNDELIM;
   
         /*          /*
          * Note that we don't process the pipe: the parser sees it as           * Note that we don't process the pipe: the parser sees it as

Legend:
Removed from v.1.109  
changed lines
  Added in v.1.117

CVSweb