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

Diff for /mandoc/html.c between version 1.98 and 1.102

version 1.98, 2010/04/08 07:05:38 version 1.102, 2010/06/19 20:46:27
Line 1 
Line 1 
 /*      $Id$ */  /*      $Id$ */
 /*  /*
  * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>   * Copyright (c) 2008, 2009 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 29 
Line 29 
 #include <string.h>  #include <string.h>
 #include <unistd.h>  #include <unistd.h>
   
   #include "mandoc.h"
 #include "out.h"  #include "out.h"
 #include "chars.h"  #include "chars.h"
 #include "html.h"  #include "html.h"
 #include "main.h"  #include "main.h"
   
 #define UNCONST(a)      ((void *)(uintptr_t)(const void *)(a))  
   
 struct  htmldata {  struct  htmldata {
         const char       *name;          const char       *name;
         int               flags;          int               flags;
Line 54  static const struct htmldata htmltags[TAG_MAX] = {
Line 53  static const struct htmldata htmltags[TAG_MAX] = {
         {"h1",          0}, /* TAG_H1 */          {"h1",          0}, /* TAG_H1 */
         {"h2",          0}, /* TAG_H2 */          {"h2",          0}, /* TAG_H2 */
         {"span",        0}, /* TAG_SPAN */          {"span",        0}, /* TAG_SPAN */
         {"link",        HTML_CLRLINE | HTML_NOSTACK}, /* TAG_LINK */          {"link",        HTML_CLRLINE | HTML_NOSTACK | HTML_AUTOCLOSE}, /* TAG_LINK */
         {"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 */
Line 296  print_encode(struct html *h, const char *p, int norecu
Line 295  print_encode(struct html *h, const char *p, int norecu
         int              len, nospace;          int              len, nospace;
         const char      *seq;          const char      *seq;
         enum roffdeco    deco;          enum roffdeco    deco;
           static const char rejs[6] = { '\\', '<', '>', '&', ASCII_HYPH, '\0' };
   
         nospace = 0;          nospace = 0;
   
         for (; *p; p++) {          for (; *p; p++) {
                 sz = strcspn(p, "\\<>&");                  sz = strcspn(p, rejs);
   
                 fwrite(p, 1, sz, stdout);                  fwrite(p, 1, sz, stdout);
                 p += /* LINTED */                  p += /* LINTED */
Line 315  print_encode(struct html *h, const char *p, int norecu
Line 315  print_encode(struct html *h, const char *p, int norecu
                 } else if ('&' == *p) {                  } else if ('&' == *p) {
                         printf("&amp;");                          printf("&amp;");
                         continue;                          continue;
                   } else if (ASCII_HYPH == *p) {
                           /*
                            * Note: "soft hyphens" aren't graphically
                            * displayed when not breaking the text; we want
                            * them to be displayed.
                            */
                           /*printf("&#173;");*/
                           putchar('-');
                           continue;
                 } else if ('\0' == *p)                  } else if ('\0' == *p)
                         break;                          break;
   
Line 443  print_gen_decls(struct html *h)
Line 452  print_gen_decls(struct html *h)
 static void  static void
 print_xmltype(struct html *h)  print_xmltype(struct html *h)
 {  {
         const char      *decl;  
   
         switch (h->type) {          if (HTML_XHTML_1_0_STRICT == h->type)
         case (HTML_XHTML_1_0_STRICT):                  printf("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                 decl = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";  
                 break;  
         default:  
                 decl = NULL;  
                 break;  
         }  
   
         if (NULL == decl)  
                 return;  
   
         printf("%s\n", decl);  
 }  }
   
   

Legend:
Removed from v.1.98  
changed lines
  Added in v.1.102

CVSweb