This commit is contained in:
parent
6bab00e8f2
commit
eb8976770d
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,6 +7,7 @@ tools/.texts-??.xml
|
||||
.fundraising.??.xml
|
||||
.*.xmllist
|
||||
tags/tagged-*.en.xhtml
|
||||
tags/.tags.??.xml
|
||||
events/????/????.??.xhtml
|
||||
events/????/????.sources
|
||||
events/????/????.xsl
|
||||
|
1
Makefile
1
Makefile
@ -121,6 +121,7 @@ default_xsl:
|
||||
# automatically created, these are regular source files for HTML pages, and
|
||||
# in phase 2 are built into pages listing all news items and events for a
|
||||
# tag.
|
||||
# * tags/.tags.??.xml with a list of the tags useed.
|
||||
# * <dir>/.<base>.xmllist for each <dir>/<base>.sources as well as for each
|
||||
# tags/tagged-<tags>.en.xhtml. These files are used in phase 2 to include the
|
||||
# correct XML files when generating the HTML pages. It is taken care that
|
||||
|
@ -12,10 +12,14 @@
|
||||
<xsl:output method="text" encoding="UTF-8"/>
|
||||
|
||||
<xsl:template match="tag">
|
||||
<xsl:value-of select="."/>
|
||||
<!-- tag name -->
|
||||
<xsl:value-of select="translate(.,' .+-/:_','')"/>
|
||||
<!-- blank -->
|
||||
<xsl:text> </xsl:text>
|
||||
<!-- tag label -->
|
||||
<xsl:value-of select="@content"/>
|
||||
<!-- append a newline -->
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="@*|node()" priority="-1">
|
||||
|
@ -2,25 +2,18 @@
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>FSFE - Tags</title>
|
||||
<title>Tags - FSFE</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Tags</h1>
|
||||
|
||||
|
||||
<h2>News</h2>
|
||||
<all-tags-news/>
|
||||
|
||||
<h2>Events</h2>
|
||||
<all-tags-events/>
|
||||
|
||||
</body>
|
||||
|
||||
<timestamp>$Date: 2011-01-13 15:29:42 +0100 (jeu. 13 janv. 2011) $ $Author: samtuke $</timestamp>
|
||||
<body>
|
||||
<h1>Tags</h1>
|
||||
|
||||
<h2>News</h2>
|
||||
|
||||
<taglist section="news"/>
|
||||
|
||||
<h2>Events</h2>
|
||||
|
||||
<taglist section="events"/>
|
||||
</body>
|
||||
</html>
|
||||
<!--
|
||||
Local Variables: ***
|
||||
mode: xml ***
|
||||
End: ***
|
||||
-->
|
||||
|
@ -2,25 +2,18 @@
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>FSFE - Tags</title>
|
||||
<title>Tags - FSFE</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Tags</h1>
|
||||
|
||||
|
||||
<h2>Actualités</h2>
|
||||
<all-tags-news/>
|
||||
|
||||
<h2>Évènements</h2>
|
||||
<all-tags-events/>
|
||||
|
||||
</body>
|
||||
|
||||
<timestamp>$Date: 2011-01-13 15:29:42 +0100 (jeu. 13 janv. 2011) $ $Author: samtuke $</timestamp>
|
||||
<body>
|
||||
<h1>Tags</h1>
|
||||
|
||||
<h2>Actualités</h2>
|
||||
|
||||
<taglist section="news"/>
|
||||
|
||||
<h2>Évènements</h2>
|
||||
|
||||
<taglist section="events"/>
|
||||
</body>
|
||||
</html>
|
||||
<!--
|
||||
Local Variables: ***
|
||||
mode: xml ***
|
||||
End: ***
|
||||
-->
|
||||
|
@ -1,26 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>FSFE - Trefwoorden</title>
|
||||
<title>Trefwoorden - FSFE</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Trefwoorden</h1>
|
||||
|
||||
|
||||
|
||||
<h2>Nieuws</h2>
|
||||
<all-tags-news/>
|
||||
|
||||
|
||||
<taglist section="news"/>
|
||||
|
||||
<h2>Evenementen</h2>
|
||||
<all-tags-events/>
|
||||
|
||||
|
||||
<taglist section="events"/>
|
||||
</body>
|
||||
|
||||
<timestamp>$Datum: 2011-01-13 15:29:42 +0100 (don. 13 jan. 2011) $ $Auteur: samtuke $</timestamp>
|
||||
<translator>André Ockers</translator>
|
||||
<translator>André Ockers</translator>
|
||||
</html>
|
||||
<!--
|
||||
Local Variables: ***
|
||||
mode: xml ***
|
||||
End: ***
|
||||
-->
|
||||
|
6
tags/tags.sources
Executable file → Normal file
6
tags/tags.sources
Executable file → Normal file
@ -1,5 +1 @@
|
||||
news/*/news-*:[]
|
||||
news/*/.news-*:[]
|
||||
news/nl/nl-*:[]
|
||||
news/nl/.nl-*:[]
|
||||
events/*/event-*:[]
|
||||
tags/.tags:[]
|
||||
|
@ -1,65 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:dt="http://xsltsl.org/date-time">
|
||||
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:import href="../fsfe.xsl" />
|
||||
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />
|
||||
|
||||
<!-- The top level element of the input file is "buildinfo" -->
|
||||
<xsl:template match="buildinfo">
|
||||
<xsl:apply-templates select="node()"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:key name="news-tags" match="/buildinfo/document/set/news/tags/tag[@key]"
|
||||
use="translate(@key,'ABCDEFGHIJKLMNOPQRSTUVWXYZ-_+ /','abcdefghijklmnopqrstuvwxyz')"/>
|
||||
<xsl:key name="news-tags" match="/buildinfo/document/set/news/tags/tag[not(@key)]"
|
||||
use="translate(.,'ABCDEFGHIJKLMNOPQRSTUVWXYZ-_+ /','abcdefghijklmnopqrstuvwxyz')"/>
|
||||
<xsl:key name="event-tags" match="/buildinfo/document/set/event/tags/tag[@key]"
|
||||
use="translate(@key,'ABCDEFGHIJKLMNOPQRSTUVWXYZ-_+ /','abcdefghijklmnopqrstuvwxyz')"/>
|
||||
<xsl:key name="event-tags" match="/buildinfo/document/set/event/tags/tag[not(@key)]"
|
||||
use="translate(.,'ABCDEFGHIJKLMNOPQRSTUVWXYZ-_+ /','abcdefghijklmnopqrstuvwxyz')"/>
|
||||
|
||||
<xsl:template name="taglink">
|
||||
<xsl:param name="type"/>
|
||||
<xsl:template match="taglist">
|
||||
<xsl:variable name="section">
|
||||
<xsl:value-of select="@section"/>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="keyname"
|
||||
select="translate(@key,'ABCDEFGHIJKLMNOPQRSTUVWXYZ-_+ /','abcdefghijklmnopqrstuvwxyz')"/>
|
||||
<xsl:variable name="tagname"
|
||||
select="translate(.,'ABCDEFGHIJKLMNOPQRSTUVWXYZ-_+ /','abcdefghijklmnopqrstuvwxyz')"/>
|
||||
<xsl:element name="ul">
|
||||
<xsl:attribute name="class">taglist</xsl:attribute>
|
||||
|
||||
<xsl:choose><xsl:when test="@key">
|
||||
<xsl:if test="generate-id() = generate-id(key($type, $keyname))">
|
||||
<li><a href="/tags/tagged-{$keyname}.html"><xsl:value-of select="."/></a></li>
|
||||
</xsl:if>
|
||||
</xsl:when><xsl:when test="@content and not(@content = '')">
|
||||
<xsl:if test="generate-id() = generate-id(key($type, $tagname))">
|
||||
<li><a href="/tags/tagged-{$tagname}.html"><xsl:value-of select="@content"/></a></li>
|
||||
</xsl:if>
|
||||
</xsl:when><xsl:otherwise>
|
||||
<xsl:if test="generate-id() = generate-id(key($type, $tagname))">
|
||||
<li><a href="/tags/tagged-{$tagname}.html"><xsl:value-of select="."/></a></li>
|
||||
</xsl:if>
|
||||
</xsl:otherwise></xsl:choose>
|
||||
</xsl:template>
|
||||
<xsl:for-each select="/buildinfo/document/set/tag[@section=$section]">
|
||||
<xsl:sort select="."/>
|
||||
|
||||
<!--display dynamic list of news items-->
|
||||
<xsl:template match="all-tags-news">
|
||||
<ul class="taglist">
|
||||
<xsl:for-each select="/buildinfo/document/set/news/tags/tag"><xsl:sort select="translate(., 'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')" order="ascending" />
|
||||
<xsl:call-template name="taglink"><xsl:with-param name="type" select="'news-tags'"/></xsl:call-template>
|
||||
<xsl:element name="li">
|
||||
<xsl:element name="a">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:text>tagged-</xsl:text>
|
||||
<xsl:value-of select="@name"/>
|
||||
<xsl:text>.html</xsl:text>
|
||||
</xsl:attribute>
|
||||
|
||||
<xsl:value-of select="."/>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:element name="span">
|
||||
<xsl:attribute name="class">badge</xsl:attribute>
|
||||
<xsl:value-of select="@count"/>
|
||||
</xsl:element><!-- /span -->
|
||||
</xsl:element><!-- /a -->
|
||||
</xsl:element><!-- /li -->
|
||||
</xsl:for-each>
|
||||
</ul>
|
||||
</xsl:template>
|
||||
|
||||
<!--display dynamic list of event items-->
|
||||
<xsl:template match="all-tags-events">
|
||||
<ul class="taglist">
|
||||
<xsl:for-each select="/buildinfo/document/set/event/tags/tag"><xsl:sort select="translate(., 'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')" order="ascending" />
|
||||
<xsl:call-template name="taglink"><xsl:with-param name="type" select="'event-tags'"/></xsl:call-template>
|
||||
</xsl:for-each>
|
||||
</ul>
|
||||
</xsl:element><!-- /ul -->
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
@ -2,13 +2,16 @@
|
||||
# -----------------------------------------------------------------------------
|
||||
# Update XML filelists (*.xmllist) and tag list pages (tags/tagged-*)
|
||||
# -----------------------------------------------------------------------------
|
||||
# This script is called from the phase 1 Makefile.
|
||||
# This script is called from the phase 1 Makefile and creates/updates the
|
||||
# following files:
|
||||
#
|
||||
# * tags/tagged-<tags>.en.xhtml for each tag used. Apart from being
|
||||
# automatically created, these are regular source files for HTML pages, and
|
||||
# in phase 2 are built into pages listing all news items and events for a
|
||||
# tag.
|
||||
#
|
||||
# * tags/.tags.??.xml with a list of the tags useed.
|
||||
#
|
||||
# * <dir>/.<base>.xmllist for each <dir>/<base>.sources as well as for each
|
||||
# tags/tagged-<tags>.en.xhtml. These files are used in phase 2 to include the
|
||||
# correct XML files when generating the HTML pages. It is taken care that
|
||||
@ -39,16 +42,31 @@ tagmaps="/tmp/tagmaps-${pid}"
|
||||
rm -rf "${tagmaps}"
|
||||
mkdir "${tagmaps}"
|
||||
|
||||
taglabels="/tmp/taglabels-${pid}"
|
||||
|
||||
rm -rf "${taglabels}"
|
||||
mkdir "${taglabels}"
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Create a complete and current map of which tag is used in which files
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
echo "* Generating tag maps"
|
||||
|
||||
for xml_file in $(find * -name '*.??.xml' | xargs grep -l '</tag>' | sort); do
|
||||
xsltproc "build/xslt/get_tags.xsl" "${xml_file}" | while read raw_tag; do
|
||||
tag=$(echo "${raw_tag}" | tr -d ' +-/:_' | tr '[:upper:]' '[:lower:]')
|
||||
for xml_file in $(find * -name '*.??.xml' -not -path 'tags/*' | xargs grep -l '</tag>' | sort); do
|
||||
xsltproc "build/xslt/get_tags.xsl" "${xml_file}" | while read raw_tag label; do
|
||||
tag=$(echo "${raw_tag}" | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
# Add file to list of files by tag name
|
||||
echo "${xml_file%.??.xml}" >> "${tagmaps}/${tag}"
|
||||
|
||||
# Store label by language and tag name
|
||||
language=$(echo ${xml_file} | sed -rn 's/^.*\.(..)\.xml/\1/p')
|
||||
if [ "${language}" -a "${label}" ]; then
|
||||
mkdir -p "${taglabels}/${language}"
|
||||
# Always overwrite so the newest news item will win.
|
||||
echo "${label}" > "${taglabels}/${language}/${tag}"
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
@ -81,11 +99,53 @@ for tag in $(ls "tags" | sed -rn 's/tagged-(.*)\.en.xhtml/\1/p'); do
|
||||
fi
|
||||
done
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Update the tag lists
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
taglist="/tmp/taglist-${pid}"
|
||||
|
||||
for language in $(ls ${taglabels}); do
|
||||
{
|
||||
echo '<?xml version="1.0" encoding="UTF-8"?>'
|
||||
echo ''
|
||||
echo '<tagset>'
|
||||
|
||||
for section in "news" "events"; do
|
||||
for tag in $(ls "${tagmaps}"); do
|
||||
count=$(grep "^${section}/" "${tagmaps}/${tag}" | wc --lines || true)
|
||||
|
||||
if [ -f "${taglabels}/${language}/${tag}" ]; then
|
||||
label="$(cat "${taglabels}/${language}/${tag}")"
|
||||
elif [ -f "${taglabels}/en/${tag}" ]; then
|
||||
label="$(cat "${taglabels}/en/${tag}")"
|
||||
else
|
||||
label="${tag}"
|
||||
fi
|
||||
|
||||
if [ "${count}" != "0" ]; then
|
||||
echo " <tag section=\"${section}\" name=\"${tag}\" count=\"${count}\">${label}</tag>"
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo '</tagset>'
|
||||
} > ${taglist}
|
||||
|
||||
if ! cmp --quiet "${taglist}" "tags/.tags.${language}.xml"; then
|
||||
echo "* Updating tags/.tags.${language}.xml"
|
||||
cp "${taglist}" "tags/.tags.${language}.xml"
|
||||
fi
|
||||
|
||||
rm -f "${taglist}"
|
||||
done
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Remove the temporary directory
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
rm -rf "${tagmaps}"
|
||||
rm -rf "${taglabels}"
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Update .xmllist files for .sources
|
||||
|
Loading…
Reference in New Issue
Block a user