diff options
| author | Natanael Copa <ncopa@alpinelinux.org> | 2014-09-22 16:22:38 +0200 |
|---|---|---|
| committer | Natanael Copa <ncopa@alpinelinux.org> | 2014-09-22 16:22:38 +0200 |
| commit | 9fd9c75ecdfdcbcadd82c5b757ea94f8b00fabb7 (patch) | |
| tree | 81528ee12ac8884af0c11ac1f2bcec2489f095b2 /_scripts | |
| parent | ce5059939a5ec3ce7e898d5cb928be666ef68828 (diff) | |
| download | alpine-mksite-9fd9c75ecdfdcbcadd82c5b757ea94f8b00fabb7.tar.bz2 alpine-mksite-9fd9c75ecdfdcbcadd82c5b757ea94f8b00fabb7.tar.xz | |
fetch last git commits from atom feed
It might be nice to have a general RSS atom feed importer since it can
be reused for bugs and other things
Diffstat (limited to '_scripts')
| -rw-r--r-- | _scripts/atom-to-yaml.xsl | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/_scripts/atom-to-yaml.xsl b/_scripts/atom-to-yaml.xsl new file mode 100644 index 0000000..6c9a5e7 --- /dev/null +++ b/_scripts/atom-to-yaml.xsl @@ -0,0 +1,54 @@ +<xsl:stylesheet + version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:atom="http://www.w3.org/2005/Atom" + exclude-result-prefixes="atom" +> +<xsl:output omit-xml-declaration="yes"/> +<xsl:template match="/"> +--- +<xsl:apply-templates select="atom:feed/atom:entry" /> +--- +</xsl:template> + <xsl:template name="escapeQuotes"> + <xsl:param name="txt"/> + <xsl:variable name="backSlashQuote">\'</xsl:variable> + <xsl:variable name="singleQuote">'</xsl:variable> + + <xsl:choose> + <xsl:when test="string-length($txt) = 0"> + <!-- ... --> + </xsl:when> + + <xsl:when test="contains($txt, $singleQuote)"> + <xsl:value-of disable-output-escaping="yes" select="concat(substring-before($txt, $singleQuote), $backSlashQuote)"/> + + <xsl:call-template name="escapeQuotes"> + <xsl:with-param name="txt" select="substring-after($txt, $singleQuote)"/> + </xsl:call-template> + </xsl:when> + + <xsl:otherwise> + <xsl:value-of disable-output-escaping="yes" select="$txt"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + +<xsl:template match="atom:entry"> +- + title: '<xsl:call-template name="escapeQuotes"> + <xsl:with-param name="txt" select="atom:title"/> + </xsl:call-template>' + id: '<xsl:call-template name="escapeQuotes"> + <xsl:with-param name="txt" select="atom:id"/> + </xsl:call-template>' + author_name: '<xsl:call-template name="escapeQuotes"> + <xsl:with-param name="txt" select="atom:author/atom:name"/> + </xsl:call-template>' + author_email: '<xsl:value-of select="atom:author/atom:email"/>' + published: <xsl:value-of select="atom:published"/> + updated: <xsl:value-of select="atom:updated"/> + link: <xsl:value-of select="atom:link/@href"/> +</xsl:template> + +</xsl:stylesheet> |
