summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2016-05-02 16:15:47 +0100
committerdakkar <dakkar@thenautilus.net>2016-05-02 16:31:01 +0100
commit5a17c4c7c479bbbdbed4de3ab65feaaaa9fcf20e (patch)
tree63300eb8217e8b6edf6e187b1e57f9411df46221
parentadd kyousougiga to list (diff)
downloadthenautilus-5a17c4c7c479bbbdbed4de3ab65feaaaa9fcf20e.tar.gz
thenautilus-5a17c4c7c479bbbdbed4de3ab65feaaaa9fcf20e.tar.bz2
thenautilus-5a17c4c7c479bbbdbed4de3ab65feaaaa9fcf20e.zip
add images to twitter cards
won't really work, since Twitter really likes full URIs ☹
-rw-r--r--src/HW/logscale-calc-tools/document.en.rest.txt1
-rw-r--r--src/HW/logscale-calc-tools/document.it.rest.txt1
-rw-r--r--src/modelli/tachikoma/document.en.rest.txt1
-rw-r--r--src/modelli/tachikoma/document.it.rest.txt1
-rw-r--r--templates/du2html.xsl11
5 files changed, 15 insertions, 0 deletions
diff --git a/src/HW/logscale-calc-tools/document.en.rest.txt b/src/HW/logscale-calc-tools/document.en.rest.txt
index 0c54161..cec42f7 100644
--- a/src/HW/logscale-calc-tools/document.en.rest.txt
+++ b/src/HW/logscale-calc-tools/document.en.rest.txt
@@ -78,6 +78,7 @@ Linear rule:
.. image:: s24d4-1.jpg
:alt: 4 on C scale matching with 24 on D scale
+ :class: twitter
2) look with what, on the D scale, matches 1 on the C scale
diff --git a/src/HW/logscale-calc-tools/document.it.rest.txt b/src/HW/logscale-calc-tools/document.it.rest.txt
index 109ff63..9c43b19 100644
--- a/src/HW/logscale-calc-tools/document.it.rest.txt
+++ b/src/HW/logscale-calc-tools/document.it.rest.txt
@@ -80,6 +80,7 @@ Regolo lineare:
.. image:: s24d4-1.jpg
:alt: 4 della scala C corrispondente a 24 della scala D
+ :class: twitter
2) guardiamo a cosa, sulla scala D, corrisponde 1 della scala C
diff --git a/src/modelli/tachikoma/document.en.rest.txt b/src/modelli/tachikoma/document.en.rest.txt
index fa35d45..89bf4ba 100644
--- a/src/modelli/tachikoma/document.en.rest.txt
+++ b/src/modelli/tachikoma/document.en.rest.txt
@@ -26,6 +26,7 @@ Was it worth it? See for yourself:
.. image:: front-t.jpg
:alt: LEGO Tachikoma, from ahead
:target: front.jpg
+ :class: twitter
.. image:: back-t.jpg
:alt: LEGO Tachikoma, from behind
diff --git a/src/modelli/tachikoma/document.it.rest.txt b/src/modelli/tachikoma/document.it.rest.txt
index c125b47..29e352e 100644
--- a/src/modelli/tachikoma/document.it.rest.txt
+++ b/src/modelli/tachikoma/document.it.rest.txt
@@ -27,6 +27,7 @@ Ne è valsa la pena? Guardate qua:
.. image:: front-t.jpg
:alt: Tachikoma LEGO, da davanti
:target: front.jpg
+ :class: twitter
.. image:: back-t.jpg
:alt: Tachikoma LEGO, da dietro
diff --git a/templates/du2html.xsl b/templates/du2html.xsl
index 55fdcd7..aca58ba 100644
--- a/templates/du2html.xsl
+++ b/templates/du2html.xsl
@@ -160,6 +160,16 @@
<link rel="alternate" type="application/atom+xml" href="{$url}feed.{$language}.xml"/>
</x:template>
+ <x:template match="image[contains(concat(' ',normalize-space(@classes),' '),' twitter ')]" mode="twitter-card">
+ <x:variable name="uri-with-slash" select="wc:dst-uri-for(@uri,/document/@source)" />
+ <!-- dst-uri-for appends a / at the end :( -->
+ <meta name="twitter:image" content="{substring($uri-with-slash,1,string-length($uri-with-slash) - 1)}" />
+ <x:if test="@alt">
+ <meta name="twitter:image:alt" content="{@alt}" />
+ </x:if>
+ </x:template>
+ <x:template match="image" mode="twitter-card" priority="-1" />
+
<!-- qui ce ne freghiamo del @source, tanto viene usata solo per i
documenti stand-alone -->
@@ -177,6 +187,7 @@
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@dakkar" />
<meta name="twitter:title" content="{normalize-space(title)}" />
+ <x:apply-templates select="//image" mode="twitter-card" />
<meta name="twitter:description">
<x:attribute name="content">
<x:choose>