Enable by default the setting to use external stylesheets (instead of
embedding the CSS directly onto the page). Remove the "style" tags from within
Page::print_default_stylesheet().
If we're set to use an external stylesheet, combine the output of
Page::print_default_stylesheet, print_stylesheet, and
Page::print_theme_stylesheet into one external stylesheet. For this, we needed
to allow s2_run_code to execute multiple functions.
Patch by fu.
diffs (254 lines):
diff -r f0bd271ee863 -r 790c3b2ac7aa bin/upgrading/s2layers/bases/layout.s2
--- a/bin/upgrading/s2layers/bases/layout.s2 Mon Jun 28 14:44:37 2010 -0500
+++ b/bin/upgrading/s2layers/bases/layout.s2 Tue Jun 29 17:46:05 2010 +0800
@@ -296,7 +296,7 @@ if ($*image_background_header_height > 0
{ $header_background = """ $header_background height: """ +
$*image_background_header_height + """px;"""; }
if ($*image_background_header_url == "" ){}
-else { print """ <style type="text/css"> #title, #subtitle, #pagetitle
{display: none} </style> """; }
+else { print """ #title, #subtitle, #pagetitle {display: none}"""; }
var string userpic_css = "";
if ($*userpics_position == "left") {
@@ -312,8 +312,6 @@ else { print """ <style type="text/css">
""";
}
- """<style type="text/css">""";
- start_css();
"""
/* DREAMWIDTH :--- Bases. ---
Sven @ Fruitstyle.Dreamwidth.org
@@ -752,8 +750,4 @@ div.ContextualPopup .Userpic {border: 0.
$userpic_css
""";
-
- end_css();
- "</style>\n";
-
}
diff -r f0bd271ee863 -r 790c3b2ac7aa bin/upgrading/s2layers/blanket/layout.s2
--- a/bin/upgrading/s2layers/blanket/layout.s2 Mon Jun 28 14:44:37 2010 -0500
+++ b/bin/upgrading/s2layers/blanket/layout.s2 Tue Jun 29 17:46:05 2010 +0800
@@ -274,8 +274,6 @@ var string month_header_colors = generat
}
"""
-
-<style type="text/css">
/* Blanket */
body { padding: 0; margin: 0; text-align: center; $page_colors $page_font }
@@ -418,8 +416,6 @@ td.day { padding: 5px; border: 1px solid
.page-tags .tags-container ul li { margin: 0 0 0 1em; padding: 0; list-style:
none; }
$userpic_css
-
-</style>
""";
}
diff -r f0bd271ee863 -r 790c3b2ac7aa bin/upgrading/s2layers/brittle/layout.s2
--- a/bin/upgrading/s2layers/brittle/layout.s2 Mon Jun 28 14:44:37 2010 -0500
+++ b/bin/upgrading/s2layers/brittle/layout.s2 Tue Jun 29 17:46:05 2010 +0800
@@ -325,10 +325,7 @@ function Page::print_default_stylesheet(
""";
}
- """<style type="text/css">""";
- start_css();
"""
- <!--
body {
padding: 0;
$page_background
@@ -894,9 +891,6 @@ hr {
$userpic_css
-} --->
- """;
- end_css();
- "</style>\n";
+""";
}
diff -r f0bd271ee863 -r 790c3b2ac7aa bin/upgrading/s2layers/core2.s2
--- a/bin/upgrading/s2layers/core2.s2 Mon Jun 28 14:44:37 2010 -0500
+++ b/bin/upgrading/s2layers/core2.s2 Tue Jun 29 17:46:05 2010 +0800
@@ -1934,7 +1934,7 @@ property string custom_css {
string_mode = "css";
}
-set external_stylesheet = false;
+set external_stylesheet = true;
set include_default_stylesheet = true;
set linked_stylesheet = "";
set custom_css = "";
@@ -3118,24 +3118,19 @@ function Page::print_default_stylesheets
function Page::print_default_stylesheets()
"Contains the layout and theme default stylesheets. Themes and child layouts
may use this to disable the printing of the layout's base default stylesheet,
or to add theme-specific CSS bits. May be overriden on a per-layout/theme basis"
{
- $this->print_default_stylesheet();
if ($*external_stylesheet) {
+ # prints out the stylesheets for $this->print_default_stylesheet,
print_stylesheet(), and $this->print_theme_stylesheet
println safe """<link rel="stylesheet" href="$.stylesheet_url"
type="text/css" />""";
}
else {
println """<style type="text/css">""";
start_css();
+ $this->print_default_stylesheet();
print_stylesheet();
+ $this->print_theme_stylesheet();
end_css();
println """</style>""";
}
-
- println """<style type="text/css">""";
- start_css();
- $this->print_theme_stylesheet();
- end_css();
- println """</style>\n""";
-
}
function Page::print_stylesheets()
diff -r f0bd271ee863 -r 790c3b2ac7aa bin/upgrading/s2layers/core2base/layout.s2
--- a/bin/upgrading/s2layers/core2base/layout.s2 Mon Jun 28 14:44:37
2010 -0500
+++ b/bin/upgrading/s2layers/core2base/layout.s2 Tue Jun 29 17:46:05
2010 +0800
@@ -309,10 +309,7 @@ function Page::print_default_stylesheet(
var string module_font = generate_font_css($*font_module_text,
$*font_fallback, $*font_module_text_size, $*font_module_text_units);
var string module_title_font = generate_font_css($*font_module_heading,
$*font_fallback, $*font_module_heading_size, $*font_module_heading_units);
- """<style type="text/css">""";
- start_css();
"""
- <!--
H1, H2, H3 {
margin: .25em 0;
padding: .25em 0;
@@ -715,10 +712,7 @@ ul.userlite-interaction-links li {
}
.module-syndicate .module-content {
text-align: center;
-} --->
+}
""";
- end_css();
- "</style>\n";
-
}
diff -r f0bd271ee863 -r 790c3b2ac7aa bin/upgrading/s2layers/drifting/layout.s2
--- a/bin/upgrading/s2layers/drifting/layout.s2 Mon Jun 28 14:44:37 2010 -0500
+++ b/bin/upgrading/s2layers/drifting/layout.s2 Tue Jun 29 17:46:05 2010 +0800
@@ -301,9 +301,7 @@ function Page::print_default_stylesheet(
""";
}
- """<style type="text/css">""";
- start_css();
-"""
+ """
/* Main layout
***************************************************************************/
body {
@@ -913,8 +911,6 @@ function Page::print_default_stylesheet(
$userpic_css
""";
- end_css();
- "</style>\n";
}
# NavLinks Module, Need to override this so the title gets printed.
diff -r f0bd271ee863 -r 790c3b2ac7aa bin/upgrading/s2layers/easyread/layout.s2
--- a/bin/upgrading/s2layers/easyread/layout.s2 Mon Jun 28 14:44:37 2010 -0500
+++ b/bin/upgrading/s2layers/easyread/layout.s2 Tue Jun 29 17:46:05 2010 +0800
@@ -317,9 +317,6 @@ function Page::print_default_stylesheet
var string module_title_font = generate_font_css($*font_module_heading,
$*font_fallback, $*font_module_heading_size, $*font_module_heading_units);
-"""<style type="text/css">""";
-
-start_css();
"""/* Globals */
ul {
margin-top: 0;
@@ -688,6 +685,4 @@ div.page-top {
}
/* End of CSS file */""";
-end_css();
-"""</style>""";
}
diff -r f0bd271ee863 -r 790c3b2ac7aa bin/upgrading/s2layers/negatives/layout.s2
--- a/bin/upgrading/s2layers/negatives/layout.s2 Mon Jun 28 14:44:37
2010 -0500
+++ b/bin/upgrading/s2layers/negatives/layout.s2 Tue Jun 29 17:46:05
2010 +0800
@@ -319,9 +319,7 @@ function Page::print_default_stylesheet(
""";
}
- """<style type="text/css">""";
- start_css();
-"""
+ """
body {
margin: 0;
padding: 0;
@@ -696,8 +694,6 @@ function Page::print_default_stylesheet(
$userpic_css
""";
- end_css();
- "</style>\n";
}
#Print_body
diff -r f0bd271ee863 -r 790c3b2ac7aa
bin/upgrading/s2layers/skittlishdreams/layout.s2
--- a/bin/upgrading/s2layers/skittlishdreams/layout.s2 Mon Jun 28 14:44:37
2010 -0500
+++ b/bin/upgrading/s2layers/skittlishdreams/layout.s2 Tue Jun 29 17:46:05
2010 +0800
@@ -444,8 +444,6 @@ function Page::print_default_stylesheet
var string navigation_colors =
generate_color_css($*color_page_details_text, $*color_entry_background, new
Color);
- """<style type="text/css">""";
- start_css();
"""
/*
Theme Name: Skittlish Dreams, a DW port of Skittlish
@@ -708,7 +706,4 @@ blockquote {margin: 1em; padding: 1em; $
.journal-website-name { font-size: 1.6em; }
""";
- end_css();
- "</style>\n";
-
}
diff -r f0bd271ee863 -r 790c3b2ac7aa cgi-bin/LJ/S2.pm
--- a/cgi-bin/LJ/S2.pm Mon Jun 28 14:44:37 2010 -0500
+++ b/cgi-bin/LJ/S2.pm Tue Jun 29 17:46:05 2010 +0800
@@ -56,7 +56,7 @@ sub make_journal
if ($view eq "res") {
if ($opts->{'pathextra'} =~ m!/(\d+)/stylesheet$!) {
$styleid = $1;
- $entry = "print_stylesheet()";
+ $entry = [ qw( Page::print_default_stylesheet() print_stylesheet()
Page::print_theme_stylesheet() ) ];
$opts->{'contenttype'} = 'text/css';
$use_modtime = 1;
} else {
@@ -261,7 +261,12 @@ sub s2_run
S2::Builtin::LJ::start_css($ctx) if $css_mode;
eval {
- S2::run_code($ctx, $entry, $page);
+ if ( ref $entry ) {
+ S2::run_code( $ctx, $_, $page )
+ foreach ( @$entry );
+ } else {
+ S2::run_code( $ctx, $entry, $page );
+ }
};
S2::Builtin::LJ::end_css($ctx) if $css_mode;
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog