Типа я (zilogic) wrote in changelog,
Типа я
zilogic
changelog

[livejournal] r20439: LJSUP-10240: Make static (js/css) availa...

Committer: amyshkin
LJSUP-10240: Make static (js/css) available from S2
U   trunk/cgi-bin/LJ/S2/HeadContent.pm
U   trunk/cgi-bin/LJ/S2.pm
Modified: trunk/cgi-bin/LJ/S2/HeadContent.pm
===================================================================
--- trunk/cgi-bin/LJ/S2/HeadContent.pm	2011-10-26 12:19:27 UTC (rev 20438)
+++ trunk/cgi-bin/LJ/S2/HeadContent.pm	2011-10-26 12:57:53 UTC (rev 20439)
@@ -26,7 +26,11 @@
 
 sub as_string {
     my $self = shift;
+    return '<!--SubstHeadContent-->';
+}
 
+sub subst_header {
+    my $self = shift;
     my $head_content = $self->_page_head();
     my %handlers = (
         'EntryPage'   => \&_entry_page_head,

Modified: trunk/cgi-bin/LJ/S2.pm
===================================================================
--- trunk/cgi-bin/LJ/S2.pm	2011-10-26 12:19:27 UTC (rev 20438)
+++ trunk/cgi-bin/LJ/S2.pm	2011-10-26 12:57:53 UTC (rev 20439)
@@ -236,9 +236,14 @@
     my $css_mode = $ctype eq "text/css";
 
     S2::Builtin::LJ::start_css($ctx) if $css_mode;
+
     eval {
         S2::run_code($ctx, $entry, $page, @args);
     };
+
+    # real work for header generating, now all res in NEED_RES
+    LJ::S2::subst_header($page);
+
     S2::Builtin::LJ::end_css($ctx) if $css_mode;
 
     $LJ::S2::CURR_PAGE = undef;
@@ -253,6 +258,11 @@
     return 1;
 }
 
+sub subst_header {
+    my ($page) = @_;
+    $$LJ::S2::ret_ref =~ s/<!\-\-SubstHeadContent\-\->/$page->{head_content}->subst_header()/e;
+}
+
 # <LJFUNC>
 # name: LJ::S2::get_tags_text
 # class: s2

Tags: amyshkin, livejournal, pm, zilogic
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