Page MenuHomePhabricator

Create tests for subpage support
Closed, ResolvedPublic


The 'subpage' option in parserTests is supposed to turn on subpage support.
(which is a wiki config thing?)

But parsoid always enables subpage support; that is, /foo will always
link to [[Parent/foo]], not an article titled '/foo'.

We should make that a wiki config option, fetch it via the API, and only resolve subpages if it is turned on. [We could also make the 'subpage' option in parserTests work properly then.]

Version: unspecified
Severity: normal



Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 1:30 AM
bzimport added a project: Parsoid.
bzimport set Reference to bz47136.

Related URL: (Gerrit Change Ia6a72c05e9aafb14753271bcdb1fab023cf9e3ca) (Gerrit Change Ia6a72c05e9aafb14753271bcdb1fab023cf9e3ca) | change APPROVED and MERGED [by GWicke]

Confirming, keywording ('easy' on a whim)

It seems that the API does not expose this configuration option yet in the 'general' section, so we'll have to add it in MediaWiki core. The Parsoid side of the implementation should be fairly straightforward once the configuration information is in See comment in the patch linked above.

The PHP implementation of the 'general' section is in includes/api/ApiQuerySiteinfo.php. The config variable to expose is$wgNamespacesWithSubpages#Enabling_for_a_namespace. Subpages can be enabled or disabled per namespace, so an array of numeric namespace ids for which subpages are enabled probably makes most sense for the API. There are some other arrays in ApiQuerySiteinfo (see appendFileExtensions for example) that can be used as a template.

Example general section for the English Wikipedia (hit 'Make request' and scroll down to see the JSON):

Related URL: (Gerrit Change If34d272b45cf986265a6d3d2d67d465d84ae117a)

Related URL: (Gerrit Change Ibf7110fb934e2219210abf2351b17d68e55f296e)

Related URL: (Gerrit Change I055c451685d98f3951472677e745b9e077970c21)

The patch landed, but I think support for the 'subpage' option in parserTests did not, as no additional tests pass with gerrit #59929.

See the section flagged with "### Subpages" in tests/parserTests.txt.

Changed the subject to reflect that only the tests are missing.

[Parsoid component reorg by merging JS/General and General. See bug 50685 for more information. Filter bugmail on this comment. parsoidreorg20130704]