diff --git a/filters/xhtml2html.plugin b/filters/xhtml2html.plugin index 3f13d3c..b3aaff8 100644 --- a/filters/xhtml2html.plugin +++ b/filters/xhtml2html.plugin @@ -16,9 +16,16 @@ for name,value in zip(sys.argv[1::2],sys.argv[2::2]): try: opts[name] = eval(value) except: opts[name] = value -from html5lib import liberalxmlparser, treewalkers, treebuilders, serializer -parser = liberalxmlparser.XHTMLParser(tree=treebuilders.getTreeBuilder('dom')) -tokens = treewalkers.getTreeWalker('dom')(parser.parse(sys.stdin)) +try: + from xml.dom import minidom + doc = minidom.parse(sys.stdin) +except: + from html5lib import liberalxmlparser, treebuilders + parser = liberalxmlparser.XHTMLParser(tree=treebuilders.getTreeBuilder('dom')) + doc = parser.parse(sys.stdin, encoding='utf-8') + +from html5lib import treewalkers, serializer +tokens = treewalkers.getTreeWalker('dom')(doc) serializer = serializer.HTMLSerializer(**dict(opts)) for text in serializer.serialize(tokens, encoding='utf-8'): sys.stdout.write(text) diff --git a/themes/asf/default.css b/themes/asf/default.css index e9bb56a..813e5f9 100644 --- a/themes/asf/default.css +++ b/themes/asf/default.css @@ -1,5 +1,6 @@ /* - * Written by Stefano Mazzocchi + * Originally written by Stefano Mazzocchi + * Adapted by Sam Ruby */ /* ----------------------------- Global Definitions -------------------- */ @@ -40,7 +41,7 @@ a.rising { a[rel~='license'] { text-decoration: none; -} +} body > h1 { font-size: x-large; @@ -48,10 +49,12 @@ body > h1 { letter-spacing: 0.25em; padding: 10px; margin: 0px 0px 0px 0px; - color: #000; - font-weight: normal; + color: #889; + font-family: Sans-Serif; + font-weight: bold; + font-style: italic; background-color: #eee; - border-bottom: 2px solid #bbb + border-bottom: 2px solid #ccd; } /* ----------------------------- Sidebar --------------------------- */ @@ -63,10 +66,12 @@ body > h1 { width: 210px; background-color: white; - padding: 0px 0px 20px 0px; + padding: 0px 0px 10px 0px; margin: 0px 0px 20px 20px; - border-left: 1px solid #ccc; - border-bottom: 1px solid #ccc; + border-left: 2px solid #ccd; + border-bottom: 2px solid #ccd; + -webkit-border-bottom-left-radius: 1em; + -moz-border-radius: 0 0 0 1em; } #sidebar h2 { @@ -75,16 +80,19 @@ body > h1 { font-size: x-small; color: #666; font-weight: normal; - padding: 2px 0px 2px 4px; + padding: 2px 0px 2px 12px; margin: 15px 0px 5px 10px; border-top: 1px solid #ccc; border-left: 1px solid #ccc; border-bottom: 1px solid #ccc; + -webkit-border-top-left-radius: 6px; + -webkit-border-bottom-left-radius: 6px; + -moz-border-radius: 6px 0 0 6px; } #sidebar h2 a img { - margin-bottom: 2px; - vertical-align: middle; + margin-bottom: 4px; + vertical-align: middle; } #sidebar p { @@ -128,6 +136,8 @@ body > h1 { #sidebar ul li:hover ul { background-color: #EEE; + -webkit-border-radius: 0.5em; + -moz-border-radius: 0.5em; border: 2px solid #BBB; color:#000; display: block; @@ -142,6 +152,7 @@ body > h1 { } #sidebar img { + margin-top: 2px; border: 0; } @@ -177,7 +188,12 @@ body > h1 { } #sidebar input[name=q] { - margin: 4px 0 0 24px; + padding-left: 0.5em; + border: 1px solid #ccd; + -webkit-border-radius: 0.8em; + -moz-border-radius: 0.8em; + width: 12.5em; + margin: 4px 0 0 24px; } /* ---------------------------- Footer --------------------------- */ @@ -213,16 +229,20 @@ body > h1 { } #body > h2 { + float: right; + min-width: 25%; + -webkit-border-top-left-radius: 0.5em; + -webkit-border-bottom-left-radius: 0.5em; + -moz-border-radius: 0.5em 0 0 0.5em; text-transform: none; font-size: medium; - color: #333; + color: #667; font-weight: bold; - text-align: right; - border-top: 1px solid #ccc; + text-align: center; + border: 2px solid #ccd; background-color: #eee; - border-bottom: 1px solid #ccc; - padding: 1px 15px 1px 5px; - margin: 0; + padding: 1px 1.5em 1px 1.5em; + margin: -0.2em -22px 0 0; } /* ----------------------------- News ---------------------------- */ @@ -473,7 +493,7 @@ ul.tags a:link, ul.tags a:visited { a[rel='tag'] img { border: 0; -} +} /* DiveIntoMark */ .framed { diff --git a/themes/asf/personalize.js b/themes/asf/personalize.js index 30478bb..c9e6be0 100644 --- a/themes/asf/personalize.js +++ b/themes/asf/personalize.js @@ -161,6 +161,7 @@ function localizeDate(element) { if (!date.getTime()) return; var local = date.toLocaleString(); + if (element.parentNode.nodeName == 'a') local = date.toLocaleTimeString(); var match = local.match(localere); if (match) { /* Firefox */ element.innerHTML = match[4] + ' ' + match[5].toLowerCase(); @@ -169,7 +170,7 @@ function localizeDate(element) { return days[date.getDay()] + ', ' + months[date.getMonth()] + ' ' + date.getDate() + ', ' + date.getFullYear(); } else { - local = local.replace(/GMT(-\d\d\d\d) \(.*\)$/, '$1'); /* Webkit */ + local = local.replace(/ GMT(-\d\d\d\d) \(.*\)$/, ''); /* Webkit */ element.title = element.innerHTML + ' GMT'; element.innerHTML = local; return days[date.getDay()] + ', ' + date.getDate() + ' ' + @@ -241,6 +242,10 @@ function moveSidebar() { if (sidebar.currentStyle && sidebar.currentStyle['float'] == 'none') return; if (window.getComputedStyle && document.defaultView.getComputedStyle(sidebar,null).getPropertyValue('float') == 'none') return; + var h1 = sidebar.previousSibling; + while (h1.nodeType != 1) h1=h1.previousSibling; + if (h1.nodeName.toLowerCase() == 'h1') h1.parentNode.removeChild(h1); + var footer = document.getElementById('footer'); var ul = footer.lastChild; while (ul.nodeType != 1) ul=ul.previousSibling; @@ -288,11 +293,4 @@ function personalize() { } // hook event -window.onload = personalize; -if (document.addEventListener) { - onDOMLoad = function() { - window.onload = undefined; - personalize(); - }; - document.addEventListener("DOMContentLoaded", onDOMLoad, false); -} +document.addEventListener("DOMContentLoaded", personalize, false);