diff options
author | dakkar <dakkar@thenautilus.net> | 2012-09-23 18:56:07 +0100 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2012-09-23 20:37:21 +0100 |
commit | 9c9a41ce0d3773040d4b9a62c4c99c62196c418d (patch) | |
tree | c3e3ab1d1ef1ae9c3d1fd66e8ae5bcb9e39573a3 /templates | |
parent | anime bump (diff) | |
download | thenautilus-9c9a41ce0d3773040d4b9a62c4c99c62196c418d.tar.gz thenautilus-9c9a41ce0d3773040d4b9a62c4c99c62196c418d.tar.bz2 thenautilus-9c9a41ce0d3773040d4b9a62c4c99c62196c418d.zip |
infrastructure for reviews
Diffstat (limited to 'templates')
-rw-r--r-- | templates/du2html-review.xsl | 71 | ||||
-rw-r--r-- | templates/du2html.xsl | 262 | ||||
-rw-r--r-- | templates/review-stars.svg | 135 |
3 files changed, 368 insertions, 100 deletions
diff --git a/templates/du2html-review.xsl b/templates/du2html-review.xsl new file mode 100644 index 0000000..b190c59 --- /dev/null +++ b/templates/du2html-review.xsl @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="utf-8"?> +<x:stylesheet xmlns:x="http://www.w3.org/1999/XSL/Transform" + xmlns="http://www.w3.org/1999/xhtml" + xmlns:e="http://exslt.org/common" + xmlns:s="http://exslt.org/strings" + xmlns:wc="http://webcoso.thenautilus.net/" + exclude-result-prefixes="wc e s" + version="1.0" + > + + <x:import href="du2html.xsl" /> + + <x:variable name="const-local-rtf"> + <t t="rating" l="it">Voto: </t> <t t="rating" l="en">Rating: </t> + <t t="original" l="it">Questa recensione è stata pubblicata originariamente presso: </t> + <t t="original" l="en">This review was originally published at: </t> + </x:variable> + <x:variable name="const-local" select="e:node-set($const-local-rtf)/node()" /> + + <x:template match="/document" mode="title"> + <x:variable name="rating" select="/document/docinfo/field[field_name='rating']/field_body"/> + <x:apply-imports/> + <h2 class="rating"> + <x:value-of select="$const-local[@t='rating' and @l=$language]"/> + <span class="rating-value"><x:value-of select="$rating"/></span> + <span class="rating-img"> + <x:call-template name="star-sequence"> + <x:with-param name="value" select="number($rating)"/> + <x:with-param name="max" select="5"/> + </x:call-template> + </span> + </h2> + </x:template> + + <x:template match="/document" mode="stylesheet-global"> + <x:apply-imports/> + <link rel="stylesheet" type="text/css" href="/reviews.css" /> + </x:template> + + <x:template match="/document" mode="bottomnav"> + <x:apply-templates select="." mode="original-review"/> + <x:apply-imports/> + </x:template> + + <x:template match="/document" mode="original-review"> + <x:variable name="link" select="/document/docinfo/field[field_name='original']/field_body"/> + <x:if test="string-length($link) > 0"> + <div id="original-review"> + <x:value-of select="$const-local[@t='original' and @l=$language]"/> + <a href="{$link}"><x:value-of select="$link"/></a> + </div> + </x:if> + </x:template> + + <x:template name="star-sequence"> + <x:param name="value"/> + <x:param name="max"/> + <x:choose> + <x:when test="$value > 1"><img src="/full-star.svg" style="width: 2em; height: 2em" /></x:when> + <x:when test="$value > 0"><img src="/half-star.svg" style="width: 2em; height: 2em" /></x:when> + <x:otherwise><img src="/empty-star.svg" style="width: 2em; height: 2em" /></x:otherwise> + </x:choose> + <x:if test="$max > 1"> + <x:call-template name="star-sequence"> + <x:with-param name="value" select="$value - 1"/> + <x:with-param name="max" select="$max - 1"/> + </x:call-template> + </x:if> + </x:template> + +</x:stylesheet>
\ No newline at end of file diff --git a/templates/du2html.xsl b/templates/du2html.xsl index 6d77a6c..c16998c 100644 --- a/templates/du2html.xsl +++ b/templates/du2html.xsl @@ -165,20 +165,9 @@ <html xml:lang="{$language}" lang="{$language}"> <head> <title><x:value-of select="normalize-space(title)"/></title> - <link rel="stylesheet" type="text/css" href="/layout.css" media="screen" /> - <link rel="stylesheet" type="text/css" href="/print.css" media="print" /> - <link rel="stylesheet" type="text/css" href="/html4css1.css" /> - <link rel="stylesheet" type="text/css" href="/content.css" /> + <x:apply-templates select="." mode="stylesheet" /> <link rel="icon" type="image/png" href="/favicon.png" /> <x:apply-templates select="docinfo/field[field_name='feed']"/> - <x:for-each select="docinfo/field[field_name='css']/field_body/*/list_item|docinfo/field[field_name='css']/field_body/paragraph"> - <link rel="stylesheet" type="text/css" href="{normalize-space(.)}" /> - </x:for-each> - <x:for-each select="docinfo/field[field_name='inline-css']/field_body"> - <style type="text/css"> - <x:value-of select="." disable-output-escaping="yes" /> - </style> - </x:for-each> <x:apply-templates select="docinfo" mode="nav-links" /> <x:if test="$path = ''"> <!-- root / index document --> <meta name="google-site-verification" content="NStibYPYcJWPVXEJMnjEOvQazfKubbaz3TrEi64my-Y" /> @@ -187,109 +176,182 @@ <body> <div id="wrapper"> <div id="toplink"> - <a href="/"><img src="/logo.png" alt="thenautilus.net"/></a> + <x:apply-templates select="." mode="top"/> </div> <div id="title"> - <h1 class="title"> - <x:apply-templates select="title/node()"/> - </h1> - <x:if test="subtitle"> - <h2 class="subtitle"> - <x:apply-templates select="subtitle/node()"/> - </h2> - </x:if> + <x:apply-templates select="." mode="title"/> </div> <div id="main-col"> - <x:apply-templates select="docinfo" mode="tags" /> - <x:call-template name="alternate-langs" /> + <x:apply-templates select="." mode="topnav"/> <div id="content"> - <x:apply-templates/> + <x:apply-templates select="." mode="content"/> </div> - <x:call-template name="dates" /> + <x:apply-templates select="." mode="bottomnav"/> </div> <div id="sidebar"> - <x:apply-templates select="docinfo" mode="nav-block" /> - <div class="nav" id="nav-tags"> - <span class="title"><x:value-of select="$const-tr[@t='navtags' and @l=$language]" /></span> - <ul> - <li><x:call-template name="taglink"><x:with-param name="tag">hardware</x:with-param></x:call-template></li> - <li><x:call-template name="taglink"><x:with-param name="tag">software</x:with-param></x:call-template></li> - <x:if test="$language = 'it'"> <!-- non ci sono racconti in inglese, per ora --> - <li><x:call-template name="taglink"><x:with-param name="tag">racconti</x:with-param></x:call-template></li> - </x:if> - <li><x:call-template name="taglink"><x:with-param name="tag">viaggi</x:with-param></x:call-template></li> - </ul> - <a href="{wc:dst-uri-for('/tags/')}"><x:value-of select="$const-tr[@t='alltags' and @l=$language]"/></a> - <hr /> - <a href="{wc:dst-uri-for('/contacts/')}"><x:apply-templates select="wc:title-for($language,$filename,'/contacts/')/node()" /></a> - </div> - <!-- twitter --> - <div id="twtr-profile-widget"></div> - <script src="http://widgets.twimg.com/j/2/widget.js"></script> - <script> - new TWTR.Widget({ - version: 2, - type: 'profile', - id: 'twtr-profile-widget', - rpp: 4, - interval: 6000, - width: 150, - height: 100, - theme: { - shell: { - background: '#2b687c', - color: '#eeeeee' - }, - tweets: { - background: '#b3dbe9', - color: '#444444', - links: '#1985b5' - } - }, - features: { - scrollbar: false, - loop: true, - live: true, - hashtags: true, - timestamp: true, - avatars: false, - behavior: 'all' - } - }).render().setUser('dakkar').start(); - </script> - <!-- amazon --> - <div id="amazon-wishlist"> - <a href="http://www.amazon.co.uk/registry/wishlist/INP247PNKQSZ"> - <x:value-of select="$const-tr[@t='wishlist' and @l=$language]"/> - </a> - </div> + <x:apply-templates select="." mode="sidebar"/> </div> <div id="push"></div> </div> <div id="footer"> - <p class="license"> - <a rel="license" href="http://creativecommons.org/licenses/by-sa/2.5/it/"> - <img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/2.5/it/88x31.png" /> - </a> - “<span xmlns:dc="http://purl.org/dc/elements/1.1/" href="http://purl.org/dc/dcmitype/Text" property="dc:title" rel="dc:type"> - <x:value-of select="normalize-space(/document/title)"/> - </span>” - <x:value-of select="$const-tr[@t='by' and @l=$language]"/> - <a xmlns:cc="http://creativecommons.org/ns#" href="mailto:dakkar@thenautilus.net" property="cc:attributionName" rel="cc:attributionURL">Gianni Ceccarelli</a> - <x:value-of select="$const-tr[@t='license' and @l=$language]"/> - <a rel="license" href="http://creativecommons.org/licenses/by-sa/2.5/it/">Creative Commons By-SA 2.5 It</a>. - </p> - <p class="contacts"> - <x:value-of select="$const-tr[@t='comments' and @l=$language]"/> - <a href="mailto:dakkar@thenautilus.net?subject={s:encode-uri(concat($const-tr[@t='mailsubj' and @l=$language],normalize-space(string(/document/title))),false)}"> - <x:value-of select="$const-tr[@t='writeme' and @l=$language]"/> - </a>. - </p> + <x:apply-templates select="." mode="footer"/> </div> </body> </html> </x:template> + <x:template match="/document" mode="top"> + <a href="/"><img src="/logo.png" alt="thenautilus.net"/></a> + </x:template> + + <x:template match="/document" mode="title"> + <h1 class="title"> + <x:apply-templates select="title/node()"/> + </h1> + <x:if test="subtitle"> + <h2 class="subtitle"> + <x:apply-templates select="subtitle/node()"/> + </h2> + </x:if> + </x:template> + + <x:template match="/document" mode="stylesheet"> + <x:apply-templates select="." mode="stylesheet-global"/> + <x:apply-templates select="." mode="stylesheet-local"/> + </x:template> + + <x:template match="/document" mode="stylesheet-global"> + <link rel="stylesheet" type="text/css" href="/layout.css" media="screen" /> + <link rel="stylesheet" type="text/css" href="/print.css" media="print" /> + <link rel="stylesheet" type="text/css" href="/html4css1.css" /> + <link rel="stylesheet" type="text/css" href="/content.css" /> + </x:template> + + <x:template match="/document" mode="stylesheet-local"> + <x:for-each select="docinfo/field[field_name='css']/field_body/*/list_item|docinfo/field[field_name='css']/field_body/paragraph"> + <link rel="stylesheet" type="text/css" href="{normalize-space(.)}" /> + </x:for-each> + <x:for-each select="docinfo/field[field_name='inline-css']/field_body"> + <style type="text/css"> + <x:value-of select="." disable-output-escaping="yes" /> + </style> + </x:for-each> + </x:template> + + <x:template match="/document" mode="topnav"> + <x:apply-templates select="docinfo" mode="tags" /> + <x:apply-templates select="." mode="alternate-langs" /> + </x:template> + + <x:template match="/document" mode="content"> + <x:apply-templates/> + </x:template> + + <x:template match="/document" mode="bottomnav"> + <x:apply-templates select="." mode="dates" /> + </x:template> + + <x:template match="/document" mode="sidebar"> + <x:apply-templates select="." mode="navblock"/> + <x:apply-templates select="." mode="navtags"/> + <x:apply-templates select="." mode="twitter"/> + <x:apply-templates select="." mode="amazon"/> + </x:template> + + <x:template match="/document" mode="navblock"> + <x:apply-templates select="docinfo" mode="nav-block" /> + </x:template> + + <x:template match="/document" mode="navtags"> + <div class="nav" id="nav-tags"> + <span class="title"><x:value-of select="$const-tr[@t='navtags' and @l=$language]" /></span> + <ul> + <li><x:call-template name="taglink"><x:with-param name="tag">hardware</x:with-param></x:call-template></li> + <li><x:call-template name="taglink"><x:with-param name="tag">software</x:with-param></x:call-template></li> + <x:if test="$language = 'it'"> <!-- non ci sono racconti in inglese, per ora --> + <li><x:call-template name="taglink"><x:with-param name="tag">racconti</x:with-param></x:call-template></li> + </x:if> + <li><x:call-template name="taglink"><x:with-param name="tag">viaggi</x:with-param></x:call-template></li> + </ul> + <a href="{wc:dst-uri-for('/tags/')}"><x:value-of select="$const-tr[@t='alltags' and @l=$language]"/></a> + <hr /> + <a href="{wc:dst-uri-for('/contacts/')}"><x:apply-templates select="wc:title-for($language,$filename,'/contacts/')/node()" /></a> + </div> + </x:template> + + <x:template match="/document" mode="twitter"> + <div id="twtr-profile-widget"></div> + <script src="http://widgets.twimg.com/j/2/widget.js"></script> + <script> + new TWTR.Widget({ + version: 2, + type: 'profile', + id: 'twtr-profile-widget', + rpp: 4, + interval: 6000, + width: 150, + height: 100, + theme: { + shell: { + background: '#2b687c', + color: '#eeeeee' + }, + tweets: { + background: '#b3dbe9', + color: '#444444', + links: '#1985b5' + } + }, + features: { + scrollbar: false, + loop: true, + live: true, + hashtags: true, + timestamp: true, + avatars: false, + behavior: 'all' + } + }).render().setUser('dakkar').start(); + </script> + </x:template> + + <x:template match="/document" mode="amazon"> + <div id="amazon-wishlist"> + <a href="http://www.amazon.co.uk/registry/wishlist/INP247PNKQSZ"> + <x:value-of select="$const-tr[@t='wishlist' and @l=$language]"/> + </a> + </div> + </x:template> + + <x:template match="/document" mode="footer"> + <x:apply-templates select="." mode="license"/> + <x:apply-templates select="." mode="contacts"/> + </x:template> + + <x:template match="/document" mode="license"> + <p class="license"> + <a rel="license" href="http://creativecommons.org/licenses/by-sa/2.5/it/"> + <img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/2.5/it/88x31.png" /> + </a> + “<span xmlns:dc="http://purl.org/dc/elements/1.1/" href="http://purl.org/dc/dcmitype/Text" property="dc:title" rel="dc:type"> + <x:value-of select="normalize-space(/document/title)"/> + </span>” + <x:value-of select="$const-tr[@t='by' and @l=$language]"/> + <a xmlns:cc="http://creativecommons.org/ns#" href="mailto:dakkar@thenautilus.net" property="cc:attributionName" rel="cc:attributionURL">Gianni Ceccarelli</a> + <x:value-of select="$const-tr[@t='license' and @l=$language]"/> + <a rel="license" href="http://creativecommons.org/licenses/by-sa/2.5/it/">Creative Commons By-SA 2.5 It</a>. + </p> + </x:template> + + <x:template match="/document" mode="contacts"> + <p class="contacts"> + <x:value-of select="$const-tr[@t='comments' and @l=$language]"/> + <a href="mailto:dakkar@thenautilus.net?subject={s:encode-uri(concat($const-tr[@t='mailsubj' and @l=$language],normalize-space(string(/document/title))),false)}"> + <x:value-of select="$const-tr[@t='writeme' and @l=$language]"/> + </a>. + </p> + </x:template> + <x:template name="taglink"> <x:param name="tag"/> <a href="{wc:dst-uri-for(concat('/tags/',$tag,'/'))}"> @@ -297,7 +359,7 @@ </a> </x:template> - <x:template name="dates"> + <x:template match="/document" mode="dates"> <x:variable name="d" select="wc:dates-for($language,$filename,'./')/wc:dates"/> <div id="dates"> <span class="title"><x:value-of select="$const-tr[@t='dates' and @l=$language]" /></span> @@ -313,7 +375,7 @@ </div> </x:template> - <x:template name="alternate-langs"> + <x:template match="/document" mode="alternate-langs"> <x:variable name="me" select="wc:dst-uri-for('.',/document/@source,1)" /> <x:variable name="alts"> <x:for-each select="wc:changes()/wc:changes/wc:document[@uri=$me]"> diff --git a/templates/review-stars.svg b/templates/review-stars.svg new file mode 100644 index 0000000..1d2e7ef --- /dev/null +++ b/templates/review-stars.svg @@ -0,0 +1,135 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="744.09448819" + height="1052.3622047" + id="svg2" + version="1.1" + inkscape:version="0.48.3.1 r9886" + sodipodi:docname="review-stars.svg"> + <defs + id="defs4"> + <linearGradient + id="linearGradient3773"> + <stop + style="stop-color:#ffe168;stop-opacity:1;" + offset="0" + id="stop3775" /> + <stop + id="stop3781" + offset="0.50773966" + style="stop-color:#ffe168;stop-opacity:1;" /> + <stop + style="stop-color:#000000;stop-opacity:0;" + offset="0.50773966" + id="stop3783" /> + <stop + style="stop-color:#000000;stop-opacity:0;" + offset="1" + id="stop3777" /> + </linearGradient> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3773" + id="linearGradient3779" + x1="162.87965" + y1="252.91232" + x2="328.0929" + y2="252.91232" + gradientUnits="userSpaceOnUse" /> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="0.78205015" + inkscape:cx="152.1125" + inkscape:cy="526.18109" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="false" + inkscape:window-width="1398" + inkscape:window-height="999" + inkscape:window-x="1400" + inkscape:window-y="25" + inkscape:window-maximized="0" /> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1"> + <path + sodipodi:type="star" + style="fill:#ffe268;fill-opacity:1;stroke:#ffbc5f;stroke-width:14;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + id="path2985" + sodipodi:sides="5" + sodipodi:cx="245.50854" + sodipodi:cy="260.85284" + sodipodi:r1="83.154213" + sodipodi:r2="46.895828" + sodipodi:arg1="-1.5707963" + sodipodi:arg2="-0.65378518" + inkscape:flatsided="false" + inkscape:rounded="0" + inkscape:randomized="0" + d="m 245.50855,177.69863 37.22531,54.63239 41.85904,2.82576 -40.45523,52.28571 10.24769,40.68353 -62.22802,-22.31804 -35.52562,22.31803 1.9962,-66.07902 -32.20373,-26.89021 63.46174,-18.52104 z" + inkscape:transform-center-y="-7.9405204" /> + <path + transform="translate(-2.5573731,206.13752)" + sodipodi:type="star" + style="fill:url(#linearGradient3779);fill-opacity:1;stroke:#ffbc5f;stroke-width:14;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + id="path2985-6" + sodipodi:sides="5" + sodipodi:cx="245.50854" + sodipodi:cy="260.85284" + sodipodi:r1="83.154213" + sodipodi:r2="46.895828" + sodipodi:arg1="-1.5707963" + sodipodi:arg2="-0.65378518" + inkscape:flatsided="false" + inkscape:rounded="0" + inkscape:randomized="0" + d="m 245.50855,177.69863 37.22531,54.63239 41.85904,2.82576 -40.45523,52.28571 10.24769,40.68353 -62.22802,-22.31804 -35.52562,22.31803 1.9962,-66.07902 -32.20373,-26.89021 63.46174,-18.52104 z" + inkscape:transform-center-y="-7.9405204" /> + <path + transform="translate(-10.22952,423.51488)" + sodipodi:type="star" + style="fill:none;fill-opacity:1;stroke:#ffbc5f;stroke-width:14;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + id="path2985-3" + sodipodi:sides="5" + sodipodi:cx="245.50854" + sodipodi:cy="260.85284" + sodipodi:r1="83.154213" + sodipodi:r2="46.895828" + sodipodi:arg1="-1.5707963" + sodipodi:arg2="-0.65378518" + inkscape:flatsided="false" + inkscape:rounded="0" + inkscape:randomized="0" + d="m 245.50855,177.69863 37.22531,54.63239 41.85904,2.82576 -40.45523,52.28571 10.24769,40.68353 -62.22802,-22.31804 -35.52562,22.31803 1.9962,-66.07902 -32.20373,-26.89021 63.46174,-18.52104 z" + inkscape:transform-center-y="-7.9405204" /> + </g> +</svg> |