Skip to content

Apostrophe adjacent to italics gets misparsed as start of bold #353

Description

@roysmith

I'm not sure what the correct behavior is supposed to be, but mwp is certainly producing something different from what parsoid does.

I'm trying to parse [[WP:FAC]] nomination pages, looking for "oppose" in bold. The gist of the logic is (paraphrasing):

    for t in self.wikicode.filter_text():
        if "oppose" in t.value.lower() and self._isbold(t):

def _isbold(self, node: Node) -> bool:
    "Return True if node is a bit of bolded text"
    parent = self.wikicode.get_parent(node)
    return isinstance(parent, Tag) and parent.tag == "b"

When run on https://en.wikipedia.org/w/index.php?title=Wikipedia:Featured_article_candidates/Nile/archive1&oldid=1346716243, the get_parent() call goes all the way back to

'''s "Nile" article has probably been re-written by the co-authors.

which is from:

Although he has been dead for 48 years, so some of the ''Britannica'''s "Nile" article has probably been re-written by the co-authors.

Parsoid (I think correctly) figures out that the three trailing quotes in ''Britannica'''s should be parsed as two quotes to end the italics then the third quote as just a piece of text:

Although he has been dead for 48 years, so some of the <i>Britannica'</i>s "Nile" article has probably been re-written by the co-authors.

MWP, however seems to treat it as an unterminated start-italics followed by an unterminated start-bold. This looks like it's related to, but not quite the same as, the "When different syntax elements cross over each other" situation described at https://mwparserfromhell.readthedocs.io/en/latest/limitations.html

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions