提交 34ed4e98 编写于 作者: M Matthias Bolte

Generate HACKING from docs/hacking.html.in

上级 d39620e3
此差异已折叠。
......@@ -56,6 +56,13 @@ NEWS: $(top_srcdir)/docs/news.xsl $(top_srcdir)/docs/news.html.in
| perl -pe 's/[ \t]+$$//' \
> $@-t && mv $@-t $@ ; fi );
$(top_srcdir)/HACKING: $(top_srcdir)/docs/hacking1.xsl $(top_srcdir)/docs/hacking2.xsl \
$(top_srcdir)/docs/wrapstring.xsl $(top_srcdir)/docs/hacking.html.in
-@(if [ -x $(XSLTPROC) ] ; then \
$(XSLTPROC) --nonet $(top_srcdir)/docs/hacking1.xsl $(top_srcdir)/docs/hacking.html.in | \
$(XSLTPROC) --nonet $(top_srcdir)/docs/hacking2.xsl - \
| perl -0777 -pe 's/\n\n+$$/\n/' \
> $@-t && mv $@-t $@ ; fi );
rpm: clean
@(unset CDPATH ; $(MAKE) dist && rpmbuild -ta $(distdir).tar.gz)
......
......@@ -486,3 +486,6 @@ _autogen:
# Exempt @...@ uses of these symbols.
_makefile_at_at_check_exceptions = ' && !/(SCHEMA|SYSCONF)DIR/'
# regenerate HACKING as part of the syntax-check
syntax-check: $(top_srcdir)/HACKING
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8" indent="no"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<!-- resolve b/i/code tags in a first pass, because they interfere with line
wrapping in the second pass -->
<xsl:template match="b">*<xsl:apply-templates/>*</xsl:template>
<xsl:template match="i">'<xsl:apply-templates/>'</xsl:template>
<xsl:template match="code">"<xsl:apply-templates/>"</xsl:template>
</xsl:stylesheet>
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="wrapstring.xsl"/>
<xsl:output method="text" encoding="UTF-8" indent="no"/>
<xsl:strip-space elements="*"/>
<xsl:variable name="newline">
<xsl:text>
</xsl:text>
</xsl:variable>
<xsl:template match="/">
<xsl:text>-*- buffer-read-only: t -*- vi: set ro:
DO NOT EDIT THIS FILE! IT IS GENERATED AUTOMATICALLY!
</xsl:text>
<xsl:apply-templates/>
</xsl:template>
<!-- title -->
<xsl:template match="h1">
<xsl:text> </xsl:text>
<xsl:value-of select="normalize-space(.)"/>
<xsl:text>
</xsl:text>======================
</xsl:template>
<!-- output the current text node underlined -->
<xsl:template name="underline">
<xsl:param name="text" select="normalize-space(.)"/>
<xsl:param name="text-length" select="string-length($text)"/>
<xsl:param name="char" select="'='"/>
<xsl:param name="line" select="$char"/>
<xsl:choose>
<xsl:when test="$text-length > 1">
<xsl:call-template name="underline">
<xsl:with-param name="text" select="$text"/>
<xsl:with-param name="text-length" select="$text-length - 1"/>
<xsl:with-param name="char" select="$char"/>
<xsl:with-param name="line" select="concat($line,$char)"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
<xsl:value-of select="$newline"/>
<xsl:value-of select="$line"/>
<xsl:value-of select="$newline"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="h2">
<xsl:value-of select="$newline"/>
<xsl:call-template name="underline"/>
</xsl:template>
<xsl:template match="h3">
<xsl:call-template name="underline">
<xsl:with-param name="char" select="'-'"/>
</xsl:call-template>
</xsl:template>
<!-- output text line wrapped at 80 chars -->
<xsl:template match="text()">
<xsl:call-template name="wrap-string">
<xsl:with-param name="str" select="normalize-space(.)"/>
<xsl:with-param name="wrap-col" select="80"/>
<xsl:with-param name="break-mark" select="$newline"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="ol|ul|p">
<xsl:apply-templates/><xsl:value-of select="$newline"/><xsl:value-of select="$newline"/>
</xsl:template>
<xsl:template match="ol/li">
<xsl:choose>
<xsl:when test=".//node()[position()=last()]/self::pre">(<xsl:value-of select="position()"/>) <xsl:apply-templates/>
</xsl:when>
<!-- only append two newlines when the last element isn't a pre element -->
<xsl:otherwise>(<xsl:value-of select="position()"/>) <xsl:apply-templates/><xsl:value-of select="$newline"/><xsl:value-of select="$newline"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="ul/li">- <xsl:apply-templates/><xsl:value-of select="$newline"/><xsl:value-of select="$newline"/>
</xsl:template>
<xsl:template match="li/ul/li">-- <xsl:apply-templates/><xsl:value-of select="$newline"/><xsl:value-of select="$newline"/>
</xsl:template>
<!-- add newline before nested <ul> -->
<xsl:template match="li/ul"><xsl:value-of select="$newline"/><xsl:value-of select="$newline"/><xsl:apply-templates/>
</xsl:template>
<xsl:template match="pre">
<xsl:choose>
<xsl:when test="starts-with(.,'&#xA;')"><xsl:value-of select="substring(.,2)"/><xsl:value-of select="$newline"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/><xsl:value-of select="$newline"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="a">
<xsl:value-of select="$newline"/><xsl:value-of select="$newline"/>
<xsl:text> </xsl:text><xsl:apply-templates/>
<xsl:value-of select="$newline"/>
<xsl:text> </xsl:text><xsl:value-of select="@href"/>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- based on http://plasmasturm.org/log/xslwordwrap/ -->
<!-- Copyright 2010 Aristotle Pagaltzis; under the MIT licence -->
<!-- http://www.opensource.org/licenses/mit-license.php -->
<xsl:template name="wrap-string">
<xsl:param name="str" />
<xsl:param name="wrap-col" />
<xsl:param name="break-mark" />
<xsl:param name="pos" select="0" />
<xsl:choose>
<xsl:when test="contains( $str, ' ' )">
<xsl:variable name="first-word" select="substring-before( $str, ' ' )" />
<xsl:variable name="pos-now" select="$pos + 1 + string-length( $first-word )" />
<xsl:choose>
<xsl:when test="$pos > 0 and $pos-now >= $wrap-col">
<xsl:copy-of select="$break-mark" />
<xsl:call-template name="wrap-string">
<xsl:with-param name="str" select="$str" />
<xsl:with-param name="wrap-col" select="$wrap-col" />
<xsl:with-param name="break-mark" select="$break-mark" />
<xsl:with-param name="pos" select="0" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:if test="$pos > 0">
<xsl:text> </xsl:text>
</xsl:if>
<xsl:value-of select="$first-word" />
<xsl:call-template name="wrap-string">
<xsl:with-param name="str" select="substring-after( $str, ' ' )" />
<xsl:with-param name="wrap-col" select="$wrap-col" />
<xsl:with-param name="break-mark" select="$break-mark" />
<xsl:with-param name="pos" select="$pos-now" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$pos + string-length( $str ) >= $wrap-col">
<xsl:copy-of select="$break-mark" />
</xsl:when>
<xsl:otherwise>
<xsl:if test="$pos > 0">
<xsl:text> </xsl:text>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="$str" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册