From 6e959011611a08ca5968b272cd2a5d365d1a3835 Mon Sep 17 00:00:00 2001 From: vrana Date: Sat, 2 Feb 2013 05:15:30 -0800 Subject: [PATCH] Convert phutil_render_tag() to phutil_tag() for inline comments Test Plan: Looked at file with lint errors in Diffusion. I've also tried inline comments in Differential but it failed. I'll try it again after you land all your diffs. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4755 --- .../DifferentialChangesetTwoUpRenderer.php | 17 ++++---- .../view/DifferentialInlineCommentView.php | 41 ++++++++++--------- .../DiffusionBrowseFileController.php | 15 +++---- 3 files changed, 37 insertions(+), 36 deletions(-) diff --git a/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php b/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php index 7a9bb3a1af..91cfbebabd 100644 --- a/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php @@ -324,26 +324,29 @@ final class DifferentialChangesetTwoUpRenderer } } } - $html[] = + $html[] = hsprintf( ''. ''. - ''.$comment_html.''. + '%s'. ''. - ''.$new.''. - ''; + '%s'. + '', + $comment_html, + $new); } } if ($n_num && isset($new_comments[$n_num])) { foreach ($new_comments[$n_num] as $comment) { $comment_html = $this->renderInlineComment($comment, $on_right = true); - $html[] = + $html[] = hsprintf( ''. ''. ''. ''. - ''.$comment_html.''. - ''; + '%s'. + '', + $comment_html); } } } diff --git a/src/applications/differential/view/DifferentialInlineCommentView.php b/src/applications/differential/view/DifferentialInlineCommentView.php index 0340d3287a..0fa497fa59 100644 --- a/src/applications/differential/view/DifferentialInlineCommentView.php +++ b/src/applications/differential/view/DifferentialInlineCommentView.php @@ -175,10 +175,10 @@ final class DifferentialInlineCommentView extends AphrontView { } if ($links) { - $links = - ''. - implode(' · ', $links). - ''; + $links = phutil_tag( + 'span', + array('class' => 'differential-inline-comment-links'), + array_interleave(" \xC2\xB7 ", $links)); } else { $links = null; } @@ -217,24 +217,25 @@ final class DifferentialInlineCommentView extends AphrontView { $author = $handles[$inline->getAuthorPHID()]->getName(); } - $markup = javelin_render_tag( + $markup = javelin_tag( 'div', array( 'class' => $classes, 'sigil' => $sigil, 'meta' => $metadata, ), - '
'. - $anchor. - $links. - ' '.$line.' '. - phutil_escape_html($author). - '
'. - '
'. - '
'. - $content. + hsprintf( + '
'. + '%s%s %s %s'. '
'. - '
'); + '
'. + '
%s
'. + '
', + $anchor, + $links, + $line, + $author, + $content)); return $this->scaffoldMarkup($markup); } @@ -247,15 +248,17 @@ final class DifferentialInlineCommentView extends AphrontView { $left_markup = !$this->onRight ? $markup : ''; $right_markup = $this->onRight ? $markup : ''; - return + return hsprintf( ''. ''. ''. - ''. + ''. ''. - ''. + ''. ''. - '
'.$left_markup.'%s'.$right_markup.'%s
'; + '', + $left_markup, + $right_markup); } } diff --git a/src/applications/diffusion/controller/DiffusionBrowseFileController.php b/src/applications/diffusion/controller/DiffusionBrowseFileController.php index b690c484ea..f89e6ef7c6 100644 --- a/src/applications/diffusion/controller/DiffusionBrowseFileController.php +++ b/src/applications/diffusion/controller/DiffusionBrowseFileController.php @@ -264,16 +264,13 @@ final class DiffusionBrowseFileController extends DiffusionController { )); } - $corpus_table = javelin_render_tag( + $corpus_table = javelin_tag( 'table', array( 'class' => "diffusion-source remarkup-code PhabricatorMonospaced", 'sigil' => 'diffusion-source', ), - implode("\n", $rows)); - - // TODO: [HTML] Major cheating here. - $corpus_table = phutil_safe_html($corpus_table); + $rows); $corpus = phutil_tag( 'div', @@ -774,11 +771,9 @@ final class DiffusionBrowseFileController extends DiffusionController { ->setMarkupEngine($engine) ->setInlineComment($inline) ->render(); - $rows[] = - ''. - str_repeat('', ($needs_blame ? 5 : 1)). - ''.$inline_view.''. - ''; + $row = array_fill(0, ($needs_blame ? 5 : 1), phutil_tag('th')); + $row[] = phutil_tag('td', array(), $inline_view); + $rows[] = phutil_tag('tr', array('class' => 'inline'), $row); } return $rows; }