Make it easier for themes to add their own CSS.
Patch by wyntarvox.
diffs (282 lines):
diff -r c907acdb61fd -r 98db9b31ef0b bin/upgrading/s2layers/bases/themes.s2
--- a/bin/upgrading/s2layers/bases/themes.s2 Fri Oct 16 04:58:28 2009 +0000
+++ b/bin/upgrading/s2layers/bases/themes.s2 Fri Oct 16 14:52:39 2009 +0000
@@ -36,24 +36,13 @@ set color_module_text = "#503125";
set color_module_text = "#503125";
set color_entry_background = "#f5e4da";
-function Page::print_default_stylesheets()
+function Page::print_theme_stylesheet()
{
- $this->print_default_stylesheet();
- if ($*external_stylesheet) {
- println safe """<link rel="stylesheet" href="$.stylesheet_url"
type="text/css" />""";
- }
- else {
- println """<style type="text/css">""";
- start_css();
- print_stylesheet();
- end_css();
- println """</style>""";
- }
- """<style type="text/css">
-/* ====================== HEADER ======================= */
+"""/* ====================== HEADER ======================= */
#header { border: none; }
- </style>""";
+""";
+
}
diff -r c907acdb61fd -r 98db9b31ef0b bin/upgrading/s2layers/core2.s2
--- a/bin/upgrading/s2layers/core2.s2 Fri Oct 16 04:58:28 2009 +0000
+++ b/bin/upgrading/s2layers/core2.s2 Fri Oct 16 14:52:39 2009 +0000
@@ -612,6 +612,9 @@ class Page
function print_default_stylesheet
"Prints the layout's base default stylesheet.";
+ function print_theme_stylesheet
+ "Prints theme-specific CSS. Should be overwritten by themes that include
CSS not part of the layout's default stylesheet.";
+
function builtin print_trusted(string key)
"Prints a trusted string by key.";
}
@@ -2872,6 +2875,12 @@ function Page::print_default_stylesheet(
"""</style>\n""";
}
+function Page::print_theme_stylesheet()
+"Prints theme-specific CSS. Should be overwritten by themes that include CSS
not part of the layout's default stylesheet."
+{
+
+}
+
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"
{
@@ -2886,10 +2895,17 @@ function Page::print_default_stylesheets
end_css();
println """</style>""";
}
+
+ println """<style type="text/css">""";
+ start_css();
+ $this->print_theme_stylesheet();
+ end_css();
+ println """</style>\n""";
+
}
function Page::print_stylesheets()
-"If you have specific CSS to code onto all themes using this layout, override
print_default_stylesheet. If you have specific CSS to code into this theme,
set the external_stylesheet property or override the print_stylesheet function.
An end user can choose to link to an off-site stylesheet using the
linked_stylesheet property and/or use the custom_css property. Overriding this
function is NOT RECOMMENDED. Overriding this function could prevent sitewide
improvements to styles, accessibility, or other functionality from operating in
your layout."
+"If you have specific CSS to code onto all themes using this layout, override
print_default_stylesheet. If you have specific CSS to code into this theme,
set the external_stylesheet property or override the
Page::print_theme_stylesheet function. An end user can choose to link to an
off-site stylesheet using the linked_stylesheet property and/or use the
custom_css property. Overriding this function is NOT RECOMMENDED. Overriding
this function could prevent sitewide improvements to styles, accessibility, or
other functionality from operating in your layout."
{
if ($*include_default_stylesheet) {
$this->print_default_stylesheets();
diff -r c907acdb61fd -r 98db9b31ef0b
bin/upgrading/s2layers/fluidmeasure/themes.s2
--- a/bin/upgrading/s2layers/fluidmeasure/themes.s2 Fri Oct 16 04:58:28
2009 +0000
+++ b/bin/upgrading/s2layers/fluidmeasure/themes.s2 Fri Oct 16 14:52:39
2009 +0000
@@ -63,25 +63,12 @@ set color_module_title_background = "#DB
set color_module_title_background = "#DBBD95";
set color_module_border = "#333";
-function Page::print_default_stylesheets() {
- $this->print_default_stylesheet();
-
- if ($*external_stylesheet) {
- println safe """<link rel="stylesheet" href="$.stylesheet_url"
type="text/css" />""";
- }
- else {
- println """<style type="text/css">""";
- start_css();
- print_stylesheet();
- end_css();
- println """</style>""";
- }
+function Page::print_theme_stylesheet() {
"""
- <style type="text/css">
.module-calendar .entry-day a { color: $*color_module_background
!important; }
- </style>
""";
+
}
#NEWLAYER: fluidmeasure/spice
diff -r c907acdb61fd -r 98db9b31ef0b
bin/upgrading/s2layers/funkycircles/themes.s2
--- a/bin/upgrading/s2layers/funkycircles/themes.s2 Fri Oct 16 04:58:28
2009 +0000
+++ b/bin/upgrading/s2layers/funkycircles/themes.s2 Fri Oct 16 14:52:39
2009 +0000
@@ -74,21 +74,10 @@ set image_module_list_active = "funkycir
set image_module_list_active =
"funkycircles/atomicorange-modulebulletactive.png";
set image_module_list_hover =
"funkycircles/atomicorange-modulebullethover.png";
-function Page::print_default_stylesheets()
+function Page::print_theme_stylesheet()
{
- $this->print_default_stylesheet();
- if ($*external_stylesheet) {
- println safe """<link rel="stylesheet" href="$.stylesheet_url"
type="text/css" />""";
- }
- else {
- println """<style type="text/css">""";
- start_css();
- print_stylesheet();
- end_css();
- println """</style>""";
- }
- """<style type="text/css">
+ """
/* Modules
***************************************************************************/
.module-calendar td.empty-day {
@@ -108,7 +97,8 @@ function Page::print_default_stylesheets
.module-calendar td.entry-day a:hover {
color: $*color_entry_text !important;
}
- </style>""";
+ """;
+
}
#NEWLAYER: funkycircles/chocolaterose
@@ -414,21 +404,10 @@ set image_module_list_active = "funkycir
set image_module_list_active =
"funkycircles/earthygreen-modulebulletactive.png";
set image_module_list_hover = "funkycircles/earthygreen-modulebullethover.png";
-function Page::print_default_stylesheets()
+function Page::print_theme_stylesheet()
{
- $this->print_default_stylesheet();
- if ($*external_stylesheet) {
- println safe """<link rel="stylesheet" href="$.stylesheet_url"
type="text/css" />""";
- }
- else {
- println """<style type="text/css">""";
- start_css();
- print_stylesheet();
- end_css();
- println """</style>""";
- }
- """<style type="text/css">
+ """
/* Modules
***************************************************************************/
.module-calendar td.entry-day a {
@@ -444,7 +423,8 @@ function Page::print_default_stylesheets
color: $*color_entry_text !important;
}
- </style>""";
+ """;
+
}
#NEWLAYER: funkycircles/industrialpink
@@ -521,21 +501,10 @@ set image_module_list_active = "funkycir
set image_module_list_active =
"funkycircles/industrial-modulebulletactive.png";
set image_module_list_hover = "funkycircles/industrial-modulebullethover.png";
-function Page::print_default_stylesheets()
+function Page::print_theme_stylesheet()
{
- $this->print_default_stylesheet();
- if ($*external_stylesheet) {
- println safe """<link rel="stylesheet" href="$.stylesheet_url"
type="text/css" />""";
- }
- else {
- println """<style type="text/css">""";
- start_css();
- print_stylesheet();
- end_css();
- println """</style>""";
- }
- """<style type="text/css">
+ """
/* Modules
***************************************************************************/
.module-calendar td.entry-day {
@@ -552,7 +521,8 @@ function Page::print_default_stylesheets
.module-calendar td.entry-day a:hover {
color: $*color_entry_text !important;
}
- </style>""";
+ """;
+
}
#NEWLAYER: funkycircles/industrialteal
@@ -631,21 +601,10 @@ set image_module_list_active = "funkycir
set image_module_list_active =
"funkycircles/industrial-modulebulletactive.png";
set image_module_list_hover = "funkycircles/industrial-modulebullethover.png";
-function Page::print_default_stylesheets()
+function Page::print_theme_stylesheet()
{
- $this->print_default_stylesheet();
- if ($*external_stylesheet) {
- println safe """<link rel="stylesheet" href="$.stylesheet_url"
type="text/css" />""";
- }
- else {
- println """<style type="text/css">""";
- start_css();
- print_stylesheet();
- end_css();
- println """</style>""";
- }
- """<style type="text/css">
+ """
/* Modules
***************************************************************************/
.module-calendar td.entry-day {
@@ -662,7 +621,8 @@ function Page::print_default_stylesheets
.module-calendar td.entry-day a:hover {
color: $*color_entry_text !important;
}
- </style>""";
+ """;
+
}
#NEWLAYER: funkycircles/nevermore
diff -r c907acdb61fd -r 98db9b31ef0b
bin/upgrading/s2layers/tranquilityiii/themes.s2
--- a/bin/upgrading/s2layers/tranquilityiii/themes.s2 Fri Oct 16 04:58:28
2009 +0000
+++ b/bin/upgrading/s2layers/tranquilityiii/themes.s2 Fri Oct 16 14:52:39
2009 +0000
@@ -97,27 +97,13 @@ set color_module_title_background = "#00
set color_module_title_background = "#000000";
set color_module_title = "#ffffff";
-function Page::print_default_stylesheets()
+function Page::print_theme_stylesheet()
{
- $this->print_default_stylesheet();
- if ($*external_stylesheet) {
- println safe """<link rel="stylesheet" href="$.stylesheet_url"
type="text/css" />""";
- }
- else {
- println """<style type="text/css">""";
- start_css();
- print_stylesheet();
- end_css();
- println """</style>""";
- }
- """<style type="text/css">
+ """.entry-title, .module-header { padding-left: .5em; }
+ .module-header { margin-bottom: .2em; }
+ .comment-title { padding: .3em; }""";
- .entry-title, .module-header { padding-left: .5em; }
- .module-header { margin-bottom: .2em; }
- .comment-title { padding: .3em; }
-
- </style>""";
}
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog