diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-05-25 12:37:20 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-05-25 12:37:20 +0000 |
commit | bd60b6e6dde1b45c862a7cb7092e5a6985629c1f (patch) | |
tree | 1b4eb8fbcedf0b30869618fd4adb0e76fcc58f91 /html.c | |
parent | 67f57cab47c6371e6a42d8d6952b35485c7b0b85 (diff) | |
download | mandoc-bd60b6e6dde1b45c862a7cb7092e5a6985629c1f.tar.gz |
Modified version of Ingo Schwarze's patch for hyphen-breaking.
Breakable hyphens are cued in the back-ends (with ASCII_HYPH) and acted
upon in term.c or ignored in html.c.
Also cleaned up XML decl printing (no need for extra vars).
Diffstat (limited to 'html.c')
-rw-r--r-- | html.c | 29 |
1 files changed, 14 insertions, 15 deletions
@@ -29,6 +29,7 @@ #include <string.h> #include <unistd.h> +#include "mandoc.h" #include "out.h" #include "chars.h" #include "html.h" @@ -296,11 +297,12 @@ print_encode(struct html *h, const char *p, int norecurse) int len, nospace; const char *seq; enum roffdeco deco; + static const char rejs[6] = { '\\', '<', '>', '&', ASCII_HYPH, '\0' }; nospace = 0; for (; *p; p++) { - sz = strcspn(p, "\\<>&"); + sz = strcspn(p, rejs); fwrite(p, 1, sz, stdout); p += /* LINTED */ @@ -315,6 +317,15 @@ print_encode(struct html *h, const char *p, int norecurse) } else if ('&' == *p) { printf("&"); 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("­");*/ + putchar('-'); + continue; } else if ('\0' == *p) break; @@ -443,21 +454,9 @@ print_gen_decls(struct html *h) static void print_xmltype(struct html *h) { - const char *decl; - - switch (h->type) { - case (HTML_XHTML_1_0_STRICT): - decl = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; - break; - default: - decl = NULL; - break; - } - - if (NULL == decl) - return; - printf("%s\n", decl); + if (HTML_XHTML_1_0_STRICT == h->type) + printf("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); } |