Page MenuHomePhabricator

SMW removes namespace from pages with properties
Closed, ResolvedPublic

Description

Author: info

Description:
Annotating a link to a wiki page with a property should not change how it displays. But SMW 1.0pre-alpha3 doesn't display the namespace part of the page.

<nowiki>[[Help:PageName]]</nowiki> displays as Help:PageName,

but after annotation, <nowiki>[[MyRelation::Help:PageName]]</nowiki> displays in text (and the factbox, and query results) as just PageName without the "Help:" prefix.

In SMW 0.7, the same annotation displays in text and the factbox with the "Help:" prefix; it is only in query results that "Help:" does not appear.


Version: unspecified
Severity: minor
URL: http://ontoworld.org/wiki/SMW_unit_test:Test_relations#Prefix_on_linked_page

Details

Reference
bz11060

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:48 PM
bzimport set Reference to bz11060.

info wrote:

a) The namespace prefix vanishes in display because SMW_DV_WikiPage.php's getShortWikiText returns

[[:' . $this->m_prefixedtext . '|' . $this->m_caption . ']]';

The alternate text displayed is m_caption, which was set to $this->m_textform which was set to $this->m_title->getText() which doesn't include the namespace.

b) The namespace prefix vanishes in the factbox because it invokes getText() which calls getLongWikiText() which provides $this->m_textform as the alternate text.

Hiding the namespace in text and the factbox is misleading and a change from SMW 0.7. Hiding the namespace in query results is what SMW 0.7 did, but maybe it should be under user control.

Fixed. Datavalues of type page now behave as follows:

  • getShortWikiText uses the caption if given, and otherwise the full prefixed text.
  • getLongWikiText uses the abbreviated form without prefix whenever linking is active. If no link is created, then the full prefixed name is printed so that all information is always accessible.
  • same for the HTML versions

This behaviour is correct, but might be surprising for developers (since the "long text" in this particular case is actually shorter in most cases). It might be good to think of "long" as "Factboxversion" and of "short" as "inline version".

I also changed all query printers to use the "long" text in order to keep results concise.