md_analyze_line: Simplify. Move some common code from multiple branches to one (and more appropriate) place.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
diff --git a/md4c/md4c.c b/md4c/md4c.c
index 4527242..2b171df 100644
--- a/md4c/md4c.c
+++ b/md4c/md4c.c
@@ -5493,6 +5493,15 @@ md_analyze_line(MD_CTX* ctx, OFF beg, OFF* p_end,
n_parents++;
}
+ if(off >= ctx->size || ISNEWLINE(off)) {
+ /* Blank line does not need any real indentation to be nested inside
+ * a list. */
+ if(n_brothers + n_children == 0) {
+ while(n_parents < ctx->n_containers && ctx->containers[n_parents].ch != _T('>'))
+ n_parents++;
+ }
+ }
+
redo:
/* Check whether we are fenced code continuation. */
if(pivot_line->type == MD_LINE_FENCEDCODE) {
@@ -5508,15 +5517,6 @@ redo:
}
}
- if(off >= ctx->size || ISNEWLINE(off)) {
- /* Blank line does not need any real indentation to be nested inside
- * a list. */
- if(n_brothers + n_children == 0) {
- while(n_parents < ctx->n_containers && ctx->containers[n_parents].ch != _T('>'))
- n_parents++;
- }
- }
-
/* Change indentation accordingly to the initial code fence. */
if(n_parents == ctx->n_containers) {
if(line->indent > pivot_line->indent)
@@ -5548,15 +5548,6 @@ redo:
}
}
- if(off >= ctx->size || ISNEWLINE(off)) {
- /* Blank line does not need any real indentation to be nested inside
- * a list. */
- if(n_brothers + n_children == 0) {
- while(n_parents < ctx->n_containers && ctx->containers[n_parents].ch != _T('>'))
- n_parents++;
- }
- }
-
if(n_parents == ctx->n_containers) {
line->type = MD_LINE_HTML;
goto done;
@@ -5565,13 +5556,6 @@ redo:
/* Check for blank line. */
if(off >= ctx->size || ISNEWLINE(off)) {
- /* Blank line does not need any real indentation to be nested inside
- * a list. */
- if(n_brothers + n_children == 0) {
- while(n_parents < ctx->n_containers && ctx->containers[n_parents].ch != _T('>'))
- n_parents++;
- }
-
if(pivot_line->type == MD_LINE_INDENTEDCODE && n_parents == ctx->n_containers) {
line->type = MD_LINE_INDENTEDCODE;
if(line->indent > ctx->code_indent_offset)