[interchange] Fix css.tag to properly output the css when using the inline <style> block
David Christensen
interchange-cvs at icdevgroup.org
Thu Mar 25 04:43:39 UTC 2010
commit c0e886bc2a294d7cc254a4f23afe280b3b583c5d
Author: David Christensen <david at endpoint.com>
Date: Tue Mar 23 22:46:02 2010 -0500
Fix css.tag to properly output the css when using the inline <style> block
css.tag attempts to write a file out to the filesystem after reading
in the css via either variable or literal. If the file path it
attempts to write to is not writable, for whatever reason, instead of
creating a <link> tag to the written file, it attempts to create a
<style> tag containing the css.
Currently, if it ever creates the style tag, it will never contain the
css. When the location is not writable, it skips the portion of code
that reads in the actual css, either from the literal option or the
contents of the variable.
This patch moves the reading of the css up to a point where it can't
be skipped, allowing both the link and style tags to be created
properly.
Report and patch by Justin Otten <justin.lasotten at gmail.com>
code/UserTag/css.tag | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/code/UserTag/css.tag b/code/UserTag/css.tag
index 1327baa..82db7c9 100644
--- a/code/UserTag/css.tag
+++ b/code/UserTag/css.tag
@@ -93,6 +93,11 @@ sub {
$extra .= qq{ media="$opt->{media}"} if $opt->{media};
my $css;
+ $css = length($opt->{literal})
+ ? $opt->{literal}
+ : interpolate_html($Tag->var($name));
+ $css =~ s/^\s*<style.*?>\s*//si;
+ $css =~ s:\s*</style>\s*$:\n:i;
WRITE: {
last WRITE unless $write;
@@ -111,11 +116,6 @@ sub {
last WRITE;
}
my $mode = $opt->{mode} ? oct($opt->{mode}) : 0644;
- $css = length($opt->{literal})
- ? $opt->{literal}
- : interpolate_html($Tag->var($name));
- $css =~ s/^\s*<style.*?>\s*//si;
- $css =~ s:\s*</style>\s*$:\n:i;
$success = $Tag->write_relative_file($fn, $css) && chmod($mode, $fn)
or logError("Error writing CSS file %s, returning in page", $fn);
}
More information about the interchange-cvs
mailing list