|
- name: empty
- label: sanity check that parsing an empty string yields nothing
- input: ""
- output: []
-
- ---
-
- name: template_argument_mix
- label: an ambiguous mix of templates and arguments
- input: "{{{{{{{{foo}}}}}}}}{{{{{{{bar}}baz}}}buz}}"
- output: [TemplateOpen(), ArgumentOpen(), ArgumentOpen(), Text(text="foo"), ArgumentClose(), ArgumentClose(), TemplateClose(), TemplateOpen(), ArgumentOpen(), TemplateOpen(), Text(text="bar"), TemplateClose(), Text(text="baz"), ArgumentClose(), Text(text="buz"), TemplateClose()]
-
- ---
-
- name: link_in_template_name
- label: a wikilink inside a template name, which breaks the template
- input: "{{foo[[bar]]}}"
- output: [Text(text="{{foo"), WikilinkOpen(), Text(text="bar"), WikilinkClose(), Text(text="}}")]
-
- ---
-
- name: rich_heading
- label: a heading with templates/wikilinks in it
- input: "== Head{{ing}} [[with]] {{{funky|{{stuf}}}}} =="
- output: [HeadingStart(level=2), Text(text=" Head"), TemplateOpen(), Text(text="ing"), TemplateClose(), Text(text=" "), WikilinkOpen(), Text(text="with"), WikilinkClose(), Text(text=" "), ArgumentOpen(), Text(text="funky"), ArgumentSeparator(), TemplateOpen(), Text(text="stuf"), TemplateClose(), ArgumentClose(), Text(text=" "), HeadingEnd()]
-
- ---
-
- name: html_entity_with_template
- label: a HTML entity with a template embedded inside
- input: "&n{{bs}}p;"
- output: [Text(text="&n"), TemplateOpen(), Text(text="bs"), TemplateClose(), Text(text="p;")]
-
- ---
-
- name: html_entity_with_comment
- label: a HTML entity with a comment embedded inside
- input: "&n<!--foo-->bsp;"
- output: [Text(text="&n"), CommentStart(), Text(text="foo"), CommentEnd(), Text(text="bsp;")]
-
- ---
-
- name: rich_tags
- label: a HTML tag with tons of other things in it
- input: "{{dubious claim}}<ref name={{abc}} foo="bar {{baz}}" abc={{de}}f ghi=j{{k}}{{l}} \n mno = "{{p}} [[q]] {{r}}">[[Source]]</ref>"
- output: [TemplateOpen(), Text(text="dubious claim"), TemplateClose(), TagOpenOpen(), Text(text="ref"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="name"), TagAttrEquals(), TemplateOpen(), Text(text="abc"), TemplateClose(), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="foo"), TagAttrEquals(), TagAttrQuote(char="\""), Text(text="bar "), TemplateOpen(), Text(text="baz"), TemplateClose(), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="abc"), TagAttrEquals(), TemplateOpen(), Text(text="de"), TemplateClose(), Text(text="f"), TagAttrStart(pad_first=" ", pad_before_eq="", pad_after_eq=""), Text(text="ghi"), TagAttrEquals(), Text(text="j"), TemplateOpen(), Text(text="k"), TemplateClose(), TemplateOpen(), Text(text="l"), TemplateClose(), TagAttrStart(pad_first=" \n ", pad_before_eq=" ", pad_after_eq=" "), Text(text="mno"), TagAttrEquals(), TagAttrQuote(char="\""), TemplateOpen(), Text(text="p"), TemplateClose(), Text(text=" "), WikilinkOpen(), Text(text="q"), WikilinkClose(), Text(text=" "), TemplateOpen(), Text(text="r"), TemplateClose(), TagCloseOpen(padding=""), WikilinkOpen(), Text(text="Source"), WikilinkClose(), TagOpenClose(), Text(text="ref"), TagCloseClose()]
-
- ---
-
- name: wildcard
- label: a wildcard assortment of various things
- input: "{{{{{{{{foo}}bar|baz=biz}}buzz}}usr|{{bin}}}}"
- output: [TemplateOpen(), TemplateOpen(), TemplateOpen(), TemplateOpen(), Text(text="foo"), TemplateClose(), Text(text="bar"), TemplateParamSeparator(), Text(text="baz"), TemplateParamEquals(), Text(text="biz"), TemplateClose(), Text(text="buzz"), TemplateClose(), Text(text="usr"), TemplateParamSeparator(), TemplateOpen(), Text(text="bin"), TemplateClose(), TemplateClose()]
-
- ---
-
- name: wildcard_redux
- label: an even wilder assortment of various things
- input: "{{a|b|{{c|[[d]]{{{e}}}}}}}[[f|{{{g}}}<!--h-->]]{{i|j= }}"
- output: [TemplateOpen(), Text(text="a"), TemplateParamSeparator(), Text(text="b"), TemplateParamSeparator(), TemplateOpen(), Text(text="c"), TemplateParamSeparator(), WikilinkOpen(), Text(text="d"), WikilinkClose(), ArgumentOpen(), Text(text="e"), ArgumentClose(), TemplateClose(), TemplateClose(), WikilinkOpen(), Text(text="f"), WikilinkSeparator(), ArgumentOpen(), Text(text="g"), ArgumentClose(), CommentStart(), Text(text="h"), CommentEnd(), WikilinkClose(), TemplateOpen(), Text(text="i"), TemplateParamSeparator(), Text(text="j"), TemplateParamEquals(), HTMLEntityStart(), Text(text="nbsp"), HTMLEntityEnd(), TemplateClose()]
-
- ---
-
- name: link_inside_dl
- label: an external link inside a def list, such that the external link is parsed
- input: ";;;mailto:example"
- output: [TagOpenOpen(wiki_markup=";"), Text(text="dt"), TagCloseSelfclose(), TagOpenOpen(wiki_markup=";"), Text(text="dt"), TagCloseSelfclose(), TagOpenOpen(wiki_markup=";"), Text(text="dt"), TagCloseSelfclose(), ExternalLinkOpen(brackets=False), Text(text="mailto:example"), ExternalLinkClose()]
-
- ---
-
- name: link_inside_dl_2
- label: an external link inside a def list, such that the external link is not parsed
- input: ";;;malito:example"
- output: [TagOpenOpen(wiki_markup=";"), Text(text="dt"), TagCloseSelfclose(), TagOpenOpen(wiki_markup=";"), Text(text="dt"), TagCloseSelfclose(), TagOpenOpen(wiki_markup=";"), Text(text="dt"), TagCloseSelfclose(), Text(text="malito"), TagOpenOpen(wiki_markup=":"), Text(text="dd"), TagCloseSelfclose(), Text(text="example")]
-
- ---
-
- name: link_inside_template
- label: an external link nested inside a template, before the end
- input: "{{URL|http://example.com}}"
- output: [TemplateOpen(), Text(text="URL"), TemplateParamSeparator(), ExternalLinkOpen(brackets=False), Text(text="http://example.com"), ExternalLinkClose(), TemplateClose()]
-
- ---
-
- name: link_inside_template_2
- label: an external link nested inside a template, before a separator
- input: "{{URL|http://example.com|foobar}}"
- output: [TemplateOpen(), Text(text="URL"), TemplateParamSeparator(), ExternalLinkOpen(brackets=False), Text(text="http://example.com"), ExternalLinkClose(), TemplateParamSeparator(), Text(text="foobar"), TemplateClose()]
-
- ---
-
- name: link_inside_template_3
- label: an external link nested inside a template, before an equal sign
- input: "{{URL|http://example.com=foobar}}"
- output: [TemplateOpen(), Text(text="URL"), TemplateParamSeparator(), ExternalLinkOpen(brackets=False), Text(text="http://example.com"), ExternalLinkClose(), TemplateParamEquals(), Text(text="foobar"), TemplateClose()]
-
- ---
-
- name: link_inside_argument
- label: an external link nested inside an argument
- input: "{{{URL|http://example.com}}}"
- output: [ArgumentOpen(), Text(text="URL"), ArgumentSeparator(), ExternalLinkOpen(brackets=False), Text(text="http://example.com"), ExternalLinkClose(), ArgumentClose()]
-
- ---
-
- name: link_inside_heading
- label: an external link nested inside a heading
- input: "==http://example.com=="
- output: [HeadingStart(level=2), ExternalLinkOpen(brackets=False), Text(text="http://example.com"), ExternalLinkClose(), HeadingEnd()]
-
- ---
-
- name: link_inside_tag_body
- label: an external link nested inside the body of a tag
- input: "<ref>http://example.com</ref>"
- output: [TagOpenOpen(), Text(text="ref"), TagCloseOpen(padding=""), ExternalLinkOpen(brackets=False), Text(text="http://example.com"), ExternalLinkClose(), TagOpenClose(), Text(text="ref"), TagCloseClose()]
-
- ---
-
- name: link_inside_tag_style
- label: an external link nested inside style tags
- input: "''http://example.com''"
- output: [TagOpenOpen(wiki_markup="''"), Text(text="i"), TagCloseOpen(), ExternalLinkOpen(brackets=False), Text(text="http://example.com"), ExternalLinkClose(), TagOpenClose(), Text(text="i"), TagCloseClose()]
-
- ---
-
- name: style_tag_inside_link
- label: style tags disrupting an external link
- input: "http://example.com/foo''bar''"
- output: [ExternalLinkOpen(brackets=False), Text(text="http://example.com/foo"), ExternalLinkClose(), TagOpenOpen(wiki_markup="''"), Text(text="i"), TagCloseOpen(), Text(text="bar"), TagOpenClose(), Text(text="i"), TagCloseClose()]
-
- ---
-
- name: comment_inside_link
- label: an HTML comment inside an external link
- input: "http://example.com/foo<!--comment-->bar"
- output: [ExternalLinkOpen(brackets=False), Text(text="http://example.com/foo"), CommentStart(), Text(text="comment"), CommentEnd(), Text(text="bar"), ExternalLinkClose()]
-
- ---
-
- name: bracketed_link_inside_template
- label: a bracketed external link nested inside a template, before the end
- input: "{{URL|[http://example.com}}]"
- output: [Text(text="{{URL|"), ExternalLinkOpen(brackets=True), Text(text="http://example.com}}"), ExternalLinkClose()]
-
-
- ---
-
- name: comment_inside_bracketed_link
- label: an HTML comment inside a bracketed external link
- input: "[http://example.com/foo<!--comment-->bar]"
- output: [ExternalLinkOpen(brackets=True), Text(text="http://example.com/foo"), CommentStart(), Text(text="comment"), CommentEnd(), Text(text="bar"), ExternalLinkClose()]
-
- ---
-
- name: wikilink_inside_external_link
- label: a wikilink inside an external link, which the parser considers valid (see issue #61)
- input: "[http://example.com/foo Foo [[Bar]]]"
- output: [ExternalLinkOpen(brackets=True), Text(text="http://example.com/foo"), ExternalLinkSeparator(), Text(text="Foo "), WikilinkOpen(), Text(text="Bar"), WikilinkClose(), ExternalLinkClose()]
-
- ---
-
- name: external_link_inside_wikilink
- label: an external link inside a wikilink, valid in the case of images (see issue #62)
- input: "[[File:Example.png|thumb|http://example.com]]"
- output: [WikilinkOpen(), Text(text="File:Example.png"), WikilinkSeparator(), Text(text="thumb|"), ExternalLinkOpen(brackets=False), Text(text="http://example.com"), ExternalLinkClose(), WikilinkClose()]
-
- ---
-
- name: external_link_inside_wikilink_brackets
- label: an external link with brackets inside a wikilink
- input: "[[File:Example.png|thumb|[http://example.com Example]]]"
- output: [WikilinkOpen(), Text(text="File:Example.png"), WikilinkSeparator(), Text(text="thumb|"), ExternalLinkOpen(brackets=True), Text(text="http://example.com"), ExternalLinkSeparator(), Text(text="Example"), ExternalLinkClose(), WikilinkClose()]
-
- ---
-
- name: external_link_inside_wikilink_title
- label: an external link inside a wikilink title, which is invalid
- input: "[[File:Example.png http://example.com]]"
- output: [WikilinkOpen(), Text(text="File:Example.png http://example.com"), WikilinkClose()]
-
- ---
-
- name: italics_inside_external_link_inside_incomplete_list
- label: italic text inside an external link inside an incomplete list
- input: "<li>[http://www.example.com ''example'']"
- output: [TagOpenOpen(), Text(text="li"), TagCloseSelfclose(padding="", implicit=True), ExternalLinkOpen(brackets=True), Text(text="http://www.example.com"), ExternalLinkSeparator(), TagOpenOpen(wiki_markup="''"), Text(text="i"), TagCloseOpen(), Text(text="example"), TagOpenClose(), Text(text="i"), TagCloseClose(), ExternalLinkClose()]
-
- ---
-
- name: nodes_inside_external_link_after_punct
- label: various complex nodes inside an external link following punctuation
- input: "http://example.com/foo.{{bar}}baz.&biz;<!--hello-->bingo"
- output: [ExternalLinkOpen(brackets=False), Text(text="http://example.com/foo."), TemplateOpen(), Text(text="bar"), TemplateClose(), Text(text="baz.&biz;"), CommentStart(), Text(text="hello"), CommentEnd(), Text(text="bingo"), ExternalLinkClose()]
-
- ---
-
- name: newline_and_comment_in_template_name
- label: a template name containing a newline followed by a comment
- input: "{{foobar\n<!-- comment -->}}"
- output: [TemplateOpen(), Text(text="foobar\n"), CommentStart(), Text(text=" comment "), CommentEnd(), TemplateClose()]
-
- ---
-
- name: newline_and_comment_in_template_name_2
- label: a template name containing a newline followed by a comment
- input: "{{foobar\n<!-- comment -->|key=value}}"
- output: [TemplateOpen(), Text(text="foobar\n"), CommentStart(), Text(text=" comment "), CommentEnd(), TemplateParamSeparator(), Text(text="key"), TemplateParamEquals(), Text(text="value"), TemplateClose()]
-
- ---
-
- name: newline_and_comment_in_template_name_3
- label: a template name containing a newline followed by a comment
- input: "{{foobar\n<!-- comment -->\n|key=value}}"
- output: [TemplateOpen(), Text(text="foobar\n"), CommentStart(), Text(text=" comment "), CommentEnd(), Text(text="\n"), TemplateParamSeparator(), Text(text="key"), TemplateParamEquals(), Text(text="value"), TemplateClose()]
-
- ---
-
- name: newline_and_comment_in_template_name_4
- label: a template name containing a newline followed by a comment
- input: "{{foobar\n<!-- comment -->invalid|key=value}}"
- output: [Text(text="{{foobar\n"), CommentStart(), Text(text=" comment "), CommentEnd(), Text(text="invalid|key=value}}")]
-
- ---
-
- name: newline_and_comment_in_template_name_5
- label: a template name containing a newline followed by a comment
- input: "{{foobar\n<!-- comment -->\ninvalid|key=value}}"
- output: [Text(text="{{foobar\n"), CommentStart(), Text(text=" comment "), CommentEnd(), Text(text="\ninvalid|key=value}}")]
|