Mercurial > hg > nginx-site
changeset 1156:8e8a6a7cff2b
Added variables index.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Wed, 16 Apr 2014 14:22:51 +0400 |
parents | 07402a11fd8d |
children | a8a643647c76 |
files | GNUmakefile dtd/content.dtd xml/en/GNUmakefile xml/en/docs/index.xml xml/i18n.xml xml/ru/GNUmakefile xml/ru/docs/index.xml xsls/link.xsls xsls/varindex.xsls xslt/link.xslt |
diffstat | 10 files changed, 95 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/GNUmakefile +++ b/GNUmakefile @@ -80,6 +80,7 @@ 404: $(OUT)/404.html DIRIND_DEPS = +VARIND_DEPS = define lang-specific @@ -113,12 +114,26 @@ xml/$(lang)/docs/dirindex.xml: \ sed 's;xml/[^/]*/docs/;;g' > $$@ endif +ifneq (,$$(filter varindex,$$(DOCS))) +VARIND_DEPS += xml/$(lang)/docs/varindex.xml +xml/$(lang)/docs/varindex.xml: \ + $$(foreach f,$$(REFS),xml/$(lang)/docs/$$(f).xml) \ + xslt/varindex.xslt + echo "<modules>$$(patsubst %, \ + <module name=\"%\"/>, $$(filter %.xml,$$^))</modules>" | \ + xsltproc -o - --stringparam LANG $(lang) \ + xslt/varindex.xslt - | \ + sed 's;xml/[^/]*/docs/;;g' > $$@ +endif + endef $(foreach lang, $(LANGS), $(eval $(call lang-specific))) $(foreach lang, $(LANGS), $(OUT)/$(lang)/docs/dirindex.html): $(DIRIND_DEPS) +$(foreach lang, $(LANGS), $(OUT)/$(lang)/docs/varindex.html): $(VARIND_DEPS) + $(OUT)/index.html: \ xml/index.xml \ $(NEWS_DEPS) @@ -283,6 +298,7 @@ copy_dirmap: endif clean: - rm -rf $(ZIP) $(OUT) xml/*/docs/dirindex.xml dir.map + rm -rf $(ZIP) $(OUT) xml/*/docs/dirindex.xml dir.map \ + xml/*/docs/varindex.xml .DELETE_ON_ERROR:
--- a/dtd/content.dtd +++ b/dtd/content.dtd @@ -10,7 +10,7 @@ name CDATA #IMPLIED > -<!ELEMENT para (#PCDATA | link | links | br | list | note | +<!ELEMENT para (#PCDATA | link | links | varlinks | br | list | note | i | b | nobr | table | literal | command | path | header | value | programlisting | initial | @@ -18,6 +18,7 @@ registered | c-func | http-status)* > <!ELEMENT links (link)+ > +<!ELEMENT varlinks (link)+ > <!ELEMENT link (#PCDATA) > <!ATTLIST link
--- a/xml/en/GNUmakefile +++ b/xml/en/GNUmakefile @@ -7,6 +7,7 @@ DOCS = \ control \ hash \ dirindex \ + varindex \ http/request_processing \ http/server_names \ http/load_balancing \
--- a/xml/en/docs/index.xml +++ b/xml/en/docs/index.xml @@ -142,6 +142,10 @@ <link doc="dirindex.xml"/> </listitem> +<listitem> +<link doc="varindex.xml"/> +</listitem> + </list> </para>
--- a/xml/i18n.xml +++ b/xml/i18n.xml @@ -19,6 +19,7 @@ <item id="directive.version">This directive appeared in version</item> <item id="directive.versions">This directive appeared in versions</item> <item id="dirindex">Alphabetical index of directives</item> +<item id="varindex">Alphabetical index of variables</item> <item id="outdated">This translation may be out of date. Check the <origin>English version</origin> for recent changes.</item> @@ -36,6 +37,7 @@ for recent changes.</item> <item id="directive.version">Эта директива появилась в версии</item> <item id="directive.versions">Эта директива появилась в версиях</item> <item id="dirindex">Алфавитный указатель директив</item> +<item id="varindex">Алфавитный указатель переменных</item> <item id="outdated">Этот перевод может быть устаревшим. Смотрите <origin>английскую версию</origin> для ознакомления с последними изменениями.</item>
--- a/xml/ru/GNUmakefile +++ b/xml/ru/GNUmakefile @@ -9,6 +9,7 @@ DOCS = \ control \ hash \ dirindex \ + varindex \ http/request_processing \ http/server_names \ http/configuring_https_servers \
--- a/xml/ru/docs/index.xml +++ b/xml/ru/docs/index.xml @@ -126,6 +126,10 @@ <link doc="dirindex.xml"/> </listitem> +<listitem> +<link doc="varindex.xml"/> +</listitem> + </list> </para>
--- a/xsls/link.xsls +++ b/xsls/link.xsls @@ -57,4 +57,16 @@ X:template = "links" { } } +X:template = "varlinks" { + X:for-each "link", X:sort "@id" { + <a href="{substring-before(@doc, '.xml')}.html#{@id}">!!;</a> + X:if "count(../link[@id = current()/@id and @doc != current()/@doc]) > 0" { + X:text{ (} + !{substring-before(substring-after(@doc, '/'), '.xml')} + X:text{)} + } + <br/> + } } + +}
new file mode 100644 --- /dev/null +++ b/xsls/varindex.xsls @@ -0,0 +1,39 @@ +<!-- + Copyright (C) Nginx, Inc. + --> + +X:stylesheet { + +X:output method="xml" doctype-system="../../../dtd/article.dtd" encoding="utf-8"; + +<!-- + -- a current directory of a XSLT script is where the script is stored, + -- but not where XSLT processor has been started to run the script + --> +X:param XML = "'../xml'"; + +X:param LANG; + +X:template = "modules" { + <article name="{document(concat($XML, '/i18n.xml')) + /i18n/text[@lang = $LANG]/item[@id='varindex']}" + link="/{$LANG}/docs/varindex.html" + lang="{$LANG}"> + <section> + <para> + <varlinks> + !! "module"; + </varlinks> + </para> + </section> + </article> +} + +X:template = "module" { + X:var module="@name" + X:for-each "document(@name)//tag-name/var" { + <link doc="{$module}" id="{../@id}">!!;</link> + } +} + +}
--- a/xslt/link.xslt +++ b/xslt/link.xslt @@ -4,7 +4,7 @@ Copyright (C) Nginx, Inc. --> -<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:math="http://exslt.org/math" extension-element-prefixes="math"> <xsl:template match="img"> <img src="{@href}"> <xsl:apply-templates/> </img> </xsl:template> @@ -57,4 +57,16 @@ </xsl:for-each> </xsl:template> +<xsl:template match="varlinks"> + <xsl:for-each select="link"><xsl:sort select="@id"/> + <a href="{substring-before(@doc, '.xml')}.html#{@id}"><xsl:apply-templates/></a> + <xsl:if test="count(../link[@id = current()/@id and @doc != current()/@doc]) > 0"> + <xsl:text> (</xsl:text> + <xsl:value-of select="substring-before(substring-after(@doc, '/'), '.xml')"/> + <xsl:text>)</xsl:text> + </xsl:if> + <br/> + </xsl:for-each> +</xsl:template> + </xsl:stylesheet>