Page MenuHomePhabricator

Allow Parser extensions to use tags with parameters
Closed, ResolvedPublic

Description

Author: david

Description:
Parser extensions (like <math>) should be able to be invoked with XML-like parameters. For example <math
param1="val">. Also, for the forthcoming phonetics parser extension, things like <phon encoding="ipa"
display="ipa,xsampa"> do tell the extension that the given phonetic data is in IPA encoding and should be rendered in IPA
encoding and X-SAMPA encoding.


Version: unspecified
Severity: enhancement
URL: http://www.nohat.net/phase3/index.php/Main_Page

Details

Reference
bz684

Revisions and Commits

Related Objects

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 7:00 PM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz684.
bzimport added a subscriber: Unknown Object (MLST).

david wrote:

Patch to allow Parser extensions to use tags with parameters

This is a patch that parses out parameters for tags and passes them to the
appropriate rendering function

attachment Parser.diff ignored as obsolete

david wrote:

Patch to allow Parser extensions to use tags with parameters

Fix from previous version of this patch which allows backslash-escaped quote
characters (\") inside of parameter values.

attachment Parser.php ignored as obsolete

david wrote:

Patch to allow Parser extensions to use tags with parameters

Oops. Last attachment was whole Parser.php file. This is just the diff.

attachment Parser.diff ignored as obsolete

david wrote:

Patch to allow Parser extensions to use tags with parameters

Uses same regexp for matching attributes in extractTagsAndParams as in
extractParams

attachment Parser.diff ignored as obsolete

david wrote:

This patch is installed on my test wiki at
http://www.nohat.net/phase3/index.php/Main_Page
It can be verified to be working correctly there.

david wrote:

Patch to allow Parser extensions to use tags with parameters

Change parameter name to match \w+ instead of [A-Za-z0-9_]+

attachment Parser.diff ignored as obsolete

david wrote:

Patch to allow Parser extensions to use tags with parameters

-u diff

attachment Parser.diff ignored as obsolete

david wrote:

nevermind the most recent patch. it's broken

david wrote:

Comment on attachment 94
Patch to allow Parser extensions to use tags with parameters

this is broken

david wrote:

New version of patch to allow extensions

this fixes a problem with the parameter matching regexp in strip()

attachment Parser.diff ignored as obsolete

david wrote:

This is now fully functional and succeeds the parser tests. Ready to be committed

david wrote:

Allow single or double quotes strings

Fix per Brion's suggestion to allow parameters of the form param="data" or
param='data' i.e. allow single or double quoted strings

Attached:

I'm wondering why the \" and \' thing? XML tags don't work that way and I'm reluctant to introduce a behavior that's likely to cause
inconsistency headaches.

Also, spaces between the opening < and the tag name should not be allowed; though that bug has existed before we should probably take it out.

  • Bug 1726 has been marked as a duplicate of this bug. ***

avarab wrote:

Well the alternative would be to allow something like urlencoding, i.e.
param="'%22'" instead of param="'\"'", I think the latter is easier to understand.

Why would we want to invent a new kind of encoding for XML attributes instead of the standard one? (&quot;)

avarab wrote:

(In reply to comment #12)

Created an attachment (id=96) [edit]
Allow single or double quotes strings

This fails on the current REL1_4 and HEAD (revisions 1.357 and 1.434)

Checked into CVS HEAD with modification: tag matching is done in the style we accept HTML
elements, and the attribute values are properly decoded to UTF-8 strings for internal use.

epriestley added a commit: Unknown Object (Diffusion Commit).Mar 4 2015, 8:14 AM