Page MenuHomePhabricator

using nowiki to disable markup in a string property garbles factbox and inline query
Closed, DeclinedPublic

Description

Author: info

Description:
User Volker Wulf (in message "wikisyntax in text attribute") tried to disable parsing in string using <nowiki> tag and reported "funny characters when I ask".

I reproduced for Type:String. I found the annotation

[[String test::<nowiki>Don't parse this [[Test relation::Sandbox2]], what happens?]]
  • Displays the exact text in the page (good!).
  • Displays "UNIQ4771b2c964a25267-nowiki-0000001C-QINU" in inline queries.
  • Displays garbled wiki markup instead of the magnifying glass in the factbox (bad).

It was hard to get MediaWiki to parse wiki markup in strings for SMW 1.0, now it's hard to turn it off!

There's undoubtedly some tricky way to use markup or HTML to disable parsing but it won't be easy for naive users or automatically-generated semantic annotation to apply it.

SMW could provide a different datatype for unparsed text, e.g. Type:Unparsed_string, or a special Property:DontParse that you put on certain properties. Neither is attractive.


Version: unspecified
Severity: normal
URL: http://ontoworld.org/wiki/SMW_unit_test:Test_attributes#Disabling_markup

Details

Reference
bz13474

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:02 PM
bzimport set Reference to bz13474.

The problem here is once more the order of text processing in MediaWiki. MediaWiki strips out <nowiki>-blocks and inserts placeholder strings UNIQ... instead. It would be possible to expand the UNIQ... placeholders (and the MediaWiki parser does that later on anyway, which is why the page displays properly), but I think we cannot find out how the UNIQ... part was generated (i.e. the orignial user input is lost). Various tags are handled in a similar fashion, including HTML comments and <math> blocks.

It would also be hard to have a datatype for un-parsed strings, since MediaWiki parses (and escapes) strings before SMW even looks for annotations. The only option would be to hook into MediaWiki at some earlier stage, creating extra load and possibly breaking template compatibility.

I do not know how to solve that problem. But a simple workaround would be to omit <nowiki> and to use other escapes for wiki markup instead (e.g. by using hex encoding for "["). I agree that Type:Text should probably do something to expand UNIQ... before storing the result (but then how would we get that expanded text back into a wiki page, without having special markup escaped?).

At leat we now catch this case properly and raise a generic error. No more mess in Factbox or elsewhere.

This is causing problems for some work that I'm doing (I'd like to be able to put tag extensions in property values).

What's wrong with just expanding out the strip markers with $wgParser->unstripAll() in the assignment? Is Semantic MediaWiki supposed to store the original wikitext in the database, or the formatted HTML?

Aklapper closed this task as Declined.Mar 3 2015, 5:50 PM
Aklapper added a subscriber: Aklapper.

The Semantic MediaWiki developers requested in https://phabricator.wikimedia.org/T64114 to move their task tracking to https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues and to close remaining tasks in Wikimedia Phabricator. If you still face the problem reported in this task in a supported version of SMW, please feel free to transfer your report to https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues . We are sorry for the inconvenience.