changeset 171:6eeaa9e1f3b5

Made "appeared-in" an element, and added support for multiple "appeared-in" specifications.
author Ruslan Ermilov <ru@nginx.com>
date Thu, 03 Nov 2011 21:40:27 +0000
parents cd2698ea00ab
children 5e8e63f73c33
files dtd/module.dtd xml/en/docs/http/ngx_http_core_module.xml xsls/directive.xsls xslt/directive.xslt
diffstat 4 files changed, 83 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/dtd/module.dtd	Wed Nov 02 19:31:11 2011 +0000
+++ b/dtd/module.dtd	Thu Nov 03 21:40:27 2011 +0000
@@ -12,10 +12,9 @@
             name        CDATA #IMPLIED
 >
 
-<!ELEMENT   directive   (syntax+, default+, context*, para+) >
+<!ELEMENT   directive   (syntax+, default+, context*, appeared-in*, para+) >
 <!ATTLIST   directive
             name        ID #REQUIRED
-            appeared-in CDATA #IMPLIED
 >
 
 <!ELEMENT   syntax      (#PCDATA | argument | code | parameter | value)* >
@@ -27,6 +26,8 @@
 
 <!ELEMENT   context     (#PCDATA)* >
 
+<!ELEMENT   appeared-in (#PCDATA)* >
+
 <!ELEMENT   para        (#PCDATA | argument | c-def | c-func | code | command |
                          emphasis | example | header | http-status | link |
                          list | note | parameter | path | value | var)* >
--- a/xml/en/docs/http/ngx_http_core_module.xml	Wed Nov 02 19:31:11 2011 +0000
+++ b/xml/en/docs/http/ngx_http_core_module.xml	Thu Nov 03 21:40:27 2011 +0000
@@ -8,7 +8,7 @@
 
 <section id="directives" name="Directives">
 
-<directive name="aio" appeared-in="0.8.11">
+<directive name="aio">
 <syntax>
         <value>on</value> |
         <value>off</value> |
@@ -18,6 +18,7 @@
 <context>http</context>
 <context>server</context>
 <context>location</context>
+<appeared-in>0.8.11</appeared-in>
 
 <para>
 Enables or disables the use of asynchronous file I/O (AIO)
@@ -419,12 +420,13 @@
 </directive>
 
 
-<directive name="directio" appeared-in="0.7.7">
+<directive name="directio">
 <syntax><argument>size</argument> | <value>off</value></syntax>
 <default>off</default>
 <context>http</context>
 <context>server</context>
 <context>location</context>
+<appeared-in>0.7.7</appeared-in>
 
 <para>
 Enables the use of
@@ -445,12 +447,13 @@
 </directive>
 
 
-<directive name="directio_alignment" appeared-in="0.8.11">
+<directive name="directio_alignment">
 <syntax><argument>size</argument></syntax>
 <default>512</default>
 <context>http</context>
 <context>server</context>
 <context>location</context>
+<appeared-in>0.8.11</appeared-in>
 
 <para>
 Sets an alignment for
@@ -526,7 +529,7 @@
 </directive>
 
 
-<directive name="if_modified_since" appeared-in="0.7.24">
+<directive name="if_modified_since">
 <syntax>
         <value>off</value> |
         <value>exact</value> |
@@ -536,6 +539,7 @@
 <context>http</context>
 <context>server</context>
 <context>location</context>
+<appeared-in>0.7.24</appeared-in>
 
 <para>
 Specifies how to compare modification time of a response
@@ -634,12 +638,13 @@
 </directive>
 
 
-<directive name="keepalive_requests" appeared-in="0.8.0">
+<directive name="keepalive_requests">
 <syntax><argument>number</argument></syntax>
 <default>100</default>
 <context>http</context>
 <context>server</context>
 <context>location</context>
+<appeared-in>0.8.0</appeared-in>
 
 <para>
 Sets the maximum number of requests that can be
@@ -789,13 +794,14 @@
 </directive>
 
 
-<directive name="limit_rate_after" appeared-in="0.8.0">
+<directive name="limit_rate_after">
 <syntax><argument>size</argument></syntax>
 <default>0</default>
 <context>http</context>
 <context>server</context>
 <context>location</context>
 <context>if in location</context>
+<appeared-in>0.8.0</appeared-in>
 
 <para>
 Sets the initial amount after which the further transmission
--- a/xsls/directive.xsls	Wed Nov 02 19:31:11 2011 +0000
+++ b/xsls/directive.xsls	Thu Nov 03 21:40:27 2011 +0000
@@ -9,9 +9,7 @@
         !! "default";
         !! "context";
         </table>
-        X:if "(@appeared-in)" {
-            <p>This directive appeared in version !{@appeared-in}.</p>
-        }
+        !! "appeared-in";
         </div>
         !! "para";
     }
@@ -119,4 +117,31 @@
         }
     }
 
+    X:template = "appeared-in" {
+        X:if "last() = 1" {
+            <p>This directive appeared in version !!;.</p>
+        } else {
+            X:choose {
+                X:when "position() = 1" {
+                    X:text disable-output-escaping="yes" {
+                        &lt;p&gt;
+                    }
+                    This directive appeared in versions !!;
+                    X:if "last() > 2" {
+                        X:text{, }
+                    }
+                }
+                X:when "position() != last()" {
+                    !!;
+                    X:text{, }
+                }
+                X:otherwise {
+                    and !!;.
+                    X:text disable-output-escaping="yes" {
+                        &lt;/p&gt;
+                    }
+                }
+            }
+        }
+    }
 }
--- a/xslt/directive.xslt	Wed Nov 02 19:31:11 2011 +0000
+++ b/xslt/directive.xslt	Thu Nov 03 21:40:27 2011 +0000
@@ -18,12 +18,7 @@
 
          </table>
 
-         <xsl:if test="(@appeared-in)">
-
-            <p>This directive appeared in version
-               <xsl:value-of select="@appeared-in"/>.
-            </p>
-         </xsl:if>
+         <xsl:apply-templates select="appeared-in"/>
 
       </div>
 
@@ -199,4 +194,43 @@
       </xsl:choose>
    </xsl:template>
 
+   <xsl:template match="appeared-in">
+      <xsl:choose>
+
+         <xsl:when test="last() = 1">
+
+            <p>This directive appeared in version
+               <xsl:apply-templates/>.
+            </p>
+         </xsl:when>
+
+         <xsl:otherwise>
+
+            <xsl:choose>
+               <xsl:when test="position() = 1">
+                  <xsl:text disable-output-escaping="yes">
+                        &lt;p&gt;
+                    </xsl:text>
+                    This directive appeared in versions
+                  <xsl:apply-templates/>
+                  <xsl:if test="last() &gt; 2">
+                     <xsl:text>, </xsl:text>
+                  </xsl:if>
+               </xsl:when>
+               <xsl:when test="position() != last()">
+                  <xsl:apply-templates/>
+                  <xsl:text>, </xsl:text>
+               </xsl:when>
+               <xsl:otherwise>
+                    and
+                  <xsl:apply-templates/>.
+                  <xsl:text disable-output-escaping="yes">
+                        &lt;/p&gt;
+                    </xsl:text>
+               </xsl:otherwise>
+            </xsl:choose>
+         </xsl:otherwise>
+      </xsl:choose>
+   </xsl:template>
+
 </xsl:stylesheet>