author | František Kučera <franta-hg@frantovo.cz> |
Wed, 19 Dec 2018 23:05:52 +0100 | |
branch | v_0 |
changeset 217 | 3e2fd4ce9f02 |
parent 189 | 47907749817f |
permissions | -rw-r--r-- |
141 | 1 |
<?xml version="1.0" encoding="UTF-8"?> |
2 |
<xsl:stylesheet version="2.0" |
|
174
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
3 |
xmlns="http://www.w3.org/1999/xhtml" |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
4 |
xmlns:h="http://www.w3.org/1999/xhtml" |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
5 |
xmlns:s="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/strana" |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
6 |
xmlns:k="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/konfigurace" |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
7 |
xmlns:m="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/makro" |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
8 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
9 |
xmlns:fn="http://www.w3.org/2005/xpath-functions" |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
10 |
xmlns:svg="http://www.w3.org/2000/svg" |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
11 |
xmlns:xs="http://www.w3.org/2001/XMLSchema" |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
12 |
exclude-result-prefixes="fn h s k m xs"> |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
13 |
|
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
14 |
<!-- |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
15 |
Images |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
16 |
****** |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
17 |
Generates an XHTML img tag in a paragraph for given image. |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
18 |
Title and Alt are filled with the EXIF comment field. |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
19 |
Requires a command line tool: exiv2 |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
20 |
* |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
21 |
@src path to the image file relative to the input directory (where web.conf resides) |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
22 |
--> |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
23 |
<xsl:template match="m:img"> |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
24 |
<xsl:variable name="script"> |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
25 |
<m:skript jazyk="bash" výstup="xml"> |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
26 |
DIR=$(dirname "$XWG_STRANKA_SOUBOR"); |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
27 |
DIR="$DIR/../vstup" |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
28 |
cd "$DIR"; |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
29 |
|
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
30 |
<![CDATA[echo -n '<metadata>';]]> |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
31 |
|
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
32 |
<![CDATA[echo -n '<description>';]]> |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
33 |
exiv2 "<xsl:value-of select="@src"/>" | <![CDATA[perl -ne 'if (/Exif comment\s*:\s*(.*)/) { print "$1"; }' ]]> | <m:escape-xml/> |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
34 |
<![CDATA[echo -n '</description>';]]> |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
35 |
|
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
36 |
<![CDATA[echo -n '</metadata>';]]> |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
37 |
</m:skript> |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
38 |
</xsl:variable> |
141 | 39 |
|
174
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
40 |
<xsl:variable name="scriptResult"> |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
41 |
<xsl:apply-templates select="$script/node()"/> |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
42 |
</xsl:variable> |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
43 |
|
189
47907749817f
screenshots: Haiku
František Kučera <franta-hg@frantovo.cz>
parents:
174
diff
changeset
|
44 |
<p class="img-container"> |
174
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
45 |
<!-- |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
46 |
TODO: check whether the thumbnail exists and if yes, disply it and link to the full image. |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
47 |
--> |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
48 |
<a href="{@src}"> |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
49 |
<img src="{@src}" |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
50 |
alt ="{$scriptResult/h:metadata/h:description}" |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
51 |
title="{$scriptResult/h:metadata/h:description}"/> |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
52 |
</a> |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
53 |
</p> |
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
54 |
|
c78dfa0603c9
macro for images with alt and title generated from the EXIF metadata
František Kučera <franta-hg@frantovo.cz>
parents:
141
diff
changeset
|
55 |
</xsl:template> |
141 | 56 |
|
57 |
</xsl:stylesheet> |
|
58 |