Page MenuHomePhabricator

Separator between list items in queries cannot be changed (patch attached)
Closed, DeclinedPublic

Description

Author: mail

Description:
Patch (against SMW 1.5.0) that introduces a query parameter "recordsep", which can be set to ";_" or "<br />", etc.

It would sometimes be helpful to change the separator between record items, especially when post-processing query results in a template. The default comma is likely to appear in the actually query results as payload, and can thus not be used to determine where one record item ends, and where the next one appears.


Version: unspecified
Severity: enhancement

attachment SMW_recordsep.patch ignored as obsolete

Details

Reference
bz22777

Event Timeline

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

I first thought that this request is about Type:Record, but it actually is about multiple items in a list. The name of the parameter should really be changed now that this type is available in SMW. Part of what you suggest has been planned for some time now: ?printouts can now have parameters like "limit" and one could have a parameter "sep" for printouts to define how they separate their items. Unfortunately, this would need to be taken into account individually in all printouts since it is hard to unify the code.

Now for lists, there is a second type of "," separator: the one that is used between the results generated by each printout. Unfortunately, both separators are unified in the current code, but they are logically not the same. I think this latter kind of separator is closer to the parameter you suggest.

I wonder if it is good to have the "( ... )" if a separator is set. Or should the display just be of the form:

<1st column> <your-sep> <2nd column> <your-sep> ... <your-sep> <last-column>

Where the column text is the property name (unless disabled), and the list of values possibly with another custom separator in between. So the default "( ... )" would go away in this case, and the whole format would look more like a table.

mail wrote:

It seems I was confused about "records" and "record elements in a list" - "recordsep" is definitely not a good name for the kind of separator I was talking about. "elementsep" or "itemsep" would probably be better.

I'll attach a patch against current SVN head, where the parameter is renamed to 'itemsep'.

Here is a live example: http://patrick-nagel.net/wiki/Contact_example

mail wrote:

Patch (against SMW 1.5.3) that introduces a query parameter "itemsep", which can be set to ";_" or "<br />", etc.

Attached:

Patch looks ok to me, although it seems some stuff there rally should be arrays that get imploded instead of string concats with if(isFirstItem) stuff.

Part of what you suggest hascbeen planned for some time now: ?printouts can now have parameters like "limit"cand one could have a parameter "sep" for printouts to define how they separate their items.

Has this actually been implemented? And if so, where are the docs?

Aklapper subscribed.

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.