Максим Червонный (fiskus_boulder) wrote in changelog,
Максим Червонный
fiskus_boulder
changelog

[livejournal] r20148: LJSUP-9913: Refactoring of print_comment...

Committer: mchervonniy
LJSUP-9913: Refactoring of print_comments() function in s2 styles
U   trunk/bin/upgrading/s2layers/classic/layout.s2
U   trunk/bin/upgrading/s2layers/deardiary/layout.s2
U   trunk/bin/upgrading/s2layers/lickable/layout.s2
U   trunk/bin/upgrading/s2layers/refriedpaper/layout.s2
U   trunk/bin/upgrading/s2layers/sturdygesture/layout.s2
U   trunk/bin/upgrading/s2layers/understroke/layout.s2
U   trunk/bin/upgrading/s2layers/variableflow/layout.s2
Modified: trunk/bin/upgrading/s2layers/classic/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/classic/layout.s2	2011-09-28 02:50:10 UTC (rev 20147)
+++ trunk/bin/upgrading/s2layers/classic/layout.s2	2011-09-28 03:36:36 UTC (rev 20148)
@@ -945,9 +945,7 @@
 }
 
 function EntryPage::print_comments (Comment[] cs) {
-    var Page p = get_page();
     if (size $cs == 0) { return; }
-
     foreach var Comment c ($cs) {
         $this->print_comment($c);
         $this->print_comments($c.replies);

Modified: trunk/bin/upgrading/s2layers/deardiary/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/deardiary/layout.s2	2011-09-28 02:50:10 UTC (rev 20147)
+++ trunk/bin/upgrading/s2layers/deardiary/layout.s2	2011-09-28 03:36:36 UTC (rev 20148)
@@ -1278,13 +1278,12 @@
 
 function EntryPage::print_comments (Comment[] cs) {
     if (size $cs == 0) { return; }
-    """<ul class="comments">\n""";
+    """<ul class="comments">""";
     foreach var Comment c ($cs) {
-        var int indent = ($c.depth - 1) * 25;
-        print "<li>";
+        """<li>""";
         $this->print_comment($c);
         $this->print_comments($c.replies);
-        println "</li>";
+        """</li>""";
     }
     """</ul>""";
 }

Modified: trunk/bin/upgrading/s2layers/lickable/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/lickable/layout.s2	2011-09-28 02:50:10 UTC (rev 20147)
+++ trunk/bin/upgrading/s2layers/lickable/layout.s2	2011-09-28 03:36:36 UTC (rev 20148)
@@ -1535,13 +1535,13 @@
 
 function EntryPage::print_comments (Comment[] cs) {
     if (size $cs == 0) { return; }
-    """<ul class="comments">\n""";
+    """<ul class="comments">""";
     foreach var Comment c ($cs) {
         var int indent = ($c.depth - 1) * 25;
-        print "<li>";
+        """<li>""";
         $this->print_comment($c);
         $this->print_comments($c.replies);
-        println "</li>";
+        """</li>""";
     }
     """</ul>""";
 }

Modified: trunk/bin/upgrading/s2layers/refriedpaper/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/refriedpaper/layout.s2	2011-09-28 02:50:10 UTC (rev 20147)
+++ trunk/bin/upgrading/s2layers/refriedpaper/layout.s2	2011-09-28 03:36:36 UTC (rev 20148)
@@ -1387,23 +1387,23 @@
 }
 
 function EntryPage::print_comments (Comment[] cs) {
-  var Page p = get_page();
-  if (size $cs == 0) { return; }
-  foreach var Comment c ($cs) {
-    var int indent = ($c.depth - 1) * 25;
-    "<div id=\"$c.dom_id\" style='margin-left: ${indent}px; margin-top: 5px'>\n";
-    if (($c.spam) and (not $p.showspam) and (not $c.can_marked_as_spam) and (size($c.replies) > 0)) {
-      """$*text_spam_comment""";
-    } elseif (($c.spam) and (not $p.showspam)) {
-      """&nsbp;""";
-    } elseif ($c.full) {
-      $this->print_comment($c);
-    } else {
-      $this->print_comment_partial($c);
+    var Page p = get_page();
+    if (size $cs == 0) { return; }
+    foreach var Comment c ($cs) {
+        var int indent = ($c.depth - 1) * 25;
+        """<div id="$c.dom_id" style='margin-left: ${indent}px; margin-top: 5px'>"::;
+        if (($c.spam) and (not $p.showspam) and (not $c.can_marked_as_spam) and (size($c.replies) > 0)) {
+            """$*text_spam_comment""";
+        } elseif (($c.spam) and (not $p.showspam)) {
+            """&nsbp;""";
+        } elseif ($c.full) {
+            $this->print_comment($c);
+        } else {
+            $this->print_comment_partial($c);
+        }
+        """</div>""";
+        $this->print_comments($c.replies);
     }
-    "</div>";
-    $this->print_comments($c.replies);
-  }
 }
 
 function ReplyPage::print_body() {

Modified: trunk/bin/upgrading/s2layers/sturdygesture/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/sturdygesture/layout.s2	2011-09-28 02:50:10 UTC (rev 20147)
+++ trunk/bin/upgrading/s2layers/sturdygesture/layout.s2	2011-09-28 03:36:36 UTC (rev 20148)
@@ -793,15 +793,14 @@
     }
 }
 
-function EntryPage::print_comments(Comment[] cs) {
-    var Page p = get_page();
+function EntryPage::print_comments (Comment[] cs) {
     if (size $cs == 0) { return; }
-    print "<div style=\"margin-left: 25px;\">";
+    """<div style="margin-left: 25px;">""";
     foreach var Comment c ($cs) {
         $this->print_comment($c);
         $this->print_comments($c.replies);
     }
-    print "</div>";
+    """</div>""";
 }
 
 function EntryPage::print_comment(Comment c) {

Modified: trunk/bin/upgrading/s2layers/understroke/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/understroke/layout.s2	2011-09-28 02:50:10 UTC (rev 20147)
+++ trunk/bin/upgrading/s2layers/understroke/layout.s2	2011-09-28 03:36:36 UTC (rev 20148)
@@ -986,35 +986,35 @@
 	}
 	"""</div>""";
 }
+
 function EntryPage::print_comments (Comment[] cs) {
-	if (size $cs == 0) { return; }
-	foreach var Comment c ($cs) {
-		var int indent = ($c.depth - 1) * 25;
-		var string comment_classes = "comment-wrap";
-		$comment_classes = $comment_classes + ($c.depth % 2 ? " comment-odd" : " comment-even");
-		
-		if ($c.deleted) { $comment_classes = $comment_classes + " comment-deleted"; }
-		if ($c.screened) { $comment_classes = $comment_classes + " comment-screened"; }
-		if ($c.edited) { $comment_classes = $comment_classes + " comment-edited"; }
-		if ($c.frozen) { $comment_classes = $comment_classes + " comment-frozen"; }
-		if (not defined $c.poster) { $comment_classes = $comment_classes + " comment-anon"; }
-		if (not $c.full) { $comment_classes = $comment_classes + " comment-partial"; }
-		if (not(defined $c.userpic and $*comment_userpic_style != "off")) { $comment_classes = $comment_classes + " comment-woup"; }
-		if ($.entry.poster->equals($c.poster)) { $comment_classes = $comment_classes + " comment-author"; }
-		"""<div id="$c.dom_id" class="$comment_classes" style="margin-left:${indent}px;">""";
-		if ($c.screened and not $c.full and not viewer_is_owner()) {
-			"""<strong>(Screened comment)</strong>""";
-		} elseif ($c.deleted) {
-			"""<strong>(Deleted comment)</strong>""";
-		} elseif ($c.full) {
-			$this->print_comment($c);
-		} else {
-			$this->print_comment_partial($c);
-		}
-		"</div>";
-		$c->print_reply_container();
-		$this->print_comments($c.replies);
-	}
+    if (size $cs == 0) { return; }
+    foreach var Comment c ($cs) {
+        var int indent = ($c.depth - 1) * 25;
+        var string comment_classes = "comment-wrap";
+        $comment_classes = $comment_classes + ($c.depth % 2 ? " comment-odd" : " comment-even");
+        if ($c.deleted) { $comment_classes = $comment_classes + " comment-deleted"; }
+        if ($c.screened) { $comment_classes = $comment_classes + " comment-screened"; }
+        if ($c.edited) { $comment_classes = $comment_classes + " comment-edited"; }
+        if ($c.frozen) { $comment_classes = $comment_classes + " comment-frozen"; }
+        if (not defined $c.poster) { $comment_classes = $comment_classes + " comment-anon"; }
+        if (not $c.full) { $comment_classes = $comment_classes + " comment-partial"; }
+        if (not(defined $c.userpic and $*comment_userpic_style != "off")) { $comment_classes = $comment_classes + " comment-woup"; }
+        if ($.entry.poster->equals($c.poster)) { $comment_classes = $comment_classes + " comment-author"; }
+        """<div id="$c.dom_id" class="$comment_classes" style="margin-left:${indent}px;">""";
+        if ($c.screened and not $c.full and not viewer_is_owner()) {
+            """<strong>(Screened comment)</strong>""";
+        } elseif ($c.deleted) {
+            """<strong>(Deleted comment)</strong>""";
+        } elseif ($c.full) {
+            $this->print_comment($c);
+        } else {
+            $this->print_comment_partial($c);
+        }
+        """</div>""";
+        $c->print_reply_container();
+        $this->print_comments($c.replies);
+    }
 }
 
 function EntryPage::print_comment (Comment c) {

Modified: trunk/bin/upgrading/s2layers/variableflow/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/variableflow/layout.s2	2011-09-28 02:50:10 UTC (rev 20147)
+++ trunk/bin/upgrading/s2layers/variableflow/layout.s2	2011-09-28 03:36:36 UTC (rev 20148)
@@ -858,15 +858,15 @@
     $this->lay_print_pager();
 }
 
-function EntryPage::print_comments(Comment[] comments) {
+function EntryPage::print_comments (Comment[] cs) {
     """<ul class="comments">""";
-    foreach var Comment c ($comments) {
+    foreach var Comment c ($cs) {
         """<li class="commentsitem">""";
         $this->print_comment($c);
         if (size($c.replies) > 0) {
             $this->print_comments($c.replies);
         }
-        "</li>\n";
+        """</li>""";
     }
     """</ul>""";
 }

Tags: fiskus_boulder, livejournal, s2
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments