Hoo man has uploaded a new change for review.
https://gerrit.wikimedia.org/r/131410
Change subject: [WIP] Don't defer error reporting in the parser functions
......................................................................
[WIP] Don't defer error reporting in the parser functions
That makes it impossible for {{#iferror}} to catch errors here,
also it feels like a more correct approach.
WIP as I don't want to spend to much time on this, until I
know that the approach is right.
Bug: 55347
Change-Id: Ib9dcd376150dd62986e43b54ccbdde9db667cc66
---
M client/WikibaseClient.hooks.php
M client/includes/parserhooks/ParserErrorMessageFormatter.php
M client/includes/parserhooks/PropertyParserFunction.php
3 files changed, 3 insertions(+), 30 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/10/131410/1
diff --git a/client/WikibaseClient.hooks.php b/client/WikibaseClient.hooks.php
index 38912f4..674ff0f 100644
--- a/client/WikibaseClient.hooks.php
+++ b/client/WikibaseClient.hooks.php
@@ -506,16 +506,6 @@
$out->setProperty( 'wikibase_item', $itemId );
}
- $errors = $pout->getExtensionData(
'wikibase-property-render-errors' );
-
- if ( !empty( $errors ) ) {
- foreach ( $errors as $errorMessage ) {
- $out->addWikiText(
- '<p class="error wikibase-error">' .
$errorMessage . '</p>'
- );
- }
- }
-
return true;
}
diff --git a/client/includes/parserhooks/ParserErrorMessageFormatter.php
b/client/includes/parserhooks/ParserErrorMessageFormatter.php
index 29320ea..b8f318b 100644
--- a/client/includes/parserhooks/ParserErrorMessageFormatter.php
+++ b/client/includes/parserhooks/ParserErrorMessageFormatter.php
@@ -40,13 +40,7 @@
* @return string
*/
public function format( Message $message ) {
- return '';
- /* return \Html::rawElement(
- 'span',
- array( 'class' => 'error' ),
- $message->inLanguage( $this->language )->text()
- );
- */
+ return '<p class="error wikibase-error">' . $message->parse() .
'</p>';
}
}
diff --git a/client/includes/parserhooks/PropertyParserFunction.php
b/client/includes/parserhooks/PropertyParserFunction.php
index 8b481c1..fc0c598 100644
--- a/client/includes/parserhooks/PropertyParserFunction.php
+++ b/client/includes/parserhooks/PropertyParserFunction.php
@@ -140,19 +140,8 @@
}
if ( !$status->isGood() ) {
- // stuff the error messages into the ParserOutput, so
we can render them later somewhere
- $errors = $this->parser->getOutput()->getExtensionData(
'wikibase-property-render-errors' );
-
- if ( $errors === null ) {
- $errors = array();
- }
-
- //XXX: if Status sucked less, we'd could get an array
of Message objects
- $errors[] = $status->getWikiText();
-
- $this->parser->getOutput()->setExtensionData(
'wikibase-property-render-errors', $errors );
-
- return '';
+ $errorFormatter = new ParserErrorMessageFormatter(
$language );
+ return $errorFormatter->format( $status->getMessage() );
}
return $status->getValue();
--
To view, visit https://gerrit.wikimedia.org/r/131410
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib9dcd376150dd62986e43b54ccbdde9db667cc66
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Hoo man <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits