https://bugzilla.wikimedia.org/show_bug.cgi?id=36853
Web browser: ---
Bug #: 36853
Summary: Building AST from simple wikitext throws errors in
'mediawiki.jqueryMsg' module
Product: MediaWiki
Version: 1.20-git
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: Unprioritized
Component: ResourceLoader
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected],
[email protected]
Classification: Unclassified
Mobile Platform: ---
In my extension, I have implemented server-side parser function which also has
client-side "parser function editor" implemented as ResourceLoader module.
In that module user may input wikitext of single parser function's parameter
into form field and then the source wikitext of the whole parser function is
displayed (so it can be copy/pasted into actual page).
There is one problem, function has unnamed parameters and when the user places
pipe character "|" into the input field, it starts new parameter instead of
becoming part of the single parameter's text, which breaks editor logic.
I cannot simply escape all occurencies of "|" as entity | because it would
break wikilinks [[|]] and template parameters {{|}}. So I have to parse the
wikitext somewhat and replace only non-lexical "|" to |.
I am trying to use 'mediawiki.jqueryMsg' module in the following way:
var parser = new mw.jqueryMsg.parser();
var ast = parser.wikiTextToAst( text );
However, even for very simple and valid wikitext like this:
a[[link]]1
{{tpl:a|b}} asdf|ghij
it throws an errors:
Uncaught Error: Parse error at position 11 in input: a[[link]]1
{{#tpl:a|b}} asdf|ghij
/resources/mediawiki/mediawiki.jqueryMsg.js:502
I wanted to build AST tree then expected to rebuild wikitext recursively with
espaced pipe characters only in 'CONCAT' nodes. Is that possible? I do not need
html output.
I am developing for 1.18, when encountered this error tried 1.20 master,
however the problem still exists.
--
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l