Krinkle has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/385925 )
Change subject: Output: Fix unclosed <ul> element from ChronologyOutput ...................................................................... Output: Fix unclosed <ul> element from ChronologyOutput Follows-up 0900b89. Change-Id: I21a62fb0ce79c02436d54c97199fb46d9c870cde --- M src/ChronologyOutput.php 1 file changed, 14 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/labs/tools/guc refs/changes/25/385925/1 diff --git a/src/ChronologyOutput.php b/src/ChronologyOutput.php index f1186c4..e6b872c 100644 --- a/src/ChronologyOutput.php +++ b/src/ChronologyOutput.php @@ -13,7 +13,6 @@ private $app; private $datas; private $changes = array(); - private $prevDate; public function __construct(App $app, stdClass $datas, array $options = array()) { $this->app = $app; @@ -34,23 +33,35 @@ } } $this->sort(); + $prevDate = null; $inList = false; foreach ($this->changes as $rc) { $date = $this->app->formatMwDate($rc->rev_timestamp, 'd M Y'); - if ($date !== $this->prevDate) { - $this->prevDate = $date; + // If this is the first result, or this result is the first + // one on a different date, add a date heading. + if ($date !== $prevDate) { + $prevDate = $date; if ($inList) { + // If we already had results before this, + // end the previous list. $inList = false; print '</ul>'; } print $this->makeDateLine($date); } if (!$inList) { + // If this is the first result after a new heading, + // start a list. $inList = true; print "\n<ul>\n"; } print $this->makeChangeLine($rc); } + if ($inList) { + // Make sure we close the last list + $inList = false; + print '</ul>'; + } } private function add(Wiki $wiki, Contribs $contribs) { -- To view, visit https://gerrit.wikimedia.org/r/385925 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I21a62fb0ce79c02436d54c97199fb46d9c870cde Gerrit-PatchSet: 1 Gerrit-Project: labs/tools/guc Gerrit-Branch: master Gerrit-Owner: Krinkle <krinklem...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits