jenkins-bot has submitted this change and it was merged.

Change subject: Add section preview mode to API action=parse
......................................................................


Add section preview mode to API action=parse

In https://gerrit.wikimedia.org/r/#/c/67266/, it was enabled automatically
when a section was specified in preview mode. However, this only works for
previews of a saved page's content, failing for user input previews which
might contain several sections of various degrees of nestedness.

Change-Id: I987144e5e315ed9e0a67f599083461a78879c0df
---
M RELEASE-NOTES-1.22
M includes/api/ApiParse.php
2 files changed, 5 insertions(+), 3 deletions(-)

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



diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22
index 38b2cbd..841de35 100644
--- a/RELEASE-NOTES-1.22
+++ b/RELEASE-NOTES-1.22
@@ -172,7 +172,7 @@
 * prop=info now adds the content model and page language of the title.
 * New upload log entries will now contain information on the relavent
   image (sha1 and timestamp).
-* (bug 49239) action=parse now can parse in preview mode.
+* (bug 49239) action=parse now can parse in preview and section preview modes.
 * (bug 49259) action=patrol now accepts revision ids.
 
 === Languages updated in 1.22===
diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php
index 800af25..58b46a2 100644
--- a/includes/api/ApiParse.php
+++ b/includes/api/ApiParse.php
@@ -369,8 +369,8 @@
 
                $popts = $pageObj->makeParserOptions( $this->getContext() );
                $popts->enableLimitReport( !$params['disablepp'] );
-               $popts->setIsPreview( $params['preview'] );
-               $popts->setIsSectionPreview( $params['preview'] && 
$this->section !== false );
+               $popts->setIsPreview( $params['preview'] || 
$params['sectionpreview'] );
+               $popts->setIsSectionPreview( $params['sectionpreview'] );
 
                wfProfileOut( __METHOD__ );
                return $popts;
@@ -612,6 +612,7 @@
                        'disablepp' => false,
                        'generatexml' => false,
                        'preview' => false,
+                       'sectionpreview' => false,
                        'contentformat' => array(
                                ApiBase::PARAM_TYPE => 
ContentHandler::getAllContentFormats(),
                        ),
@@ -668,6 +669,7 @@
                        'disablepp' => 'Disable the PP Report from the parser 
output',
                        'generatexml' => 'Generate XML parse tree (requires 
prop=wikitext)',
                        'preview' => 'Parse in preview mode',
+                       'sectionpreview' => 'Parse in section preview mode 
(enables preview mode too)',
                        'contentformat' => 'Content serialization format used 
for the input text',
                        'contentmodel' => 'Content model of the new content',
                );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I987144e5e315ed9e0a67f599083461a78879c0df
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to