skeleton for documentation processing

This commit is contained in:
Igor Sysoev 2011-08-05 09:25:34 +00:00
parent f549c03524
commit a6c91b11bf
10 changed files with 271 additions and 0 deletions

View File

@ -52,3 +52,19 @@ docs/xslt/changes.xslt: docs/xsls/changes.xsls
$(call XSLScript, docs/xsls/changes.xsls, $@) $(call XSLScript, docs/xsls/changes.xsls, $@)
html: \
docs/html/http/ngx_http_core_module.html
docs/html/http/ngx_http_core_module.html: \
docs/xml/http/ngx_http_core_module.xml \
docs/xslt/module.xslt \
docs/dtd/module.dtd
$(call XSLT, docs/xslt/module.xslt, $<, $@)
docs/xslt/module.xslt: docs/xsls/module.xsls \
docs/xslt/directive.xslt \
docs/xslt/content.xslt
$(call XSLScript, $<, $@)
docs/xslt/%.xslt: docs/xsls/%.xsls
$(call XSLScript, $<, $@)

24
docs/dtd/module.dtd Normal file
View File

@ -0,0 +1,24 @@
<!ELEMENT module (section+) >
<!ATTLIST module title CDATA #REQUIRED
link CDATA #REQUIRED
lang (en) #REQUIRED
>
<!ELEMENT section (directive+ | para+) >
<!ATTLIST section title CDATA #REQUIRED
name CDATA #IMPLIED
>
<!ELEMENT directive (syntax, default, context, para+) >
<!ATTLIST directive name CDATA #REQUIRED >
<!ELEMENT syntax (#PCDATA | value)* >
<!ELEMENT default (#PCDATA)* >
<!ELEMENT context (#PCDATA)* >
<!ELEMENT para (#PCDATA | value)* >
<!ELEMENT value (#PCDATA)* >
<!ENTITY nbsp "&#xA0;" >
<!ENTITY mdash "&#xA0;- " >

View File

@ -0,0 +1,10 @@
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>ngx_http_core_module</title></head><body><center><h4>Directives</h4></center><a name="client_body_buffer_size"></a><center><h4>client_body_buffer_size</h4></center>syntax: client_body_buffer_size <i>size</i><br>default: client_body_buffer_size 8k/16k<br>context: http, server, location<br><p>
Directive sets client request body buffer size.
If the request body is larger than the buffer,
then the whole body or some its part is written to temporary file.
By default buffer size is equal to 2 memory page sizes.
This is 8K on x86, other 32-bit platforms, and x86-64.
It is usually 16K on other 64-bit platforms.
</p><a name="sendfile"></a><center><h4>sendfile</h4></center>syntax: sendfile <i>[on|off]</i><br>default: sendfile off<br>context: http, server, location<br><p>
Directive enables or disables sendfile() usage.
</p></body></html>

View File

@ -0,0 +1,41 @@
<!DOCTYPE module SYSTEM "../../dtd/module.dtd">
<module title="ngx_http_core_module"
link="/en/docs/http/ngx_http_core_module.html"
lang="en">
<section title="Directives">
<directive name="client_body_buffer_size">
<syntax>client_body_buffer_size <value>size</value></syntax>
<default>client_body_buffer_size 8k/16k</default>
<context>http, server, location</context>
<para>
Directive sets client request body buffer size.
If the request body is larger than the buffer,
then the whole body or some its part is written to temporary file.
By default buffer size is equal to 2 memory page sizes.
This is 8K on x86, other 32-bit platforms, and x86-64.
It is usually 16K on other 64-bit platforms.
</para>
</directive>
<directive name="sendfile">
<syntax>sendfile <value>[on|off]</value></syntax>
<default>sendfile off</default>
<context>http, server, location</context>
<para>
Directive enables or disables sendfile() usage.
</para>
</directive>
</section>
</module>

19
docs/xsls/content.xsls Normal file
View File

@ -0,0 +1,19 @@
X:stylesheet {
X:template = "section[@name and @title]" {
<a name="{@name}" /> <center><h4> !{@title} </h4></center>
!!;
}
X:template = "section[not(@name) and @title]" {
<center><h4> !{@title} </h4></center>
!!;
}
X:template = "section[not(@name) and not(@title)]" { !!; }
X:template = "para" { <p> !!; </p> }
X:template = "value" { <i> !!; </i> }
}

15
docs/xsls/directive.xsls Normal file
View File

@ -0,0 +1,15 @@
X:stylesheet {
X:template = "directive" {
<a name="{@name}" /> <center><h4> !{@name} </h4></center>
!! "syntax";
!! "default";
!! "context";
!! "para";
}
X:template = "syntax" { X:text {syntax: } !!; <br/> }
X:template = "default" { X:text {default: } !!; <br/> }
X:template = "context" { X:text {context: } !!; <br/> }
}

33
docs/xsls/module.xsls Normal file
View File

@ -0,0 +1,33 @@
X:stylesheet {
X:output method="html" indent="no" encoding="utf-8";
X:strip-space elements = "*";
<!--
-- 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:var LINK = "/module/@link";
X:include href = "directive.xslt";
X:include href = "content.xslt";
X:template = "/module" {
<html><head>
<title> !{@title} </title>
</head>
<body>
!!;
</body>
</html>
}
}

43
docs/xslt/content.xslt Normal file
View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="section[@name and @title]">
<a name="{@name}"/>
<center>
<h4>
<xsl:value-of select="@title"/>
</h4>
</center>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="section[not(@name) and @title]">
<center>
<h4>
<xsl:value-of select="@title"/>
</h4>
</center>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="section[not(@name) and not(@title)]">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="para">
<p>
<xsl:apply-templates/>
</p>
</xsl:template>
<xsl:template match="value">
<i>
<xsl:apply-templates/>
</i>
</xsl:template>
</xsl:stylesheet>

36
docs/xslt/directive.xslt Normal file
View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="directive">
<a name="{@name}"/>
<center>
<h4>
<xsl:value-of select="@name"/>
</h4>
</center>
<xsl:apply-templates select="syntax"/>
<xsl:apply-templates select="default"/>
<xsl:apply-templates select="context"/>
<xsl:apply-templates select="para"/>
</xsl:template>
<xsl:template match="syntax">
<xsl:text>syntax: </xsl:text>
<xsl:apply-templates/>
<br/>
</xsl:template>
<xsl:template match="default">
<xsl:text>default: </xsl:text>
<xsl:apply-templates/>
<br/>
</xsl:template>
<xsl:template match="context">
<xsl:text>context: </xsl:text>
<xsl:apply-templates/>
<br/>
</xsl:template>
</xsl:stylesheet>

34
docs/xslt/module.xslt Normal file
View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output indent="no" encoding="utf-8" method="html"/>
<xsl:strip-space elements="*"/>
<xsl:param select="'../xml'" name="XML"/>
<xsl:variable select="/module/@link" name="LINK"/>
<xsl:include href="directive.xslt"/>
<xsl:include href="content.xslt"/>
<xsl:template match="/module">
<html>
<head>
<title>
<xsl:value-of select="@title"/>
</title>
</head>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>