]> git.wincent.com - wikitext.git/commitdiff
Fix another token-dropping bug
authorWincent Colaiuta <win@wincent.com>
Sat, 6 Nov 2010 00:07:05 +0000 (01:07 +0100)
committerWincent Colaiuta <win@wincent.com>
Sat, 6 Nov 2010 00:07:05 +0000 (01:07 +0100)
Signed-off-by: Wincent Colaiuta <win@wincent.com>
ext/parser.c
spec/regressions_spec.rb

index 6b7c58e64d06ccbbe77ec590d91afc62f54d3610..9a9c968920d4b450b51ef04c5d3454b314aeb93c 100644 (file)
@@ -2011,6 +2011,7 @@ VALUE Wikitext_parser_parse(int argc, VALUE *argv, VALUE self)
                             wiki_start_para_if_necessary(parser);
                             str_append(parser->output, ext_link_start, sizeof(ext_link_start) - 1);
                             wiki_append_hyperlink(parser, Qnil, token_str, NULL, parser->external_link_class, parser->external_link_rel, true);
+                            continue;
                         }
                     }
                     else
index edbe28ab0fa8a66f274fd150edff3a820f7a91c3..6ba4860d4fe44f5a7e7186113ce9f64ab9f18b9e 100644 (file)
@@ -881,4 +881,13 @@ describe Wikitext::Parser, 'regressions' do
     # related example from the original ticket: https://wincent.com/issues/1726
     @parser.parse('[/bar?baz=bat link]').should == "<p>[/bar?baz=bat link]</p>\n"
   end
+
+  it 'handles "[http://foo.com]"' do
+    # Same bug as above, but with a EXT_LINK_START + URI rather than
+    # EXT_LINK_START + PATH; again we expect to see a SPACE, but when we
+    # see something else, we roll back and drop the unexpected token on
+    # the floor.
+    expected = %Q{<p>[<a href="http://foo.com" class="external">http://foo.com</a>]</p>\n}
+    @parser.parse('[http://foo.com]').should == expected
+  end
 end