Last modified: 2012-05-19 12:39:45 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T38853, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 36853 - Building AST from simple wikitext throws errors in 'mediawiki.jqueryMsg' module
Building AST from simple wikitext throws errors in 'mediawiki.jqueryMsg' module
Status: RESOLVED WORKSFORME
Product: MediaWiki
Classification: Unclassified
JavaScript (Other open bugs)
1.20.x
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-15 07:38 UTC by Dmitriy Sintsov
Modified: 2012-05-19 12:39 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Dmitriy Sintsov 2012-05-15 07:38:06 UTC
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.
Comment 1 Dmitriy Sintsov 2012-05-15 07:41:05 UTC
Sorry - seems to got confused with markup, tpl:a is not valid name. Builds AST tree with the following wikitext just file:

a[[link]]1
{{tpl|a|b}} asdf|ghij

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links