summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2012-09-23 18:56:07 +0100
committerdakkar <dakkar@thenautilus.net>2012-09-23 20:37:21 +0100
commit9c9a41ce0d3773040d4b9a62c4c99c62196c418d (patch)
treec3e3ab1d1ef1ae9c3d1fd66e8ae5bcb9e39573a3
parentanime bump (diff)
downloadthenautilus-9c9a41ce0d3773040d4b9a62c4c99c62196c418d.tar.gz
thenautilus-9c9a41ce0d3773040d4b9a62c4c99c62196c418d.tar.bz2
thenautilus-9c9a41ce0d3773040d4b9a62c4c99c62196c418d.zip
infrastructure for reviews
-rw-r--r--additions/empty-star.svg78
-rw-r--r--additions/full-star.svg73
-rw-r--r--additions/half-star.svg147
-rw-r--r--additions/reviews.css28
-rwxr-xr-xnew-doc27
-rw-r--r--templates/du2html-review.xsl71
-rw-r--r--templates/du2html.xsl262
-rw-r--r--templates/review-stars.svg135
-rw-r--r--website.bashcomp67
9 files changed, 769 insertions, 119 deletions
diff --git a/additions/empty-star.svg b/additions/empty-star.svg
new file mode 100644
index 0000000..91c559d
--- /dev/null
+++ b/additions/empty-star.svg
@@ -0,0 +1,78 @@
+<?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:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="165.16872"
+ height="157.42738"
+ id="svg3971"
+ version="1.1"
+ inkscape:version="0.48.3.1 r9886"
+ sodipodi:docname="empty-star.svg">
+ <defs
+ id="defs3973" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.35"
+ inkscape:cx="375"
+ inkscape:cy="520.00131"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:window-width="777"
+ inkscape:window-height="585"
+ inkscape:window-x="274"
+ inkscape:window-y="143"
+ inkscape:window-maximized="0"
+ units="cm"
+ fit-margin-top="0"
+ fit-margin-left="0"
+ fit-margin-right="0"
+ fit-margin-bottom="0" />
+ <metadata
+ id="metadata3976">
+ <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"
+ transform="translate(4.7467285e-7,-894.9348)">
+ <path
+ transform="translate(-159.42419,717.23617)"
+ sodipodi:type="star"
+ style="fill:none;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>
diff --git a/additions/full-star.svg b/additions/full-star.svg
new file mode 100644
index 0000000..1b0d05c
--- /dev/null
+++ b/additions/full-star.svg
@@ -0,0 +1,73 @@
+<?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:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ width="172.21875"
+ height="164.28125"
+ id="svg3804"
+ inkscape:version="0.48.3.1 r9886"
+ sodipodi:docname="full-star.svg">
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="772"
+ inkscape:window-height="550"
+ id="namedview4055"
+ showgrid="false"
+ fit-margin-top="0"
+ fit-margin-left="0"
+ fit-margin-right="0"
+ fit-margin-bottom="0"
+ inkscape:zoom="0.22425739"
+ inkscape:cx="-35.042426"
+ inkscape:cy="95.317898"
+ inkscape:window-x="462"
+ inkscape:window-y="255"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg3804" />
+ <defs
+ id="defs3806" />
+ <metadata
+ id="metadata3809">
+ <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 />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <path
+ transform="translate(-159.42419,-170.84477)"
+ 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" />
+</svg>
diff --git a/additions/half-star.svg b/additions/half-star.svg
new file mode 100644
index 0000000..a129c4d
--- /dev/null
+++ b/additions/half-star.svg
@@ -0,0 +1,147 @@
+<?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"
+ version="1.1"
+ width="172.21875"
+ height="164.28125"
+ id="svg3849"
+ inkscape:version="0.48.3.1 r9886"
+ sodipodi:docname="half-star.svg">
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="640"
+ inkscape:window-height="480"
+ id="namedview4069"
+ showgrid="false"
+ fit-margin-top="0"
+ fit-margin-left="0"
+ fit-margin-right="0"
+ fit-margin-bottom="0"
+ inkscape:zoom="0.22425739"
+ inkscape:cx="-75.886179"
+ inkscape:cy="90.719659"
+ inkscape:window-x="70"
+ inkscape:window-y="389"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg3849" />
+ <defs
+ id="defs3851">
+ <linearGradient
+ x1="162.87965"
+ y1="252.91232"
+ x2="328.0929"
+ y2="252.91232"
+ id="linearGradient3779"
+ xlink:href="#linearGradient3773"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ id="linearGradient3773">
+ <stop
+ id="stop3775"
+ style="stop-color:#68c5ff;stop-opacity:1"
+ offset="0" />
+ <stop
+ id="stop3781"
+ style="stop-color:#68c5ff;stop-opacity:1"
+ offset="0.50773966" />
+ <stop
+ id="stop3783"
+ style="stop-color:#68c5ff;stop-opacity:0"
+ offset="0.50773966" />
+ <stop
+ id="stop3777"
+ style="stop-color:#68c5ff;stop-opacity:0"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ x1="162.87965"
+ y1="252.91232"
+ x2="328.0929"
+ y2="252.91232"
+ id="linearGradient3874"
+ xlink:href="#linearGradient3773"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3773-4"
+ id="linearGradient3779-5"
+ x1="162.87965"
+ y1="252.91232"
+ x2="328.0929"
+ y2="252.91232"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ id="linearGradient3773-4">
+ <stop
+ style="stop-color:#ffe168;stop-opacity:1;"
+ offset="0"
+ id="stop3775-3" />
+ <stop
+ id="stop3781-8"
+ offset="0.50773966"
+ style="stop-color:#ffe168;stop-opacity:1;" />
+ <stop
+ style="stop-color:#000000;stop-opacity:0;"
+ offset="0.50773966"
+ id="stop3783-0" />
+ <stop
+ style="stop-color:#000000;stop-opacity:0;"
+ offset="1"
+ id="stop3777-6" />
+ </linearGradient>
+ <linearGradient
+ y2="252.91232"
+ x2="328.0929"
+ y1="252.91232"
+ x1="162.87965"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient4106"
+ xlink:href="#linearGradient3773-4"
+ inkscape:collect="always" />
+ </defs>
+ <metadata
+ id="metadata3854">
+ <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 />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <path
+ transform="translate(-159.42419,-170.84477)"
+ sodipodi:type="star"
+ style="fill:url(#linearGradient4106);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" />
+</svg>
diff --git a/additions/reviews.css b/additions/reviews.css
new file mode 100644
index 0000000..a407673
--- /dev/null
+++ b/additions/reviews.css
@@ -0,0 +1,28 @@
+#original-review {
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ border-radius: 5px;
+ width: 80%;
+ border: solid 1px transparent;
+ position: relative;
+ background: #1f7a98;
+ color: #eeeeee;
+ padding: 0.2em;
+ margin: 0.5em auto;
+}
+
+h2.rating {
+ font-size: 1em;
+ margin: 0.5em;
+ padding-left: 3em;
+}
+
+h2.rating img {
+ width: 2em;
+ height: 2em;
+ margin: 0 0.2em;
+}
+
+@media screen, print {
+ h2.rating span.rating-value { display: none }
+} \ No newline at end of file
diff --git a/new-doc b/new-doc
index 9c0f0c4..d99c79d 100755
--- a/new-doc
+++ b/new-doc
@@ -2,9 +2,7 @@
here="$(cd "$(dirname "$0")";pwd)";
cd "$(dirname "$0")"/src
-if [[ $# -eq 0 ]]; then
- cat <<EOF
-new-doc - create new documents for WebCoso
+usage="new-doc - create new documents for WebCoso
Usage:
@@ -14,8 +12,11 @@ The <document path> will be taken relative to
$(pwd)
Non-existent tags will be created
-EOF
-exit 1
+"
+
+if [[ $# -eq 0 ]]; then
+ >&2 echo "$usage"
+ exit 1
fi
shopt -s extglob
@@ -23,10 +24,16 @@ shopt -s extglob
now="$(TZ=UTC date +'%F %T')"
force=0
-if [[ "$1" == "-f" ]]; then
- force=1
- shift
-fi
+kind=''
+while getopts fk: optname; do
+ case "$optname" in
+ f) force=1 ;;
+ k) kind="$OPTARG" ;;
+ ?) echo "$usage"; exit 2 ;;
+ esac
+done
+shift $[ $OPTIND - 1 ]
+
docname="$1"
shift
declare -a tags
@@ -71,7 +78,7 @@ EOF
echo "/document.${lang}.du.xml" >> "${docname}/.gitignore"
done
-ln -s "${docname//+([^\/])/..}"/../templates/du2html.xsl "$docname"/
+ln -s "${docname//+([^\/])/..}"/../templates/du2html${kind:+"-$kind"}.xsl "$docname"/du2html.xsl
cd "$here"
./new-tag "${tags[@]}"
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) &gt; 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 &gt; 1"><img src="/full-star.svg" style="width: 2em; height: 2em" /></x:when>
+ <x:when test="$value &gt; 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 &gt; 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>
diff --git a/website.bashcomp b/website.bashcomp
index 04682ed..b1e7889 100644
--- a/website.bashcomp
+++ b/website.bashcomp
@@ -1,33 +1,82 @@
_website_filedir() {
- local IFS=$'\n' xspec
+ local IFS=$'\n'
- _expand || return 0
+ _tilde "$cur" || return 0
local -a toks
- local tmp
-
+ local quoted tmp
+
+ _quote_readline_by_ref "$cur" quoted
toks=( ${toks[@]-} $(
- compgen -d -X "$1" -- "$(quote_readline "$cur")" | {
+ compgen -d -X "$1" -- "$quoted" | {
while read -r tmp; do
- [ -n "$tmp" ] && echo "${tmp}/"
+ printf '%s/\n' $tmp
done
}
))
+ [ ${#toks[@]} -ne 0 ] && _compopt_o_filenames
+
+ COMPREPLY=( "${COMPREPLY[@]}" "${toks[@]}" )
+}
+
+_website_kinds() {
+ local IFS=$'\n'
+
+ _tilde "$cur" || return 0
+
+ local -a toks
+ local quoted tmp
+
+ _quote_readline_by_ref "$cur" quoted
+ pushd templates >/dev/null
+ toks=( ${toks[@]-} $(
+ compgen -f -X "!du2html-*.xsl" -- "$quoted" | {
+ while read -r tmp; do
+ tmp="${tmp#du2html-}"
+ tmp="${tmp%.xsl}"
+ printf '%s\n' $tmp
+ done
+ }
+ ))
+ popd >/dev/null
+
+ [ ${#toks[@]} -ne 0 ] && _compopt_o_filenames
+
COMPREPLY=( "${COMPREPLY[@]}" "${toks[@]}" )
}
_website_newdoc() {
local dir='src'
local excl='[._]*'
- if [[ "$COMP_CWORD" -gt 1 ]]; then
+ local cur prev
+ _get_comp_words_by_ref cur prev
+
+ if [[ $prev == -k ]]; then
+ _website_kinds
+ return 0
+ fi
+
+ local offset i
+
+ offset=1
+ for (( i=1; i <= COMP_CWORD; i++ )); do
+ if [[ "${COMP_WORDS[i]}" == -k ]]; then
+ i=$(( i + 1 ))
+ continue
+ fi
+ if [[ "${COMP_WORDS[i]}" != -* ]]; then
+ offset=$i
+ break
+ fi
+ done
+
+ if [[ $(( $COMP_CWORD - $offset )) -gt 0 ]]; then
dir="${dir}/tags"
else
excl="@(${excl}|tags)"
fi
- local cur="$(_get_cword)"
-
pushd "$dir" >/dev/null
_website_filedir "$excl"
popd >/dev/null