[MediaWiki-commits] [Gerrit] mediawiki...GWToolset[master]: Use ParserOutput stateless transforms when available

2017-11-30 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/393269 )

Change subject: Use ParserOutput stateless transforms when available
..


Use ParserOutput stateless transforms when available

See MediaWiki core changes Ied5fe1a61 and I78b62ec3.

There's no need to feature-flag the extra parameter in calls to
ParserOutput::getText(), they'll just be ignored if this is merged
first.

Change-Id: I2cd7519186f2319f32cf6288655ddb873337a638
---
M includes/Forms/PreviewForm.php
1 file changed, 9 insertions(+), 3 deletions(-)

Approvals:
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Forms/PreviewForm.php b/includes/Forms/PreviewForm.php
index f0f66fc..2463615 100644
--- a/includes/Forms/PreviewForm.php
+++ b/includes/Forms/PreviewForm.php
@@ -267,7 +267,9 @@
$Output = $Context->getOutput();
 
$parser_options = ParserOptions::newFromContext( $Context );
-   $parser_options->setEditSection( false );
+   if ( !defined( 'ParserOutput::SUPPORTS_STATELESS_TRANSFORMS' ) 
) {
+   $parser_options->setEditSection( false );
+   }
$parser_options->setIsPreview( true );
 
foreach ( $metadata_items as $item ) {
@@ -296,7 +298,9 @@
);
 
// find this hacky, but not sure how to 
retrieve the raw text
-   $category = strip_tags( $category->getText() );
+   $category = strip_tags( $category->getText( [
+   'enableSectionEditLinks' => false,
+   ] ) );
 
// if the parser was not able to parse a 
template, {} will be left.
// only include the text if valid category.
@@ -337,7 +341,9 @@
wfMessage( 
'gwtoolset-preview-mediafile-placeholder-text' )->escaped()
) .
 
-   $parser_out->getText() .
+   $parser_out->getText( [
+   'enableSectionEditLinks' => false,
+   ] ) .
$Skin->getCategories() .
self::getNonParsableCategoriesAsHtml( 
$notParsable ) .
Html::closeElement( 'div' );

-- 
To view, visit https://gerrit.wikimedia.org/r/393269
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I2cd7519186f2319f32cf6288655ddb873337a638
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/GWToolset
Gerrit-Branch: master
Gerrit-Owner: Anomie 
Gerrit-Reviewer: Anomie 
Gerrit-Reviewer: Legoktm 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...GWToolset[master]: Use ParserOutput stateless transforms when available

2017-11-24 Thread Anomie (Code Review)
Anomie has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/393269 )

Change subject: Use ParserOutput stateless transforms when available
..

Use ParserOutput stateless transforms when available

See MediaWiki core changes Ied5fe1a61 and I78b62ec3.

There's no need to feature-flag the extra parameter in calls to
ParserOutput::getText(), they'll just be ignored if this is merged
first.

Change-Id: I2cd7519186f2319f32cf6288655ddb873337a638
---
M includes/Forms/PreviewForm.php
1 file changed, 9 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GWToolset 
refs/changes/69/393269/1

diff --git a/includes/Forms/PreviewForm.php b/includes/Forms/PreviewForm.php
index f0f66fc..66ad58b 100644
--- a/includes/Forms/PreviewForm.php
+++ b/includes/Forms/PreviewForm.php
@@ -267,7 +267,9 @@
$Output = $Context->getOutput();
 
$parser_options = ParserOptions::newFromContext( $Context );
-   $parser_options->setEditSection( false );
+   if ( !defined( ParserOutput::SUPPORTS_STATELESS_TRANSFORMS ) ) {
+   $parser_options->setEditSection( false );
+   }
$parser_options->setIsPreview( true );
 
foreach ( $metadata_items as $item ) {
@@ -296,7 +298,9 @@
);
 
// find this hacky, but not sure how to 
retrieve the raw text
-   $category = strip_tags( $category->getText() );
+   $category = strip_tags( $category->getText( [
+   'enableSectionEditLinks' => false,
+   ] ) );
 
// if the parser was not able to parse a 
template, {} will be left.
// only include the text if valid category.
@@ -337,7 +341,9 @@
wfMessage( 
'gwtoolset-preview-mediafile-placeholder-text' )->escaped()
) .
 
-   $parser_out->getText() .
+   $parser_out->getText( [
+   'enableSectionEditLinks' => false,
+   ] ) .
$Skin->getCategories() .
self::getNonParsableCategoriesAsHtml( 
$notParsable ) .
Html::closeElement( 'div' );

-- 
To view, visit https://gerrit.wikimedia.org/r/393269
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2cd7519186f2319f32cf6288655ddb873337a638
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GWToolset
Gerrit-Branch: master
Gerrit-Owner: Anomie 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits