summaryrefslogtreecommitdiffstats
path: root/daml2html.pl
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2010-03-14 01:14:00 +0100
committerDavid A. Madore <david+git@madore.org>2010-03-14 01:14:00 +0100
commitad480a34ed432e6989ccad46268483343bc3e8ef (patch)
tree4628d66d2a8cc78bd57320e6315a9acb5b982b9a /daml2html.pl
parentd2e31598c8663f03dd571b53f4cf2e510f1d259b (diff)
downloadblogengine-ad480a34ed432e6989ccad46268483343bc3e8ef.zip
blogengine-ad480a34ed432e6989ccad46268483343bc3e8ef.tar.gz
blogengine-ad480a34ed432e6989ccad46268483343bc3e8ef.tar.bz2
Add <style> and <script> elements.
(With some yuckiness to put CDATA section nicely.)
Diffstat (limited to 'daml2html.pl')
-rwxr-xr-xdaml2html.pl30
1 files changed, 30 insertions, 0 deletions
diff --git a/daml2html.pl b/daml2html.pl
index bd23f32..774ee85 100755
--- a/daml2html.pl
+++ b/daml2html.pl
@@ -160,6 +160,7 @@ if ( defined($in_meta_keywords) ) {
$out_head->appendChild($out_meta_keywords);
$out_head->appendChild($out_doc->createTextNode("\n"));
}
+
my $in_body = ($xpc->findnodes("/daml/body"))[0];
if ( defined($in_body) ) {
foreach my $child ( $in_body->childNodes ) {
@@ -168,6 +169,35 @@ if ( defined($in_body) ) {
}
}
+my $pure_style_content = "";
+if ( open my $common_style_file, "<", "included.css" ) {
+ local $/;
+ $pure_style_content = <$common_style_file>;
+ close $common_style_file;
+}
+my $pure_script_content = "";
+if ( open my $common_script_file, "<", "included.js" ) {
+ local $/;
+ $pure_script_content = <$common_script_file>;
+ close $common_script_file;
+}
+
+my $out_style_section = $out_doc->createElementNS(XHTML_NS, "style");
+$out_head->appendChild($out_style_section);
+$out_head->appendChild($out_doc->createTextNode("\n"));
+$out_style_section->setAttributeNS("", "type", "text/css");
+$out_style_section->appendChild($out_doc->createTextNode("\n/* "));
+$out_style_section->appendChild($out_doc->createCDATASection(" */\n".$pure_style_content."/* "));
+$out_style_section->appendChild($out_doc->createTextNode(" */\n"));
+my $out_script_section = $out_doc->createElementNS(XHTML_NS, "script");
+$out_head->appendChild($out_script_section);
+$out_head->appendChild($out_doc->createTextNode("\n"));
+$out_script_section->setAttributeNS("", "type", "text/javascript");
+$out_script_section->setAttributeNS("", "defer", "defer");
+$out_script_section->appendChild($out_doc->createTextNode("\n// "));
+$out_script_section->appendChild($out_doc->createCDATASection("\n".$pure_script_content."// "));
+$out_script_section->appendChild($out_doc->createTextNode("\n"));
+
# sub map_children {
# my $fun = shift;
# my $node = shift;