/**
  * Hook runs after internal parsing
  * @see https://www.mediawiki.org/wiki/Manual:Hooks/ContentAlterParserOutput
  *
  * @param Title $title
  * @param ParserOutput $parserOutput
  *
  * @return bool
  */
 public function doContentAlterParserOutput(Title $title, ParserOutput $parserOutput)
 {
     if (!$this->namespaceChecker->isWikibaseEnabled($title->getNamespace())) {
         // shorten out
         return true;
     }
     $useRepoLinks = $this->langLinkHandler->useRepoLinks($title, $parserOutput);
     if ($useRepoLinks) {
         // add links
         $this->langLinkHandler->addLinksFromRepository($title, $parserOutput);
     }
     $this->parserOutputDataUpdater->updateItemIdProperty($title, $parserOutput);
     $this->parserOutputDataUpdater->updateOtherProjectsLinksData($title, $parserOutput);
     $this->parserOutputDataUpdater->updateBadgesProperty($title, $parserOutput);
     if ($useRepoLinks || $this->alwaysSort) {
         $interwikiLinks = $parserOutput->getLanguageLinks();
         $sortedLinks = $this->interwikiSorter->sortLinks($interwikiLinks);
         $parserOutput->setLanguageLinks($sortedLinks);
     }
     return true;
 }
 /**
  * @dataProvider getInterwikiCodeFromSiteProvider
  */
 public function testGetInterwikiCodeFromSite($site, $expected)
 {
     $interwikiCode = $this->langLinkHandler->getInterwikiCodeFromSite($site);
     $this->assertEquals($expected, $interwikiCode, 'interwiki code matches');
 }