Anomie has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/393274 )
Change subject: Use ParserOutput stateless transforms
......................................................................
Use ParserOutput stateless transforms
For IndexContent, we just include __NOEDITSECTION__ in the wikitext
passed to the parser to suppress the section edit links more directly.
Change-Id: I38e56d04f7ffbe8796dbda6500106a028a459980
Depends-On: I78b62ec33fcb8273acb9b3b4e9012215442be94c
---
M includes/index/IndexContent.php
M includes/index/IndexContentHandler.php
M includes/page/PageContent.php
M includes/page/PageContentHandler.php
4 files changed, 4 insertions(+), 20 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ProofreadPage
refs/changes/74/393274/1
diff --git a/includes/index/IndexContent.php b/includes/index/IndexContent.php
index bb05852..adae342 100644
--- a/includes/index/IndexContent.php
+++ b/includes/index/IndexContent.php
@@ -221,6 +221,9 @@
}, $this->fields )
);
+ // Force no section edit links
+ $text = '__NOEDITSECTION__' . $text;
+
// We do the final rendering
$output = $wgParser->parse( $text, $title, $options, true,
true, $revId );
$output->addTemplate( $templateTitle,
diff --git a/includes/index/IndexContentHandler.php
b/includes/index/IndexContentHandler.php
index 2c74982..c461c7e 100644
--- a/includes/index/IndexContentHandler.php
+++ b/includes/index/IndexContentHandler.php
@@ -190,15 +190,6 @@
}
/**
- * @see ContentHandler::makeParserOptions
- */
- public function makeParserOptions( $context ) {
- $parserOptions = parent::makeParserOptions( $context );
- $parserOptions->setEditSection( false );
- return $parserOptions;
- }
-
- /**
* @see ContentHandler::makeRedirectContent
*/
public function makeRedirectContent( Title $destination, $text = '' ) {
diff --git a/includes/page/PageContent.php b/includes/page/PageContent.php
index 5b82c6a..8e2caab 100644
--- a/includes/page/PageContent.php
+++ b/includes/page/PageContent.php
@@ -290,7 +290,7 @@
->title( $title )->inContentLanguage()->parse()
.
Html::closeElement( 'div' ) .
Html::openElement( 'div', [ 'class' => 'pagetext' ] ) .
- $parserOutput->getText() .
+ $parserOutput->getText( [ 'enableSectionEditLinks' =>
false ] ) .
Html::closeElement( 'div' );
$parserOutput->setText( $html );
diff --git a/includes/page/PageContentHandler.php
b/includes/page/PageContentHandler.php
index ac160ca..588c2f6 100644
--- a/includes/page/PageContentHandler.php
+++ b/includes/page/PageContentHandler.php
@@ -307,16 +307,6 @@
}
/**
- * @see ContentHandler::makeParserOptions
- */
- public function makeParserOptions( $context ) {
- $parserOptions = parent::makeParserOptions( $context );
- $parserOptions->setEditSection( false );
-
- return $parserOptions;
- }
-
- /**
* @see ContentHandler::makeRedirectContent
* @todo is it the right content for redirects?
*/
--
To view, visit https://gerrit.wikimedia.org/r/393274
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I38e56d04f7ffbe8796dbda6500106a028a459980
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ProofreadPage
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits