wiki.techinc.nl/tests/phpunit/includes/parser
Bartosz Dziewoński f7158c396d Add markup to page titles to distinguish the namespace and the main text
Pages outside of the main namespace now have the following markup in
their <h1> page titles, using 'Talk:Hello' as an example:

<h1>
  <span class="mw-page-title-namespace">Talk</span>
  <span class="mw-page-title-separator">:</span>
  <span class="mw-page-title-main">Hello</span>
</h1>
(line breaks and spaces added for readability)

Pages in the main namespace only have the last part, e.g. for 'Hello':

<h1>
  <span class="mw-page-title-main">Hello</span>
</h1>

The change is motivated by a desire to style the titles differently on
talk pages in the DiscussionTools extension (T313636), but it could
also be used for other things:
* Language-specific tweaks (e.g. adding typographically-correct spaces
  around the colon separator: T249149, or replacing it with a
  different character: T36295)
* Site-specific tweaks (e.g. de-emphasize or emphasize specific
  namespaces like 'Draft': T62973 / T236215)

The markup is also added to automatically language-converted titles.

It is not added when the title is overridden using the wikitext
`{{DISPLAYTITLE:…}}` or `-{T|…}-` forms. I think this is a small
limitation, as those forms mostly used in the main namespace, where
the extra markup isn't very helpful anyway. This may be improved in
the future. As a workaround, users could also just add the same HTML
markup to their wikitext (as those forms accept it).

It is not also added when the title is overridden by an extension
like Translate. Maybe we'll have a better API before anyone wants
to do that. If not, one could un-mark Parser::formatPageTitle()
as @internal, and use that method to add the markup themselves.

Bug: T306440
Change-Id: I62b17ef22de3606d736e6c261e542a34b58b5a05
2022-08-16 23:36:21 +00:00
..
CacheTimeTest.php Migrate from setMwGlobals() to overrideConfigValue(s) 2022-08-02 10:14:10 +01:00
CoreParserFunctionsTest.php phpunit: use ->getServiceContainer() in integration tests 2022-01-27 22:04:16 +01:00
LinkHolderArrayIntegrationTest.php Migrate from setMwGlobals() to overrideConfigValue(s) 2022-08-02 10:14:10 +01:00
MagicVariableTest.php tests: Use Title::makeTitle instead of Title::newFromText 2022-07-06 00:44:00 +02:00
PageBundleJsonTraitTest.php Introduce PageBundleJsonTrait for serialization 2022-05-23 17:54:48 +01:00
ParserCacheSerializationTestCases.php Clarify generate-html and make ParserOutput behave as expected 2022-05-03 11:23:08 +02:00
ParserCacheTest.php parser: Mock WikiPage::getContentModel in ParserCacheTest to fix php8.1 2022-07-25 20:51:51 +00:00
ParserMethodsTest.php Add markup to page titles to distinguish the namespace and the main text 2022-08-16 23:36:21 +00:00
ParserOptionsTest.php Migrate from setMwGlobals() to overrideConfigValue(s) 2022-08-02 10:14:10 +01:00
ParserOutputTest.php parser: Prepare to use a <meta> tag for the internal TOC_PLACEHOLDER 2022-08-15 18:54:52 -04:00
ParserPreloadTest.php tests: Use Title::makeTitle instead of Title::newFromText 2022-07-06 00:44:00 +02:00
ParserTest.php Tests: Cleanup some unnecessary nested function calls 2022-06-06 01:02:34 +01:00
PreprocessorTest.php Replace trivial usa of mock builder with createMock() shortcut 2022-07-15 16:43:48 +00:00
RevisionOutputCacheTest.php Replace deprecated calls ParserOptions::newCanonical( 'canonical' ) 2022-06-16 14:22:24 +01:00
SanitizerTest.php Migrate from setMwGlobals() to overrideConfigValue(s) 2022-08-02 10:14:10 +01:00
StripStateTest.php build: Updating dependencies 2021-07-22 03:36:05 +00:00
TagHooksTest.php tests: Use Title::makeTitle instead of Title::newFromText 2022-07-06 00:44:00 +02:00
validateParserCacheSerializationTestData.php Hard-deprecate all public property access on CacheTime and ParserOutput. 2021-10-13 13:27:16 -04:00