Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/204037

Change subject: Temporarily disable calendar model output in HtmlTimeFormatter
......................................................................

Temporarily disable calendar model output in HtmlTimeFormatter

Meant as a temporary step backwards, until the discussion is finished.

Change-Id: Ifeedcaa74e010ac3861de73c473a4fb8da37c861
---
M lib/includes/formatters/HtmlTimeFormatter.php
M lib/tests/phpunit/formatters/HtmlTimeFormatterTest.php
2 files changed, 17 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/37/204037/1

diff --git a/lib/includes/formatters/HtmlTimeFormatter.php 
b/lib/includes/formatters/HtmlTimeFormatter.php
index 58cb24a..52b04e7 100644
--- a/lib/includes/formatters/HtmlTimeFormatter.php
+++ b/lib/includes/formatters/HtmlTimeFormatter.php
@@ -55,11 +55,15 @@
 
                $formatted = $this->dateTimeFormatter->format( $value );
 
-               if ( $this->calendarNameNeeded( $value ) ) {
-                       $formatted .= '<sup class="wb-calendar-name">'
-                               . $this->formatCalendarName( 
$value->getCalendarModel() )
-                               . '</sup>';
-               }
+               // FIXME: The current logic below uses the calendar model field 
as "actual calendar model of
+               // the timestamp", not as "prefered". The later was the 
original intention of the field and
+               // needs conversion from the "always Gregorian" timestamp to 
the "prefered" calendar model.
+               // FIXME: Temporarily disabled.
+               //if ( $this->calendarNameNeeded( $value ) ) {
+               //      $formatted .= '<sup class="wb-calendar-name">'
+               //              . $this->formatCalendarName( 
$value->getCalendarModel() )
+               //              . '</sup>';
+               //}
 
                return $formatted;
        }
diff --git a/lib/tests/phpunit/formatters/HtmlTimeFormatterTest.php 
b/lib/tests/phpunit/formatters/HtmlTimeFormatterTest.php
index d230f3d..b1432e8 100644
--- a/lib/tests/phpunit/formatters/HtmlTimeFormatterTest.php
+++ b/lib/tests/phpunit/formatters/HtmlTimeFormatterTest.php
@@ -65,7 +65,7 @@
                                        1 * 60 * 60, 0, 0,
                                        TimeValue::PRECISION_DAY,
                                        TimeFormatter::CALENDAR_JULIAN ),
-                               '/^MOCKDATE<sup 
class="wb-calendar-name">\(valueview-expert-timevalue-calendar-julian\)<\/sup>$/'
+                               '/^MOCKDATE$/'
                        ),
                        'a month in 1920' => array(
                                new TimeValue( '+1920-05-01T00:00:00Z',
@@ -79,21 +79,21 @@
                                        1 * 60 * 60, 0, 0,
                                        TimeValue::PRECISION_DAY,
                                        TimeFormatter::CALENDAR_GREGORIAN ),
-                               '/^MOCKDATE<sup 
class="wb-calendar-name">\(valueview-expert-timevalue-calendar-gregorian\)<\/sup>$/'
+                               '/^MOCKDATE$/'
                        ),
                        'a julian day in 1520' => array(
                                new TimeValue( '+1520-05-01T00:00:00Z',
                                        1 * 60 * 60, 0, 0,
                                        TimeValue::PRECISION_DAY,
                                        TimeFormatter::CALENDAR_JULIAN ),
-                               '/^MOCKDATE<sup 
class="wb-calendar-name">\(valueview-expert-timevalue-calendar-julian\)<\/sup>$/'
+                               '/^MOCKDATE$/'
                        ),
                        'a julian day in 1980' => array(
                                new TimeValue( '+1980-05-01T00:00:00Z',
                                        1 * 60 * 60, 0, 0,
                                        TimeValue::PRECISION_DAY,
                                        TimeFormatter::CALENDAR_JULIAN ),
-                               '/^MOCKDATE<sup 
class="wb-calendar-name">\(valueview-expert-timevalue-calendar-julian\)<\/sup>$/'
+                               '/^MOCKDATE$/'
                        ),
                        '2014-10-10' => array(
                                new TimeValue( '+2014-10-10T00:00:00Z',
@@ -121,28 +121,28 @@
                                        0, 0, 0,
                                        TimeValue::PRECISION_DAY,
                                        TimeFormatter::CALENDAR_GREGORIAN ),
-                               '/^MOCKDATE<sup 
class="wb-calendar-name">\(valueview-expert-timevalue-calendar-gregorian\)<\/sup>$/'
+                               '/^MOCKDATE$/'
                        ),
                        '32-bit integer overflow' => array(
                                new TimeValue( '-2147483649-01-01T00:00:00Z',
                                        0, 0, 0,
                                        TimeValue::PRECISION_DAY,
                                        TimeFormatter::CALENDAR_GREGORIAN ),
-                               '/^MOCKDATE<sup 
class="wb-calendar-name">\(valueview-expert-timevalue-calendar-gregorian\)<\/sup>$/'
+                               '/^MOCKDATE$/'
                        ),
                        'unknown calendar model' => array(
                                new TimeValue( '+2100-01-01T00:00:00Z',
                                        0, 0, 0,
                                        TimeValue::PRECISION_DAY,
                                        'Stardate' ),
-                               '/^MOCKDATE<sup 
class="wb-calendar-name">Stardate<\/sup>$/'
+                               '/^MOCKDATE$/'
                        ),
                        'HTML entities' => array(
                                new TimeValue( '+2100-01-01T00:00:00Z',
                                        0, 0, 0,
                                        TimeValue::PRECISION_DAY,
                                        '<a>injection</a>' ),
-                               '/^MOCKDATE<sup 
class="wb-calendar-name">&lt;a&gt;injection&lt;\/a&gt;<\/sup>$/'
+                               '/^MOCKDATE$/'
                        ),
                );
        }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifeedcaa74e010ac3861de73c473a4fb8da37c861
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de>

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

Reply via email to