cmark

My personal build of CMark ✏️

Commit
7c92577bbb670ddfbf6df5ee4b931c27548230cc
Parent
a27cf939b21e2a73ddd49dde942b66f7ca85abdc
Author
John MacFarlane <jgm@berkeley.edu>
Date

astyle changes (code formatting only).

Diffstat

4 files changed, 43 insertions, 41 deletions

Status File Name N° Changes Insertions Deletions
Modified src/blocks.c 8 4 4
Modified src/html.c 58 29 29
Modified src/inlines.c 12 6 6
Modified src/node.c 6 4 2
diff --git a/src/blocks.c b/src/blocks.c
@@ -592,10 +592,10 @@ S_process_line(cmark_parser *parser, const unsigned char *buffer, size_t bytes)
 			} else { // fenced
 				matched = 0;
 				if (indent <= 3 &&
-					(peek_at(&input, first_nonspace) ==
-					 container->as.code.fence_char)) {
+				    (peek_at(&input, first_nonspace) ==
+				     container->as.code.fence_char)) {
 					matched = scan_close_code_fence(&input,
-							first_nonspace);
+					                                first_nonspace);
 				}
 				if (matched >= container->as.code.fence_length) {
 					// closing fence - and since we're at
@@ -608,7 +608,7 @@ S_process_line(cmark_parser *parser, const unsigned char *buffer, size_t bytes)
 					// skip opt. spaces of fence offset
 					i = container->as.code.fence_offset;
 					while (i > 0 &&
-					    peek_at(&input, offset) == ' ') {
+					       peek_at(&input, offset) == ' ') {
 						offset++;
 						i--;
 					}
diff --git a/src/html.c b/src/html.c
@@ -234,18 +234,18 @@ S_render_node(cmark_node *node, cmark_event_type ev_type,
 					continue;
 				}
 				escape_html(html, lit.data + lastout,
-					    i - lastout);
+				            i - lastout);
 				if (c == '\'' || c == '"') {
 					if (i == 0) {
 						if (node->prev) {
-						    if (node->prev->type == CMARK_NODE_TEXT) {
-							    before_char = node->prev->as.literal.data[node->prev->as.literal.len - 1];
-						    } else if (node->prev->type == CMARK_NODE_SOFTBREAK ||
-							       node->prev->type == CMARK_NODE_LINEBREAK) {
-							    before_char = '\n';
-						    } else {
-							    before_char = 'x';
-						    }
+							if (node->prev->type == CMARK_NODE_TEXT) {
+								before_char = node->prev->as.literal.data[node->prev->as.literal.len - 1];
+							} else if (node->prev->type == CMARK_NODE_SOFTBREAK ||
+							           node->prev->type == CMARK_NODE_LINEBREAK) {
+								before_char = '\n';
+							} else {
+								before_char = 'x';
+							}
 						} else {
 							before_char = '\n';
 						}
@@ -254,14 +254,14 @@ S_render_node(cmark_node *node, cmark_event_type ev_type,
 					}
 					if (i >= lit.len - 1) {
 						if (node->next) {
-						    if (node->next->type == CMARK_NODE_TEXT) {
-							    after_char = node->next->as.literal.data[0];
-						    } else if (node->next->type == CMARK_NODE_SOFTBREAK ||
-							       node->next->type == CMARK_NODE_LINEBREAK) {
-							    before_char = '\n';
-						    } else {
-							    after_char = 'x';
-						    }
+							if (node->next->type == CMARK_NODE_TEXT) {
+								after_char = node->next->as.literal.data[0];
+							} else if (node->next->type == CMARK_NODE_SOFTBREAK ||
+							           node->next->type == CMARK_NODE_LINEBREAK) {
+								before_char = '\n';
+							} else {
+								after_char = 'x';
+							}
 						} else {
 							after_char = '\n';
 						}
@@ -269,13 +269,13 @@ S_render_node(cmark_node *node, cmark_event_type ev_type,
 						after_char = lit.data[i + 1];
 					}
 					left_flanking = !utf8proc_is_space(after_char) &&
-						!(utf8proc_is_punctuation(after_char) &&
-						  !utf8proc_is_space(before_char) &&
-						  !utf8proc_is_punctuation(before_char));
+					                !(utf8proc_is_punctuation(after_char) &&
+					                  !utf8proc_is_space(before_char) &&
+					                  !utf8proc_is_punctuation(before_char));
 					right_flanking = !utf8proc_is_space(before_char) &&
-						!(utf8proc_is_punctuation(before_char) &&
-						  !utf8proc_is_space(after_char) &&
-						  !utf8proc_is_punctuation(after_char));
+					                 !(utf8proc_is_punctuation(before_char) &&
+					                   !utf8proc_is_space(after_char) &&
+					                   !utf8proc_is_punctuation(after_char));
 				}
 				switch (lit.data[i]) {
 				case '"':
@@ -298,7 +298,7 @@ S_render_node(cmark_node *node, cmark_event_type ev_type,
 					if (i < lit.len - 1 && lit.data[i + 1] == '-') {
 						if (lit.data[i + 2] == '-') {
 							cmark_strbuf_puts(html,
-									  "&mdash;");
+							                  "&mdash;");
 							i += 3;
 						} else {
 							cmark_strbuf_puts(html, "&ndash;");
@@ -312,9 +312,9 @@ S_render_node(cmark_node *node, cmark_event_type ev_type,
 				case '.':
 					if (i < lit.len - 2 && lit.data[i + 1] == '.' &&
 					    lit.data[i + 2] == '.') {
-							cmark_strbuf_puts(html,
-									  "&hellip;");
-							i += 3;
+						cmark_strbuf_puts(html,
+						                  "&hellip;");
+						i += 3;
 					} else {
 						cmark_strbuf_putc(html, c);
 						i += 1;
@@ -327,11 +327,11 @@ S_render_node(cmark_node *node, cmark_event_type ev_type,
 				lastout = i;
 			}
 			escape_html(html, node->as.literal.data + lastout,
-				    i - lastout);
+			            i - lastout);
 
 		} else {
 			escape_html(html, node->as.literal.data,
-				    node->as.literal.len);
+			            node->as.literal.len);
 		}
 		break;
 
diff --git a/src/inlines.c b/src/inlines.c
@@ -279,13 +279,13 @@ scan_delims(subject* subj, unsigned char c, bool * can_open, bool * can_close)
 		after_char = 10;
 	}
 	left_flanking = numdelims > 0 && !utf8proc_is_space(after_char) &&
-	            !(utf8proc_is_punctuation(after_char) &&
-	              !utf8proc_is_space(before_char) &&
-	              !utf8proc_is_punctuation(before_char));
+	                !(utf8proc_is_punctuation(after_char) &&
+	                  !utf8proc_is_space(before_char) &&
+	                  !utf8proc_is_punctuation(before_char));
 	right_flanking = numdelims > 0 && !utf8proc_is_space(before_char) &&
-	             !(utf8proc_is_punctuation(before_char) &&
-	               !utf8proc_is_space(after_char) &&
-	               !utf8proc_is_punctuation(after_char));
+	                 !(utf8proc_is_punctuation(before_char) &&
+	                   !utf8proc_is_space(after_char) &&
+	                   !utf8proc_is_punctuation(after_char));
 	if (c == '_') {
 		*can_open = left_flanking && !right_flanking;
 		*can_close = right_flanking && !left_flanking;
diff --git a/src/node.c b/src/node.c
@@ -263,7 +263,8 @@ cmark_node_last_child(cmark_node *node)
 }
 
 void*
-cmark_node_get_user_data(cmark_node *node) {
+cmark_node_get_user_data(cmark_node *node)
+{
 	if (node == NULL) {
 		return NULL;
 	} else {
@@ -272,7 +273,8 @@ cmark_node_get_user_data(cmark_node *node) {
 }
 
 int
-cmark_node_set_user_data(cmark_node *node, void *user_data) {
+cmark_node_set_user_data(cmark_node *node, void *user_data)
+{
 	if (node == NULL) {
 		return 0;
 	}