Skip to content

Commit

Permalink
skeleton for documentation processing
Browse files Browse the repository at this point in the history
  • Loading branch information
igorsysoev committed Aug 5, 2011
1 parent f549c03 commit a6c91b1
Show file tree
Hide file tree
Showing 10 changed files with 271 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docs/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,19 @@ docs/xslt/changes.xslt: 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 changes: 24 additions & 0 deletions docs/dtd/module.dtd
Original file line number Diff line number Diff line change
@@ -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;- " >
10 changes: 10 additions & 0 deletions docs/html/http/ngx_http_core_module.html
Original file line number Diff line number Diff line change
@@ -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>
41 changes: 41 additions & 0 deletions docs/xml/http/ngx_http_core_module.xml
Original file line number Diff line number Diff line change
@@ -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 changes: 19 additions & 0 deletions docs/xsls/content.xsls
Original file line number Diff line number Diff line change
@@ -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 changes: 15 additions & 0 deletions docs/xsls/directive.xsls
Original file line number Diff line number Diff line change
@@ -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 changes: 33 additions & 0 deletions docs/xsls/module.xsls
Original file line number Diff line number Diff line change
@@ -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 changes: 43 additions & 0 deletions docs/xslt/content.xslt
Original file line number Diff line number Diff line change
@@ -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 changes: 36 additions & 0 deletions docs/xslt/directive.xslt
Original file line number Diff line number Diff line change
@@ -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 changes: 34 additions & 0 deletions docs/xslt/module.xslt
Original file line number Diff line number Diff line change
@@ -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>

0 comments on commit a6c91b1

Please sign in to comment.