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

[livejournal] r20157: LJSUP-9934: Refactoring of print_comment...

Committer: mchervonniy
LJSUP-9934: Refactoring of print_comment_partial() function in s2 styles
U   trunk/bin/upgrading/s2layers/classic/layout.s2
U   trunk/bin/upgrading/s2layers/digitalmultiplex/layout.s2
U   trunk/bin/upgrading/s2layers/generator/layout.s2
U   trunk/bin/upgrading/s2layers/magazine/layout.s2
U   trunk/bin/upgrading/s2layers/punquin/layout.s2
U   trunk/bin/upgrading/s2layers/sixhtml/layout.s2
U   trunk/bin/upgrading/s2layers/sturdygesture/layout.s2
U   trunk/bin/upgrading/s2layers/tabularindent/layout.s2
U   trunk/bin/upgrading/s2layers/understroke/layout.s2
Modified: trunk/bin/upgrading/s2layers/classic/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/classic/layout.s2	2011-09-28 07:55:46 UTC (rev 20156)
+++ trunk/bin/upgrading/s2layers/classic/layout.s2	2011-09-28 08:54:12 UTC (rev 20157)
@@ -977,12 +977,11 @@
 }
 
 function EntryPage::print_comment_partial (Comment c) {
-    var string poster = defined $c.poster ? $c.poster->as_string() : "<i>$*text_poster_anonymous</i>";
-    var string subj = $c.subject != "" ? $c.subject : $*text_nosubject;
-    print safe "<a href='$c.permalink_url'>$subj</a> - $poster";
-    if ($c.thread_url != "") {
-        $c->print_expand_collapse_links({ "expand"=>" - %_", "collapse"=>" - %_"});
-    }
+    var string poster = defined $c.poster ? $c.poster->as_string() : """<em class="noposter">$*text_poster_anonymous</em>""";
+    var string subj = $c.subject != "" ? $c.subject : """<em class="nosubject">$*text_nosubject</em>""";
+    var string sep = "-";
+    print safe """<a href="$c.permalink_url">$subj</a> $sep $poster""";
+    $c->print_expand_collapse_links({ "expand"=>" $sep %_", "collapse"=>" $sep %_"});
 }
 
 function EntryPage::print_comment_full (Comment c) {

Modified: trunk/bin/upgrading/s2layers/digitalmultiplex/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/digitalmultiplex/layout.s2	2011-09-28 07:55:46 UTC (rev 20156)
+++ trunk/bin/upgrading/s2layers/digitalmultiplex/layout.s2	2011-09-28 08:54:12 UTC (rev 20157)
@@ -1387,12 +1387,11 @@
 }
 
 function EntryPage::print_comment_partial (Comment c) {
-    var string poster = defined $c.poster ? $c.poster->as_string() : "<i>$*text_poster_anonymous</i>";
-    var string subj = $c.subject != "" ? $c.subject : $*text_nosubject;
-    print safe "<a href='$c.permalink_url'>$subj</a> - $poster";
-    if ($c.thread_url) {
-        $c->print_expand_collapse_links({ "expand"=>" (%_) ", "collapse"=>" (%_) "});
-    }
+    var string poster = defined $c.poster ? $c.poster->as_string() : """<em class="noposter">$*text_poster_anonymous</em>""";
+    var string subj = $c.subject != "" ? $c.subject : """<em class="nosubject">$*text_nosubject</em>""";
+    var string sep = "-";
+    print safe """<a href="$c.permalink_url">$subj</a> $sep $poster""";
+    $c->print_expand_collapse_links({ "expand"=>" $sep %_", "collapse"=>" $sep %_"});
 }
 
 ################################################################################

Modified: trunk/bin/upgrading/s2layers/generator/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/generator/layout.s2	2011-09-28 07:55:46 UTC (rev 20156)
+++ trunk/bin/upgrading/s2layers/generator/layout.s2	2011-09-28 08:54:12 UTC (rev 20157)
@@ -1343,14 +1343,15 @@
         }
         "</div>";
     }
+
 function EntryPage::print_comment_partial (Comment c) {
-    var string subject = $c.subject ? $c.subject : $*text_nosubject;
-    var string date = $c->time_display("long", "");
-    var string poster = isnull $c.poster ? $*text_poster_anonymous : $c.poster->as_string();
-
-    print safe """<a href="$c.permalink_url">$subject</a> $poster""";
+    var string poster = defined $c.poster ? $c.poster->as_string() : """<em class="noposter">$*text_poster_anonymous</em>""";
+    var string subj = $c.subject != "" ? $c.subject : """<em class="nosubject">$*text_nosubject</em>""";
+    var string sep = "-";
+    print safe """<a href="$c.permalink_url">$subj</a> $sep $poster""";
     $c->print_expand_collapse_links({ "expand"=>" %_", "collapse"=>" %_"});
 }
+
 function EntryPage::print_comment_full (Comment c) {
     var Page p = get_page();
     var Color background; var Color color;

Modified: trunk/bin/upgrading/s2layers/magazine/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/magazine/layout.s2	2011-09-28 07:55:46 UTC (rev 20156)
+++ trunk/bin/upgrading/s2layers/magazine/layout.s2	2011-09-28 08:54:12 UTC (rev 20157)
@@ -961,12 +961,11 @@
 }
 
 function EntryPage::print_comment_partial (Comment c) {
-    var string poster = defined $c.poster ? $c.poster->as_string() : "<i>$*text_poster_anonymous</i>";
-    var string subj = $c.subject != "" ? $c.subject : $*text_nosubject;
-    print safe "<a href='$c.permalink_url'>$subj</a> - $poster";
-    if ($c.thread_url != "") {
-        $c->print_expand_collapse_links({ "expand"=>" (%_) ", "collapse"=>" (%_) "});
-    }
+    var string poster = defined $c.poster ? $c.poster->as_string() : """<em class="noposter">$*text_poster_anonymous</em>""";
+    var string subj = $c.subject != "" ? $c.subject : """<em class="nosubject">$*text_nosubject</em>""";
+    var string sep = "-";
+    print safe """<a href="$c.permalink_url">$subj</a> $sep $poster""";
+    $c->print_expand_collapse_links({ "expand"=>" (%_) ", "collapse"=>" (%_) "});
 }
 
 function EntryPage::print_comment_full (Comment c) {

Modified: trunk/bin/upgrading/s2layers/punquin/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/punquin/layout.s2	2011-09-28 07:55:46 UTC (rev 20156)
+++ trunk/bin/upgrading/s2layers/punquin/layout.s2	2011-09-28 08:54:12 UTC (rev 20157)
@@ -888,12 +888,11 @@
 }
 
 function EntryPage::print_comment_partial (Comment c) {
-    var string poster = defined $c.poster ? $c.poster->as_string() : "<i>$*text_poster_anonymous</i>";
-    var string subj = $c.subject != "" ? $c.subject : $*text_nosubject;
-    print safe "<a href='$c.permalink_url'>$subj</a> - $poster";
-    if ($c.thread_url != "") {
-        $c->print_expand_collapse_links({ "expand"=>" - %_", "collapse"=>" - %_"});
-    }
+    var string poster = defined $c.poster ? $c.poster->as_string() : """<em class="noposter">$*text_poster_anonymous</em>""";
+    var string subj = $c.subject != "" ? $c.subject : """<em class="nosubject">$*text_nosubject</em>""";
+    var string sep = "-";
+    print safe """<a href="$c.permalink_url">$subj</a> $sep $poster""";
+    $c->print_expand_collapse_links({ "expand"=>" $sep %_", "collapse"=>" $sep %_"});
 }
 
 function EntryPage::print_comment_full (Comment c) {

Modified: trunk/bin/upgrading/s2layers/sixhtml/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/sixhtml/layout.s2	2011-09-28 07:55:46 UTC (rev 20156)
+++ trunk/bin/upgrading/s2layers/sixhtml/layout.s2	2011-09-28 08:54:12 UTC (rev 20157)
@@ -1051,19 +1051,18 @@
     $c->print_reply_container();
 }
 
-function EntryPage::print_comment_partial(Comment e) {
-     var Page p = get_page();
-     var string sep = "<span class='separator'>|</span>";
-     "<div class='comment collapsed-comment'>\n";
-     "<div class='comment-footer'>";
-     var string subject = $e.subject;
-     if ($subject == "") { $subject = $*text_nosubject; }
-     "<a href='$e.permalink_url' class='collapsed-comment-link'>$subject</a> <span class='separator'>-</span> ";
-     print safe lang_posted_by($e.poster, $e.poster); " <span class='separator'>-</span> ";
-     print lang_posted_date_and_time($e, $e.time, true, true);
-     $e->print_expand_collapse_links({ "expand"=>" $sep %_", "collapse"=>" $sep %_"});
-     "</div>";
-     "</div>";
+function EntryPage::print_comment_partial (Comment c) {
+    var string sep1 = "<span class='separator'>|</span>";
+    """<div class="comment collapsed-comment">
+        <div class="comment-footer">""";
+    var string subj = $c.subject != "" ? $c.subject : """<em class="nosubject">$*text_nosubject</em>""";
+    var string sep = """<span class="separator">-</span>""";
+    """<a href="$c.permalink_url" class="collapsed-comment-link">$subj</a> $sep """;
+    print safe lang_posted_by($c.poster, $c.poster);
+    """ $sep """;
+    print lang_posted_date_and_time($c, $c.time, true, true);
+    $c->print_expand_collapse_links({ "expand"=>" $sep1 %_", "collapse"=>" $sep1 %_"});
+    """</div></div>""";
 }
 
 function EntryPage::print_comment_full(Comment e) {

Modified: trunk/bin/upgrading/s2layers/sturdygesture/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/sturdygesture/layout.s2	2011-09-28 07:55:46 UTC (rev 20156)
+++ trunk/bin/upgrading/s2layers/sturdygesture/layout.s2	2011-09-28 08:54:12 UTC (rev 20157)
@@ -905,18 +905,17 @@
     }
 }
 
-function EntryPage::print_comment_partial(Comment c) {
-    var string poster = defined $c.poster ? $c.poster->as_string() : "<i>(Anonymous)</i>";
-    var string subj = $c.subject != "" ? $c.subject : $*text_nosubject;
-    print """<div class="minicomment" id="$c.dom_id"><a href="$c.permalink_url">$subj</a> - $poster""";
-    var Link expand_link = $c->get_link("expand_comments");
-    if ($c.thread_url != "" and (not $c.spam)) {
-        $c->print_expand_collapse_links({ "expand"=>" - %_", "collapse"=>" - %_"});
-    }
-    print """</div>""";
+function EntryPage::print_comment_partial (Comment c) {
+    var string poster = defined $c.poster ? $c.poster->as_string() : """<em class="noposter">$*text_poster_anonymous</em>""";
+    var string subj = $c.subject != "" ? $c.subject : """<em class="nosubject">$*text_nosubject</em>""";
+    var string sep = "-";
+    print safe """<div class="minicomment" id="$c.dom_id">
+        <a href="$c.permalink_url">$subj</a>
+        $sep $poster""";
+    $c->print_expand_collapse_links({ "expand"=>" $sep %_", "collapse"=>" $sep %_"});
+    """</div>""";
 }
 
-
 function ReplyPage::print_body() {
 
     if ($.replyto isa Entry) {

Modified: trunk/bin/upgrading/s2layers/tabularindent/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/tabularindent/layout.s2	2011-09-28 07:55:46 UTC (rev 20156)
+++ trunk/bin/upgrading/s2layers/tabularindent/layout.s2	2011-09-28 08:54:12 UTC (rev 20157)
@@ -1063,13 +1063,12 @@
 }
 
 function EntryPage::print_comment_partial (Comment c) {
-    var string poster = defined $c.poster ? $c.poster->as_string() : "<i>(Anonymous)</i>";
-    var string subj = $c.subject != "" ? $c.subject : $*text_nosubject;
+    var string poster = defined $c.poster ? $c.poster->as_string() : """<em class="noposter">$*text_poster_anonymous</em>""";
+    var string subj = $c.subject != "" ? $c.subject : """<em class="nosubject">$*text_nosubject</em>""";
+    var string sep = "-";
     print_genericbox_open();
-    print "<a href='$c.permalink_url'>$subj</a> - $poster";
-    if ($c.thread_url != "") {
-        $c->print_expand_collapse_links({ "expand"=>" - %_", "collapse"=>" - %_"});
-    }
+    print """<a href="$c.permalink_url">$subj</a> $sep $poster""";
+    $c->print_expand_collapse_links({ "expand"=>" $sep %_", "collapse"=>" $sep %_"});
     print_genericbox_close();
 }
 

Modified: trunk/bin/upgrading/s2layers/understroke/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/understroke/layout.s2	2011-09-28 07:55:46 UTC (rev 20156)
+++ trunk/bin/upgrading/s2layers/understroke/layout.s2	2011-09-28 08:54:12 UTC (rev 20157)
@@ -1058,17 +1058,13 @@
 	}
 	"""</div>$*_{"HR"}""";
 }
+
 function EntryPage::print_comment_partial (Comment c) {
-	var string poster = defined $c.poster ? _ljuser($c.poster, "") : "<em>$*text_poster_anonymous</em>";
-	var string subj = $c.subject != "" ? $c.subject : $*text_nosubject;
-	if ($subj == "...") {
-		$subj = "…";
-	}
-	print safe """<a href="$c.permalink_url">$subj</a> <span class="emdash">—</span> $poster""";
-	var Link expand_link = $c->get_link("expand_comments");
-	if ($c.thread_url != "" and defined $expand_link) {
-		" ("; $c->print_expand_link(); ")";
-	}
+    var string poster = defined $c.poster ? _ljuser($c.poster, "") : """<em class="noposter">$*text_poster_anonymous</em>""";
+    var string subj = $c.subject != "" ? $c.subject : """<em class="nosubject">$*text_nosubject</em>""";
+    var string sep = """<span class="emdash">—</span>""";
+    print safe """<a href="$c.permalink_url">$subj</a> $sep $poster""";
+    $c->print_expand_collapse_links({ "expand"=>" $sep %_", "collapse"=>" $sep %_"});
 }
 
 function Page::print() {

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