diff --git a/src/html.c b/src/html.c index 6121ff6..caac2c2 100755 --- a/src/html.c +++ b/src/html.c @@ -7,7 +7,7 @@ #include "escape.h" -#define USE_XHTML(opt) (opt->flags & HTML_USE_XHTML) +#define USE_XHTML(opt) (opt->flags & HOEDOWN_HTML_USE_XHTML) int hoedown_html_is_tag(const uint8_t *tag_data, size_t tag_size, const char *tagname) @@ -16,7 +16,7 @@ hoedown_html_is_tag(const uint8_t *tag_data, size_t tag_size, const char *tagnam int closed = 0; if (tag_size < 3 || tag_data[0] != '<') - return HTML_TAG_NONE; + return HOEDOWN_HTML_TAG_NONE; i = 1; @@ -30,16 +30,16 @@ hoedown_html_is_tag(const uint8_t *tag_data, size_t tag_size, const char *tagnam break; if (tag_data[i] != *tagname) - return HTML_TAG_NONE; + return HOEDOWN_HTML_TAG_NONE; } if (i == tag_size) - return HTML_TAG_NONE; + return HOEDOWN_HTML_TAG_NONE; if (isspace(tag_data[i]) || tag_data[i] == '>') - return closed ? HTML_TAG_CLOSE : HTML_TAG_OPEN; + return closed ? HOEDOWN_HTML_TAG_CLOSE : HOEDOWN_HTML_TAG_OPEN; - return HTML_TAG_NONE; + return HOEDOWN_HTML_TAG_NONE; } static inline void escape_html(struct hoedown_buffer *ob, const uint8_t *source, size_t length) @@ -63,7 +63,7 @@ rndr_autolink(struct hoedown_buffer *ob, const struct hoedown_buffer *link, enum if (!link || !link->size) return 0; - if ((options->flags & HTML_SAFELINK) != 0 && + if ((options->flags & HOEDOWN_HTML_SAFELINK) != 0 && !hoedown_autolink_issafe(link->data, link->size) && type != HOEDOWN_AUTOLINK_EMAIL) return 0; @@ -106,7 +106,7 @@ rndr_blockcode(struct hoedown_buffer *ob, const struct hoedown_buffer *text, con if (lang && lang->size) { size_t i, cls = 0; - if (options->flags & HTML_PRETTIFY) { + if (options->flags & HOEDOWN_HTML_PRETTIFY) { BUFPUTSL(ob, "
");
- } else if (options->flags & HTML_PRETTIFY) {
+ } else if (options->flags & HOEDOWN_HTML_PRETTIFY) {
BUFPUTSL(ob, "");
} else {
BUFPUTSL(ob, "");
@@ -156,7 +156,7 @@ static int
rndr_codespan(struct hoedown_buffer *ob, const struct hoedown_buffer *text, void *opaque)
{
struct hoedown_html_renderopt *options = opaque;
- if (options->flags & HTML_PRETTIFY)
+ if (options->flags & HOEDOWN_HTML_PRETTIFY)
BUFPUTSL(ob, "");
else
BUFPUTSL(ob, "");
@@ -255,7 +255,7 @@ rndr_header(struct hoedown_buffer *ob, const struct hoedown_buffer *text, int le
if (ob->size)
hoedown_buffer_putc(ob, '\n');
- if ((options->flags & HTML_TOC) && (level <= options->toc_data.nesting_level))
+ if ((options->flags & HOEDOWN_HTML_TOC) && (level <= options->toc_data.nesting_level))
hoedown_buffer_printf(ob, "", level, options->toc_data.header_count++);
else
hoedown_buffer_printf(ob, "", level);
@@ -269,7 +269,7 @@ rndr_link(struct hoedown_buffer *ob, const struct hoedown_buffer *link, const st
{
struct hoedown_html_renderopt *options = opaque;
- if (link != NULL && (options->flags & HTML_SAFELINK) != 0 && !hoedown_autolink_issafe(link->data, link->size))
+ if (link != NULL && (options->flags & HOEDOWN_HTML_SAFELINK) != 0 && !hoedown_autolink_issafe(link->data, link->size))
return 0;
BUFPUTSL(ob, "");
- if (options->flags & HTML_HARD_WRAP) {
+ if (options->flags & HOEDOWN_HTML_HARD_WRAP) {
size_t org;
while (i < text->size) {
org = i;
@@ -422,23 +422,23 @@ rndr_raw_html(struct hoedown_buffer *ob, const struct hoedown_buffer *text, void
/* HTML_ESCAPE overrides SKIP_HTML, SKIP_STYLE, SKIP_LINKS and SKIP_IMAGES
* It doens't see if there are any valid tags, just escape all of them. */
- if((options->flags & HTML_ESCAPE) != 0) {
+ if((options->flags & HOEDOWN_HTML_ESCAPE) != 0) {
escape_html(ob, text->data, text->size);
return 1;
}
- if ((options->flags & HTML_SKIP_HTML) != 0)
+ if ((options->flags & HOEDOWN_HTML_SKIP_HTML) != 0)
return 1;
- if ((options->flags & HTML_SKIP_STYLE) != 0 &&
+ if ((options->flags & HOEDOWN_HTML_SKIP_STYLE) != 0 &&
hoedown_html_is_tag(text->data, text->size, "style"))
return 1;
- if ((options->flags & HTML_SKIP_LINKS) != 0 &&
+ if ((options->flags & HOEDOWN_HTML_SKIP_LINKS) != 0 &&
hoedown_html_is_tag(text->data, text->size, "a"))
return 1;
- if ((options->flags & HTML_SKIP_IMAGES) != 0 &&
+ if ((options->flags & HOEDOWN_HTML_SKIP_IMAGES) != 0 &&
hoedown_html_is_tag(text->data, text->size, "img"))
return 1;
@@ -670,7 +670,7 @@ hoedown_html_toc_renderer(struct hoedown_callbacks *callbacks, struct hoedown_ht
};
memset(options, 0x0, sizeof(struct hoedown_html_renderopt));
- options->flags = HTML_TOC;
+ options->flags = HOEDOWN_HTML_TOC;
options->toc_data.nesting_level = nesting_level;
memcpy(callbacks, &cb_default, sizeof(struct hoedown_callbacks));
@@ -724,14 +724,14 @@ hoedown_html_renderer(struct hoedown_callbacks *callbacks, struct hoedown_html_r
/* Prepare the callbacks */
memcpy(callbacks, &cb_default, sizeof(struct hoedown_callbacks));
- if (render_flags & HTML_SKIP_IMAGES)
+ if (render_flags & HOEDOWN_HTML_SKIP_IMAGES)
callbacks->image = NULL;
- if (render_flags & HTML_SKIP_LINKS) {
+ if (render_flags & HOEDOWN_HTML_SKIP_LINKS) {
callbacks->link = NULL;
callbacks->autolink = NULL;
}
- if (render_flags & HTML_SKIP_HTML || render_flags & HTML_ESCAPE)
+ if (render_flags & HOEDOWN_HTML_SKIP_HTML || render_flags & HOEDOWN_HTML_ESCAPE)
callbacks->blockhtml = NULL;
}
diff --git a/src/html.h b/src/html.h
index 3c1db89..0a3fb0f 100644
--- a/src/html.h
+++ b/src/html.h
@@ -26,24 +26,24 @@ struct hoedown_html_renderopt {
};
typedef enum {
- HTML_SKIP_HTML = (1 << 0),
- HTML_SKIP_STYLE = (1 << 1),
- HTML_SKIP_IMAGES = (1 << 2),
- HTML_SKIP_LINKS = (1 << 3),
- HTML_EXPAND_TABS = (1 << 4),
- HTML_SAFELINK = (1 << 5),
- HTML_TOC = (1 << 6),
- HTML_HARD_WRAP = (1 << 7),
- HTML_USE_XHTML = (1 << 8),
- HTML_ESCAPE = (1 << 9),
- HTML_PRETTIFY = (1 << 10),
-} html_render_mode;
+ HOEDOWN_HTML_SKIP_HTML = (1 << 0),
+ HOEDOWN_HTML_SKIP_STYLE = (1 << 1),
+ HOEDOWN_HTML_SKIP_IMAGES = (1 << 2),
+ HOEDOWN_HTML_SKIP_LINKS = (1 << 3),
+ HOEDOWN_HTML_EXPAND_TABS = (1 << 4),
+ HOEDOWN_HTML_SAFELINK = (1 << 5),
+ HOEDOWN_HTML_TOC = (1 << 6),
+ HOEDOWN_HTML_HARD_WRAP = (1 << 7),
+ HOEDOWN_HTML_USE_XHTML = (1 << 8),
+ HOEDOWN_HTML_ESCAPE = (1 << 9),
+ HOEDOWN_HTML_PRETTIFY = (1 << 10),
+} hoedown_html_render_mode;
typedef enum {
- HTML_TAG_NONE = 0,
- HTML_TAG_OPEN,
- HTML_TAG_CLOSE,
-} html_tag;
+ HOEDOWN_HTML_TAG_NONE = 0,
+ HOEDOWN_HTML_TAG_OPEN,
+ HOEDOWN_HTML_TAG_CLOSE,
+} hoedown_html_tag;
int
hoedown_html_is_tag(const uint8_t *tag_data, size_t tag_size, const char *tagname);
diff --git a/src/html_smartypants.c b/src/html_smartypants.c
index 1c9f89d..acb8e5b 100644
--- a/src/html_smartypants.c
+++ b/src/html_smartypants.c
@@ -312,7 +312,7 @@ smartypants_cb__ltag(struct hoedown_buffer *ob, struct smartypants_data *smrt, u
i++;
for (tag = 0; tag < skip_tags_count; ++tag) {
- if (hoedown_html_is_tag(text, size, skip_tags[tag]) == HTML_TAG_OPEN)
+ if (hoedown_html_is_tag(text, size, skip_tags[tag]) == HOEDOWN_HTML_TAG_OPEN)
break;
}
@@ -324,7 +324,7 @@ smartypants_cb__ltag(struct hoedown_buffer *ob, struct smartypants_data *smrt, u
if (i == size)
break;
- if (hoedown_html_is_tag(text + i, size - i, skip_tags[tag]) == HTML_TAG_CLOSE)
+ if (hoedown_html_is_tag(text + i, size - i, skip_tags[tag]) == HOEDOWN_HTML_TAG_CLOSE)
break;
i++;