summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/blocks.c22
-rw-r--r--src/commonmark.c44
-rw-r--r--src/html.c16
-rw-r--r--src/latex.c14
-rw-r--r--src/man.c12
-rw-r--r--src/render.c33
6 files changed, 71 insertions, 70 deletions
diff --git a/src/blocks.c b/src/blocks.c
index aac9a2a..f8b7495 100644
--- a/src/blocks.c
+++ b/src/blocks.c
@@ -742,9 +742,9 @@ S_process_line(cmark_parser *parser, const unsigned char *buffer, bufsize_t byte
break;
default:
fprintf(stderr,
- "Error (%s:%d): Unknown HTML block type %d\n",
- __FILE__, __LINE__,
- container->as.html_block_type);
+ "Error (%s:%d): Unknown HTML block type %d\n",
+ __FILE__, __LINE__,
+ container->as.html_block_type);
exit(1);
}
@@ -812,9 +812,9 @@ S_process_line(cmark_parser *parser, const unsigned char *buffer, bufsize_t byte
S_advance_offset(parser, &input, parser->first_nonspace + matched - parser->offset, false);
} else if (!indented &&
- ((matched = scan_html_block_start(&input, parser->first_nonspace)) ||
- (container->type != NODE_PARAGRAPH &&
- (matched = scan_html_block_start_7(&input, parser->first_nonspace))))) {
+ ((matched = scan_html_block_start(&input, parser->first_nonspace)) ||
+ (container->type != NODE_PARAGRAPH &&
+ (matched = scan_html_block_start_7(&input, parser->first_nonspace))))) {
container = add_child(parser, container, NODE_HTML, parser->first_nonspace + 1);
container->as.html_block_type = matched;
@@ -962,27 +962,27 @@ S_process_line(cmark_parser *parser, const unsigned char *buffer, bufsize_t byte
case 1:
// </script>, </style>, </pre>
matches_end_condition =
- scan_html_block_end_1(&input, parser->first_nonspace);
+ scan_html_block_end_1(&input, parser->first_nonspace);
break;
case 2:
// -->
matches_end_condition =
- scan_html_block_end_2(&input, parser->first_nonspace);
+ scan_html_block_end_2(&input, parser->first_nonspace);
break;
case 3:
// ?>
matches_end_condition =
- scan_html_block_end_3(&input, parser->first_nonspace);
+ scan_html_block_end_3(&input, parser->first_nonspace);
break;
case 4:
// >
matches_end_condition =
- scan_html_block_end_4(&input, parser->first_nonspace);
+ scan_html_block_end_4(&input, parser->first_nonspace);
break;
case 5:
// ]]>
matches_end_condition =
- scan_html_block_end_5(&input, parser->first_nonspace);
+ scan_html_block_end_5(&input, parser->first_nonspace);
break;
default:
matches_end_condition = 0;
diff --git a/src/commonmark.c b/src/commonmark.c
index 60565d2..0f4c2bc 100644
--- a/src/commonmark.c
+++ b/src/commonmark.c
@@ -21,28 +21,28 @@
// Functions to convert cmark_nodes to commonmark strings.
static inline void outc(cmark_renderer *renderer,
- cmark_escaping escape,
- int32_t c,
- unsigned char nextc)
+ cmark_escaping escape,
+ int32_t c,
+ unsigned char nextc)
{
bool needs_escaping = false;
needs_escaping =
- escape != LITERAL &&
- ((escape == NORMAL &&
- (c == '*' || c == '_' || c == '[' || c == ']' || c == '#' ||
- c == '<' || c == '>' || c == '\\' || c == '`' || c == '!' ||
- (c == '&' && isalpha(nextc)) ||
- (c == '!' && nextc == '[') ||
- (renderer->begin_line &&
- (c == '-' || c == '+' || c == '=')) ||
- ((c == '.' || c == ')') &&
- isdigit(renderer->buffer->ptr[renderer->buffer->size - 1])))) ||
- (escape == URL &&
- (c == '`' || c == '<' || c == '>' || isspace(c) ||
- c == '\\' || c == ')' || c == '(')) ||
- (escape == TITLE &&
- (c == '`' || c == '<' || c == '>' || c == '"' ||
- c == '\\')));
+ escape != LITERAL &&
+ ((escape == NORMAL &&
+ (c == '*' || c == '_' || c == '[' || c == ']' || c == '#' ||
+ c == '<' || c == '>' || c == '\\' || c == '`' || c == '!' ||
+ (c == '&' && isalpha(nextc)) ||
+ (c == '!' && nextc == '[') ||
+ (renderer->begin_line &&
+ (c == '-' || c == '+' || c == '=')) ||
+ ((c == '.' || c == ')') &&
+ isdigit(renderer->buffer->ptr[renderer->buffer->size - 1])))) ||
+ (escape == URL &&
+ (c == '`' || c == '<' || c == '>' || isspace(c) ||
+ c == '\\' || c == ')' || c == '(')) ||
+ (escape == TITLE &&
+ (c == '`' || c == '<' || c == '>' || c == '"' ||
+ c == '\\')));
if (needs_escaping) {
if (isspace(c)) {
@@ -159,9 +159,9 @@ get_containing_block(cmark_node *node)
static int
S_render_node(cmark_renderer *renderer,
- cmark_node *node,
- cmark_event_type ev_type,
- int options)
+ cmark_node *node,
+ cmark_event_type ev_type,
+ int options)
{
cmark_node *tmp;
int list_number;
diff --git a/src/html.c b/src/html.c
index 48a80d6..c6bbea6 100644
--- a/src/html.c
+++ b/src/html.c
@@ -179,7 +179,7 @@ S_render_node(cmark_node *node, cmark_event_type ev_type,
cmark_strbuf_puts(html, "<!-- raw HTML omitted -->");
} else {
cmark_strbuf_put(html, node->as.literal.data,
- node->as.literal.len);
+ node->as.literal.len);
}
cr(html);
break;
@@ -239,7 +239,7 @@ S_render_node(cmark_node *node, cmark_event_type ev_type,
cmark_strbuf_puts(html, "<!-- raw HTML omitted -->");
} else {
cmark_strbuf_put(html, node->as.literal.data,
- node->as.literal.len);
+ node->as.literal.len);
}
break;
@@ -265,15 +265,15 @@ S_render_node(cmark_node *node, cmark_event_type ev_type,
if (!((options & CMARK_OPT_SAFE) &&
scan_dangerous_url(&node->as.link.url, 0))) {
houdini_escape_href(html,
- node->as.link.url.data,
- node->as.link.url.len);
+ node->as.link.url.data,
+ node->as.link.url.len);
}
if (node->as.link.title.len) {
cmark_strbuf_puts(html, "\" title=\"");
escape_html(html,
- node->as.link.title.data,
- node->as.link.title.len);
+ node->as.link.title.data,
+ node->as.link.title.len);
}
cmark_strbuf_puts(html, "\">");
} else {
@@ -287,8 +287,8 @@ S_render_node(cmark_node *node, cmark_event_type ev_type,
if (!((options & CMARK_OPT_SAFE) &&
scan_dangerous_url(&node->as.link.url, 0))) {
houdini_escape_href(html,
- node->as.link.url.data,
- node->as.link.url.len);
+ node->as.link.url.data,
+ node->as.link.url.len);
}
cmark_strbuf_puts(html, "\" alt=\"");
diff --git a/src/latex.c b/src/latex.c
index 34dffc7..782b0c0 100644
--- a/src/latex.c
+++ b/src/latex.c
@@ -19,9 +19,9 @@
#define BLANKLINE() renderer->blankline(renderer)
static inline void outc(cmark_renderer *renderer,
- cmark_escaping escape,
- int32_t c,
- unsigned char nextc)
+ cmark_escaping escape,
+ int32_t c,
+ unsigned char nextc)
{
if (escape == LITERAL) {
cmark_render_code_point(renderer, c);
@@ -220,9 +220,9 @@ S_get_enumlevel(cmark_node *node)
static int
S_render_node(cmark_renderer *renderer,
- cmark_node *node,
- cmark_event_type ev_type,
- int options)
+ cmark_node *node,
+ cmark_event_type ev_type,
+ int options)
{
int list_number;
char list_number_string[20];
@@ -260,7 +260,7 @@ S_render_node(cmark_renderer *renderer,
list_number = cmark_node_get_list_start(node);
if (list_number > 1) {
sprintf(list_number_string,
- "%d", list_number);
+ "%d", list_number);
LIT("\\setcounter{enum");
LIT((char *)roman_numerals[S_get_enumlevel(node)]);
LIT("}{");
diff --git a/src/man.c b/src/man.c
index 4a49441..6ff33f5 100644
--- a/src/man.c
+++ b/src/man.c
@@ -18,9 +18,9 @@
// Functions to convert cmark_nodes to groff man strings.
static
void S_outc(cmark_renderer *renderer,
- cmark_escaping escape,
- int32_t c,
- unsigned char nextc)
+ cmark_escaping escape,
+ int32_t c,
+ unsigned char nextc)
{
(void)(nextc);
@@ -75,8 +75,8 @@ void S_outc(cmark_renderer *renderer,
static int
S_render_node(cmark_renderer *renderer,
- cmark_node *node,
- cmark_event_type ev_type,
+ cmark_node *node,
+ cmark_event_type ev_type,
int options)
{
cmark_node *tmp;
@@ -133,7 +133,7 @@ S_render_node(cmark_renderer *renderer,
if (entering) {
CR();
LIT(cmark_node_get_header_level(node) == 1 ?
- ".SH" : ".SS");
+ ".SH" : ".SS");
CR();
} else {
CR();
diff --git a/src/render.c b/src/render.c
index ab53558..2f1faac 100644
--- a/src/render.c
+++ b/src/render.c
@@ -23,9 +23,9 @@ void S_blankline(cmark_renderer *renderer)
static
void S_out(cmark_renderer *renderer,
- const char *source,
- bool wrap,
- cmark_escaping escape)
+ const char *source,
+ bool wrap,
+ cmark_escaping escape)
{
int length = cmark_strbuf_safe_strlen(source);
unsigned char nextc;
@@ -74,7 +74,7 @@ void S_out(cmark_renderer *renderer,
renderer->column += 1;
renderer->begin_line = false;
renderer->last_breakable = renderer->buffer->size -
- 1;
+ 1;
// skip following spaces
while (source[i + 1] == ' ') {
i++;
@@ -138,16 +138,16 @@ cmark_render_code_point(cmark_renderer *renderer, uint32_t c)
char*
cmark_render(cmark_node *root,
- int options,
- int width,
- void (*outc)(cmark_renderer*,
- cmark_escaping,
- int32_t,
- unsigned char),
- int (*render_node)(cmark_renderer *renderer,
- cmark_node *node,
- cmark_event_type ev_type,
- int options))
+ int options,
+ int width,
+ void (*outc)(cmark_renderer*,
+ cmark_escaping,
+ int32_t,
+ unsigned char),
+ int (*render_node)(cmark_renderer *renderer,
+ cmark_node *node,
+ cmark_event_type ev_type,
+ int options))
{
cmark_strbuf pref = GH_BUF_INIT;
cmark_strbuf buf = GH_BUF_INIT;
@@ -157,8 +157,9 @@ cmark_render(cmark_node *root,
cmark_iter *iter = cmark_iter_new(root);
cmark_renderer renderer = { &buf, &pref, 0, width,
- 0, 0, true, false, false,
- outc, S_cr, S_blankline, S_out };
+ 0, 0, true, false, false,
+ outc, S_cr, S_blankline, S_out
+ };
while ((ev_type = cmark_iter_next(iter)) != CMARK_EVENT_DONE) {
cur = cmark_iter_get_node(iter);