Page MenuHomePhabricator

Lemmas widget: HTML validity
Closed, ResolvedPublic3 Story Points

Description

The HTML structure of lexeme pages should contais only well-organized elements. Mediawiki provides us with a skeleton for most parts of the page. Amongst these is an HTML element for the primary title of a page, .firstHeading - being an h1 tag. Currently the lexeme page provides another h1 with invalid mark-up (not only phrasing content).

AC

  • the default mediawiki h1 contains all lemmas, well marked-up including language and directionality
  • the default mediawiki h1 is not visible
  • #wb-lexeme-header-lemmas uses a div instead of an h1 tag

Info

  • this was researched in T199081 - see when addressing the rendering of the lemmas into the default mediawiki h1
  • spike at https://gerrit.wikimedia.org/r/456571
  • The h1 in the Lexeme header also causes some styles to be applied (e.g. serif font) which will be resolved this way
  • lemma hyphenation is addressed in T203242

Event Timeline

abian created this task.Jun 2 2018, 3:05 PM
Restricted Application added a project: Wikidata. · View Herald TranscriptJun 2 2018, 3:05 PM
Pablo-WMDE updated the task description. (Show Details)Jun 20 2018, 12:10 PM
Vvjjkkii renamed this task from h1 should only contain phrasing content in Wikidata lexeme pages to jsbaaaaaaa.Jul 1 2018, 1:06 AM
Vvjjkkii triaged this task as High priority.
Vvjjkkii updated the task description. (Show Details)
CommunityTechBot renamed this task from jsbaaaaaaa to h1 should only contain phrasing content in Wikidata lexeme pages.Jul 2 2018, 1:10 AM
CommunityTechBot raised the priority of this task from High to Needs Triage.
CommunityTechBot updated the task description. (Show Details)
Pablo-WMDE renamed this task from h1 should only contain phrasing content in Wikidata lexeme pages to Lemmas widget: HTML validity.Aug 31 2018, 12:19 PM
Pablo-WMDE updated the task description. (Show Details)
Pablo-WMDE added a subscriber: Pablo-WMDE.

Change 456571 had a related patch set uploaded (by Pablo Grass (WMDE); owner: Pablo Grass (WMDE)):
[mediawiki/extensions/WikibaseLexeme@master] LexemeView: no h1 for lexeme header

https://gerrit.wikimedia.org/r/456571

Pablo-WMDE updated the task description. (Show Details)Aug 31 2018, 1:10 PM
KaMan added a subscriber: KaMan.Sep 4 2018, 8:39 AM

I'm not sure if this is related but there is another report about html of h1 and perhaps it can be solved together: https://www.wikidata.org/w/index.php?title=Wikidata_talk:Lexicographical_data&oldid=739634790#HTML_language_tags

@KaMan It will be, that's what the first AC is about. Thanks for the pointer.

To make the "default mediawiki h1 contains all lemmas" we'll drop htmlTermRenderer and getMainTerm() from LexemeView and the logic in LexemeLinkFormatter::getLemmaHtml() will be exposed so that it can be used instead to render all lemmas and their correct attributes into it.

Change 456571 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] LexemeView: no h1 for lexeme header

https://gerrit.wikimedia.org/r/456571

Change 458493 had a related patch set uploaded (by Pablo Grass (WMDE); owner: Pablo Grass (WMDE)):
[mediawiki/extensions/WikibaseLexeme@master] LexemeView: no h1 for lexeme header

https://gerrit.wikimedia.org/r/458493

Change 458505 had a related patch set uploaded (by Jakob; owner: Jakob):
[mediawiki/extensions/WikibaseLexeme@master] Render all lemmas in lexeme page h1

https://gerrit.wikimedia.org/r/458505

Change 458493 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] LexemeView: no h1 for lexeme header

https://gerrit.wikimedia.org/r/458493

Tarrow added a subscriber: Tarrow.Sep 10 2018, 10:43 AM

The failing browser test of https://gerrit.wikimedia.org/r/c/mediawiki/extensions/WikibaseLexeme/+/458505 does seem to be a real problem:

Stack Trace from Special recent changes.

[c9365c8e6c9f4fb89869aeb5] /mediawiki/index.php?title=Special:RecentChanges TypeError from line 49 of /var/www/mediawiki/extensions/WikibaseLexeme/src/Hooks/Formatters/LexemeLinkFormatter.php: Argument 4 passed to Wikibase\Lexeme\Hooks\Formatters\LexemeLinkFormatter::__construct() must be an instance of Language, instance of RequestContext given, called in /var/www/mediawiki/extensions/WikibaseLexeme/WikibaseLexeme.entitytypes.repo.php on line 288

Backtrace:

#0 /var/www/mediawiki/extensions/WikibaseLexeme/WikibaseLexeme.entitytypes.repo.php(288): Wikibase\Lexeme\Hooks\Formatters\LexemeLinkFormatter->__construct(Wikibase\DataModel\Services\Lookup\RedirectResolvingEntityLookup, Wikibase\Repo\Hooks\Formatters\DefaultEntityLinkFormatter, Wikibase\Lexeme\Formatters\LexemeTermFormatter, RequestContext, Language)
#1 /var/www/mediawiki/extensions/Wikibase/repo/includes/Hooks/Formatters/EntityLinkFormatterFactory.php(72): Wikibase\Lexeme\WikibaseLexemeHooks::{closure}(Language)
#2 /var/www/mediawiki/extensions/Wikibase/repo/includes/Hooks/Formatters/EntityLinkFormatterFactory.php(64): Wikibase\Repo\Hooks\Formatters\EntityLinkFormatterFactory->createAndCacheLinkFormatter(string)
#3 /var/www/mediawiki/extensions/Wikibase/repo/includes/Hooks/Formatters/EntityLinkFormatterFactory.php(52): Wikibase\Repo\Hooks\Formatters\EntityLinkFormatterFactory->getOrCreateLinkFormatter(string)
#4 /var/www/mediawiki/extensions/Wikibase/repo/includes/Hooks/HtmlPageLinkRendererBeginHookHandler.php(252): Wikibase\Repo\Hooks\Formatters\EntityLinkFormatterFactory->getLinkFormatter(string)
#5 /var/www/mediawiki/extensions/Wikibase/repo/includes/Hooks/HtmlPageLinkRendererBeginHookHandler.php(140): Wikibase\Repo\Hooks\HtmlPageLinkRendererBeginHookHandler->doHtmlPageLinkRendererBegin(MediaWiki\Linker\LinkRenderer, Title, NULL, array, RequestContext, NULL)
#6 /var/www/mediawiki/includes/Hooks.php(174): Wikibase\Repo\Hooks\HtmlPageLinkRendererBeginHookHandler::onHtmlPageLinkRendererBegin(MediaWiki\Linker\LinkRenderer, Title, NULL, array, array, NULL)
#7 /var/www/mediawiki/includes/Hooks.php(202): Hooks::callHook(string, array, array, NULL)
#8 /var/www/mediawiki/includes/linker/LinkRenderer.php(180): Hooks::run(string, array)
#9 /var/www/mediawiki/includes/linker/LinkRenderer.php(251): MediaWiki\Linker\LinkRenderer->runBeginHook(Title, NULL, array, array, boolean)
#10 /var/www/mediawiki/includes/linker/LinkRenderer.php(298): MediaWiki\Linker\LinkRenderer->makePreloadedLink(Title, NULL, string, array, array)
#11 /var/www/mediawiki/includes/changes/RCCacheEntryFactory.php(129): MediaWiki\Linker\LinkRenderer->makeKnownLink(Title)
#12 /var/www/mediawiki/includes/changes/RCCacheEntryFactory.php(68): RCCacheEntryFactory->buildCLink(RCCacheEntry)
#13 /var/www/mediawiki/includes/changes/EnhancedChangesList.php(119): RCCacheEntryFactory->newFromRecentChange(RecentChange, boolean)
#14 /var/www/mediawiki/includes/specials/SpecialRecentchanges.php(453): EnhancedChangesList->recentChangesLine(RecentChange, boolean, integer)
#15 /var/www/mediawiki/includes/specialpage/ChangesListSpecialPage.php(1610): SpecialRecentChanges->outputChangesList(Wikimedia\Rdbms\ResultWrapper, FormOptions)
#16 /var/www/mediawiki/includes/specialpage/ChangesListSpecialPage.php(675): ChangesListSpecialPage->webOutput(Wikimedia\Rdbms\ResultWrapper, FormOptions)
#17 /var/www/mediawiki/includes/specials/SpecialRecentchanges.php(167): ChangesListSpecialPage->execute(NULL)
#18 /var/www/mediawiki/includes/specialpage/SpecialPage.php(569): SpecialRecentChanges->execute(NULL)
#19 /var/www/mediawiki/includes/specialpage/SpecialPageFactory.php(581): SpecialPage->run(NULL)
#20 /var/www/mediawiki/includes/MediaWiki.php(288): MediaWiki\Special\SpecialPageFactory->executePath(Title, RequestContext)
#21 /var/www/mediawiki/includes/MediaWiki.php(868): MediaWiki->performRequest()
#22 /var/www/mediawiki/includes/MediaWiki.php(525): MediaWiki->main()
#23 /var/www/mediawiki/index.php(42): MediaWiki->run()
#24 {main}

Change 458505 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] Render all lemmas in lexeme page h1

https://gerrit.wikimedia.org/r/458505

This does require a purge of page caches to come to full fruition in production. Not functionally critically, though. /cc @Addshore