Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wikitext.parseTemplates() doesn't properly handle usage of | in values #87

Open
Retrocast opened this issue Feb 8, 2025 · 0 comments
Open

Comments

@Retrocast
Copy link

This wikitext is correctly parsed on wiki (image1 is a proper gallery element):

{{Card
|title1=Squirrel
|image1=
<gallery>
Squirrel.png | Act I
Gbc squirrel.png | Act II
</gallery>
|cost=Free
|health=1
|power=0
|tribe=[[:Category:Squirrel|Squirrel]]
}}

But parseTemplates incorrectly parses it as bunch of positional parameters instead:

Template {
  wikitext: '...',
  parameters: [
    Parameter {
      name: 'title1',
      value: 'Squirrel',
      wikitext: '|title1=Squirrel\n'
    },
    Parameter {
      name: 'image1',
      value: '<gallery>\nSquirrel.png',
      wikitext: '|image1=\n<gallery>\nSquirrel.png '
    },
    Parameter {
      name: 1,
      value: 'Act I\nGbc squirrel.png',
      wikitext: '| Act I\nGbc squirrel.png '
    },
    Parameter {
      name: 2,
      value: 'Act II\n</gallery>',
      wikitext: '| Act II\n</gallery>\n'
    },
    Parameter { name: 'cost', value: 'Free', wikitext: '|cost=Free\n' },
    Parameter { name: 'health', value: '1', wikitext: '|health=1\n' },
    Parameter { name: 'power', value: '0', wikitext: '|power=0\n' },
    Parameter {
      name: 'tribe',
      value: '[[:Category:Squirrel|Squirrel]]',
      wikitext: '|tribe=[[:Category:Squirrel|Squirrel]]\n'
    }
  ],
  name: 'Card'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant