Browse Source

Recover failing contexts when due to a template or link opening.

tags/v0.2
Ben Kurtovic 12 years ago
parent
commit
087d606097
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      mwparserfromhell/parser/tokenizer.c

+ 6
- 1
mwparserfromhell/parser/tokenizer.c View File

@@ -1124,7 +1124,8 @@ Tokenizer_parse(Tokenizer* self, int context)


if (this_context & unsafe_contexts) { if (this_context & unsafe_contexts) {
Tokenizer_verify_safe(self, this_context, this_data); Tokenizer_verify_safe(self, this_context, this_data);
if (BAD_ROUTE) return NULL;
if (BAD_ROUTE)
return NULL;
} }


is_marker = 0; is_marker = 0;
@@ -1165,6 +1166,8 @@ Tokenizer_parse(Tokenizer* self, int context)
else if (this_data == next && next == *"{") { else if (this_data == next && next == *"{") {
if (Tokenizer_parse_template_or_argument(self)) if (Tokenizer_parse_template_or_argument(self))
return NULL; return NULL;
if (self->topstack->context & LC_FAIL_NEXT)
self->topstack->context ^= LC_FAIL_NEXT;
} }
else if (this_data == *"|" && this_context & LC_TEMPLATE) { else if (this_data == *"|" && this_context & LC_TEMPLATE) {
if (Tokenizer_handle_template_param(self)) if (Tokenizer_handle_template_param(self))
@@ -1191,6 +1194,8 @@ Tokenizer_parse(Tokenizer* self, int context)
if (!(this_context & LC_WIKILINK_TITLE)) { if (!(this_context & LC_WIKILINK_TITLE)) {
if (Tokenizer_parse_wikilink(self)) if (Tokenizer_parse_wikilink(self))
return NULL; return NULL;
if (self->topstack->context & LC_FAIL_NEXT)
self->topstack->context ^= LC_FAIL_NEXT;
} }
else { else {
Tokenizer_write_text(self, this_data); Tokenizer_write_text(self, this_data);


Loading…
Cancel
Save