temp_char = text_inside_pair(source, next);
if (temp_char[0] == '\0') {
- // Empty label, use first bracket
+ // Empty label, use first bracket (e.g. implicit link `[foo][]`)
free(temp_char);
temp_char = text_inside_pair(source, bracket);
}
} else {
+ // This may be a simplified implicit link, e.g. `[foo]`
+
+ // But not if it's nested brackets, since it would not
+ // end up being a valid reference
+ token * walker = bracket->child;
+ while (walker) {
+ switch (walker->type) {
+ case PAIR_BRACKET:
+ case PAIR_BRACKET_CITATION:
+ case PAIR_BRACKET_FOOTNOTE:
+ case PAIR_BRACKET_VARIABLE:
+ *final_link = NULL;
+ return;
+ }
+
+ walker = walker->next;
+ }
+
temp_char = text_inside_pair(source, bracket);
// Don't skip tokens
temp_short = 0;
# Nested brackets
-# TODO: Performance hit between 1000 and 10,000 iterations
-# Checking each level to see if it's a valid link on the stack
-# seq -s " " -f "[" $X > path9.text
-# echo -n "a" >> path9.text
-# seq -s " " -f "]" $X >> path9.text
-#
-# echo -n "<p>" > path9.html
-# seq -s " " -f "[" $X >> path9.html
-# echo -n "a" >> path9.html
-# seq -s " " -f "]" $Y >> path9.html
-# echo "]</p>" >> path9.html
+seq -s " " -f "[" $X > path9.text
+echo -n "a" >> path9.text
+seq -s " " -f "]" $X >> path9.text
+
+echo -n "<p>" > path9.html
+seq -s " " -f "[" $X >> path9.html
+echo -n "a" >> path9.html
+seq -s " " -f "]" $Y >> path9.html
+echo "]</p>" >> path9.html
# Nested block quotes