summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2010-03-14 03:07:48 (GMT)
committerDavid A. Madore <david+git@madore.org>2010-03-14 03:07:48 (GMT)
commit5e967253d5891a4f36e2df06f05915ffc75292a7 (patch)
tree86176a2627d18b7f70a1acad95d499ea88cdc1a2
parent1eaafea741f93b3198541bd501c4488879f13004 (diff)
downloadblogengine-5e967253d5891a4f36e2df06f05915ffc75292a7.zip
blogengine-5e967253d5891a4f36e2df06f05915ffc75292a7.tar.gz
blogengine-5e967253d5891a4f36e2df06f05915ffc75292a7.tar.bz2
Yet more annoying and painful stuff.
-rwxr-xr-xdaml2html.pl71
1 files changed, 70 insertions, 1 deletions
diff --git a/daml2html.pl b/daml2html.pl
index accd2ee..eb43e64 100755
--- a/daml2html.pl
+++ b/daml2html.pl
@@ -254,7 +254,7 @@ foreach my $in_mnode ( @in_metastuff ) {
my $out_navbar = $out_doc->createElementNS(XHTML_NS, "p");
$out_navbar->setAttributeNS("", "class", "navbar");
$out_body->appendChild($out_navbar);
- $out_head->appendChild($out_doc->createTextNode("\n"));
+ $out_body->appendChild($out_doc->createTextNode("\n"));
my $lang;
if ( defined($body_lang) && $body_lang eq "fr" ) {
$lang = "fr";
@@ -288,6 +288,41 @@ foreach my $in_mnode ( @in_metastuff ) {
$out_node->appendChild($out_doc->createTextNode("WebLog"));
}
+foreach my $in_translation ( @in_translations ) {
+ my $lang = $in_translation->getAttributeNS(XML_XML_NS, "lang");
+ die "xml:lang attribute missing on <translation>" unless defined($lang);
+ my $out_p = $out_doc->createElementNS(XHTML_NS, "p");
+ $out_p->setAttributeNS("", "class", "translation-offer");
+ $out_p->setAttributeNS(XML_XML_NS, "lang", $lang);
+ if ( $lang eq "fr" ) {
+ $out_p->appendChild($out_doc->createTextNode("[Une "));
+ } elsif ( $lang eq "en" ) {
+ $out_p->appendChild($out_doc->createTextNode("[An "));
+ } else {
+ $out_p->appendChild($out_doc->createTextNode("["));
+ }
+ my $out_a = $out_doc->createElementNS(XHTML_NS, "a");
+ $out_a->setAttributeNS("", "href", $file_name.".".$lang);
+ $out_a->setAttributeNS("", "hreflang", $lang);
+ if ( $lang eq "fr" ) {
+ $out_a->appendChild($out_doc->createTextNode("version française"));
+ } elsif ( $lang eq "en" ) {
+ $out_a->appendChild($out_doc->createTextNode("English version"));
+ } else {
+ $out_a->appendChild($out_doc->createTextNode($lang));
+ }
+ $out_p->appendChild($out_a);
+ if ( $lang eq "fr" ) {
+ $out_p->appendChild($out_doc->createTextNode(" de cette page est également disponible.]"));
+ } elsif ( $lang eq "en" ) {
+ $out_p->appendChild($out_doc->createTextNode(" of this page is also available.]"));
+ } else {
+ $out_p->appendChild($out_doc->createTextNode("]"));
+ }
+ $out_body->appendChild($out_p);
+ $out_body->appendChild($out_doc->createTextNode("\n"));
+}
+
if ( defined($in_body) ) {
foreach my $child ( $in_body->childNodes ) {
$out_doc->adoptNode($child);
@@ -295,6 +330,40 @@ if ( defined($in_body) ) {
}
}
+{
+ my $out_hr = $out_doc->createElementNS(XHTML_NS, "hr");
+ $out_hr->setAttributeNS("", "class", "cleared");
+ $out_body->appendChild($out_hr);
+ $out_body->appendChild($out_doc->createTextNode("\n"));
+ my $out_address = $out_doc->createElementNS(XHTML_NS, "address");
+ my $out_a = $out_doc->createElementNS(XHTML_NS, "a");
+ $out_a->setAttributeNS("", "href", $uri_to_top);
+ $out_a->appendChild($out_doc->createTextNode("David Madore"));
+ $out_address->appendChild($out_a);
+ $out_address->appendChild($out_doc->createTextNode(" ("));
+ # XXX - email address here
+ $out_address->appendChild($out_doc->createTextNode(")"));
+ $out_body->appendChild($out_address);
+ $out_body->appendChild($out_doc->createTextNode("\n"));
+}
+
+my $in_last_modified = ($xpc->findnodes("/daml/last-modified"))[0];
+if ( defined($in_last_modified) ) {
+ my $out_last_modified = $out_doc->createElementNS(XHTML_NS, "p");
+ $out_last_modified->setAttributeNS("", "class", "last-modified");
+ $out_body->appendChild($out_last_modified);
+ my $lang = rec_lang $in_last_modified;
+ my $str = $in_last_modified->textContent;
+ if ( defined($lang) && $lang eq "fr" ) {
+ $str = "Dernière modification : " . $str;
+ } elsif ( defined($lang) && $lang eq "en" ) {
+ $str = "Last modified: " . $str;
+ }
+ $out_last_modified->appendChild($out_doc->createTextNode($str));
+ set_rec_lang($out_last_modified, $lang);
+ $out_body->appendChild($out_doc->createTextNode("\n"));
+}
+
my $pure_style_content = "";
if ( open my $common_style_file, "<", "included.css" ) {
local $/;