Semanticmediawiki: Results of QueryProcessor functions are returning additional markup

Created on 22 Sep 2018  路  11Comments  路  Source: SemanticMediaWiki/SemanticMediaWiki

Setup and configuration

  • SMW version: 3.0.0-alpha
  • MW version: 1.31.1
  • PHP version: 7.0.30

Url: https://sandbox.semantic-mediawiki.org/wiki/Sp%C3%A9cial:AjouterDonn%C3%A9es/DemoAjax1
(need to be logged in)

it seems that some functions, from https://github.com/SemanticMediaWiki/SemanticFormsSelect/blob/master/src/ApiSemanticFormsSelectRequestProcessor.php

using QueryProcessor::getResultFromFunctionParams( $params, SMW_OUTPUT_WIKI ) seems it's returning results with html markup output.
I also tried another approach https://github.com/biocorecrg/SemanticFormsSelect/commit/ea367698762c027a3098c5d91e1758e31661006a with no luck.

It seems that MediaWiki backend is "cleaning" it somehow, but this is not happening at JavaScript level. I report it here just in case something is going on instead of trying to hack it first via JavaScript in that extension...

question

Most helpful comment

This basically means that SFS needs to be tweaked to use the plain format? Or does SWM need to be fluffed?

For example, DemoStatic [0] defines |{{{field|AllProtocols|input type=SF_Select|query=((Category:Protocol));format~list;sep~,;link~none;headers~hide;limit~500}}} with format~list so using format~plain (or format~plainlist) should produce a "plain" list without classes.

[0] https://sandbox.semantic-mediawiki.org/w/index.php?title=Formulaire:DemoStatic&action=edit

All 11 comments

Url: https://sandbox.semantic-mediawiki.org/wiki/Sp%C3%A9cial:AjouterDonn%C3%A9es/DemoAjax1
(need to be logged in)

For context:

image

I believe this relates to #2488 where the default list format outputs classes (independent of SMW_OUTPUT_WIKI) so you need to ensure to use the plain format.

See also https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues/2488#issuecomment-381405886.

@s7eph4n FYI

I believe this relates to #2488 where the default list format outputs classes (independent of SMW_OUTPUT_WIKI) so you need to ensure to use the plain format.

This basically means that SFS needs to be tweaked to use the plain format? Or does SWM need to be fluffed?

This basically means that SFS needs to be tweaked to use the plain format? Or does SWM need to be fluffed?

For example, DemoStatic [0] defines |{{{field|AllProtocols|input type=SF_Select|query=((Category:Protocol));format~list;sep~,;link~none;headers~hide;limit~500}}} with format~list so using format~plain (or format~plainlist) should produce a "plain" list without classes.

[0] https://sandbox.semantic-mediawiki.org/w/index.php?title=Formulaire:DemoStatic&action=edit

Admittedly I has been years since I last looked at this extension. Great. Thanks for the example. So this means that the documentation needs to be improved at SFS including probably a note in the RELEASE-NOTES.

@darenwelsh You are running into the same problem here [0] where {{#ask: [[Category:EVA skill]] [[Skill type::Cognitive skill]] |link=none|sep=,}} uses the normal list which (as outlined above) creates list items with classes, adding format=plain should fixed that.

image

[0] https://sandbox.semantic-mediawiki.org/wiki/Processing_Error_Test

Due to the polarity of this "issue" - I ran into this one too - being detected I explicitly added a prominent note to the RELEASE-NOTES about this breaking change.

@s7eph4n @kghbln @jamesmontalvo3 @darenwelsh Maybe discuss among yourselves the plain vs. list [0] default option when no format is given.

[0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/src/Query/ResultPrinters/ListResultPrinter/ListResultBuilder.php#L126-L138

To me it appears that we should go for "plain(list)" as default to allow for wider backwards compatibility. This is what we had the past 10+ year. People liking to apply further styling will naturally adopt "list" I believe.

It took me a minute to find the place where the default is determined [0].

[0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/includes/params/SMW_ParamFormat.php#L120-L125

Discussions should continue on #3472.

Was this page helpful?
0 / 5 - 0 ratings