Gerrit Patch Uploader has uploaded a new change for review.
https://gerrit.wikimedia.org/r/250456
Change subject: API: Enclose extract in an element with page content language
attributes
......................................................................
API: Enclose extract in an element with page content language attributes
Only the HTML extract gets enclosed.
Bug: T117392
Change-Id: If424cf338c23786951fcd5582ce49a3322fe4d89
---
M includes/ApiQueryExtracts.php
1 file changed, 13 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TextExtracts
refs/changes/56/250456/1
diff --git a/includes/ApiQueryExtracts.php b/includes/ApiQueryExtracts.php
index 24dd0dd..e61cbba 100644
--- a/includes/ApiQueryExtracts.php
+++ b/includes/ApiQueryExtracts.php
@@ -24,6 +24,7 @@
use ApiQueryBase;
use Config;
use FauxRequest;
+use HTML;
use MWTidy;
use ParserCache;
use ParserOptions;
@@ -88,6 +89,18 @@
$text = $this->truncate( $text );
if ( $this->params['plaintext'] ) {
$text = $this->doSections( $text );
+ } else {
+ // Enclose the text in an element with page
content language attributes
+ $lang = $t->getPageLanguage();
+ $text = HTML::rawElement(
+ 'div',
+ array(
+ 'class' => 'mw-content-' .
$lang->getDir(),
+ 'dir' => $lang->getDir(),
+ 'lang' => $lang->getHtmlCode(),
+ ),
+ $text
+ );
}
if ( $isXml ) {
--
To view, visit https://gerrit.wikimedia.org/r/250456
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If424cf338c23786951fcd5582ce49a3322fe4d89
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TextExtracts
Gerrit-Branch: master
Gerrit-Owner: Gerrit Patch Uploader <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits