version 1.171, 2014/09/27 10:56:18 |
version 1.172, 2014/09/27 11:17:19 |
|
|
/* $Id$ */ |
/* $Id$ */ |
/* |
/* |
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2008, 2009, 2010, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> |
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> |
* |
* |
* Permission to use, copy, modify, and distribute this software for any |
* Permission to use, copy, modify, and distribute this software for any |
Line 108 static int print_escape(char); |
|
Line 108 static int print_escape(char); |
|
static int print_encode(struct html *, const char *, int); |
static int print_encode(struct html *, const char *, int); |
static void print_metaf(struct html *, enum mandoc_esc); |
static void print_metaf(struct html *, enum mandoc_esc); |
static void print_attr(struct html *, const char *, const char *); |
static void print_attr(struct html *, const char *, const char *); |
static void *ml_alloc(char *, enum htmltype); |
static void *ml_alloc(char *); |
|
|
|
|
static void * |
static void * |
ml_alloc(char *outopts, enum htmltype type) |
ml_alloc(char *outopts) |
{ |
{ |
struct html *h; |
struct html *h; |
const char *toks[5]; |
const char *toks[5]; |
Line 126 ml_alloc(char *outopts, enum htmltype type) |
|
Line 126 ml_alloc(char *outopts, enum htmltype type) |
|
|
|
h = mandoc_calloc(1, sizeof(struct html)); |
h = mandoc_calloc(1, sizeof(struct html)); |
|
|
h->type = type; |
|
h->tags.head = NULL; |
h->tags.head = NULL; |
h->symtab = mchars_alloc(); |
h->symtab = mchars_alloc(); |
|
|
|
|
html_alloc(char *outopts) |
html_alloc(char *outopts) |
{ |
{ |
|
|
return(ml_alloc(outopts, HTML_HTML_4_01_STRICT)); |
return(ml_alloc(outopts)); |
} |
} |
|
|
void * |
void * |
xhtml_alloc(char *outopts) |
xhtml_alloc(char *outopts) |
{ |
{ |
|
|
return(ml_alloc(outopts, HTML_XHTML_1_0_STRICT)); |
return(ml_alloc(outopts)); |
} |
} |
|
|
void |
void |
Line 494 print_otag(struct html *h, enum htmltag tag, |
|
Line 493 print_otag(struct html *h, enum htmltag tag, |
|
for (i = 0; i < sz; i++) |
for (i = 0; i < sz; i++) |
print_attr(h, htmlattrs[p[i].key], p[i].val); |
print_attr(h, htmlattrs[p[i].key], p[i].val); |
|
|
/* Accommodate for XML "well-formed" singleton escaping. */ |
/* Accommodate for "well-formed" singleton escaping. */ |
|
|
if (HTML_AUTOCLOSE & htmltags[tag].flags) |
if (HTML_AUTOCLOSE & htmltags[tag].flags) |
switch (h->type) { |
putchar('/'); |
case HTML_XHTML_1_0_STRICT: |
|
putchar('/'); |
|
break; |
|
default: |
|
break; |
|
} |
|
|
|
putchar('>'); |
putchar('>'); |
|
|