]> granicus.if.org Git - apache/commitdiff
New xsl file which generates ready to copy/paste strings for prettify(.min).js
authorChristophe Jaillet <jailletc36@apache.org>
Sat, 7 Apr 2018 16:33:02 +0000 (16:33 +0000)
committerChristophe Jaillet <jailletc36@apache.org>
Sat, 7 Apr 2018 16:33:02 +0000 (16:33 +0000)
All the directives are collected in some JS arrays, so that it is easier to upgrade the list
in prettify.js when new directives are added.

'build.sh' will be updated accordingly. A new build target ('prettify') will be added to
update this list. The resulting file is: docs/manual/list_for_prettify.txt

This new file is heavily inspired from convmap.xsl.

It should be possible to go further, but this is already a first step.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1828598 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/style/xsl/list_for_prettify.xsl [new file with mode: 0644]

diff --git a/docs/manual/style/xsl/list_for_prettify.xsl b/docs/manual/style/xsl/list_for_prettify.xsl
new file mode 100644 (file)
index 0000000..3e45a3c
--- /dev/null
@@ -0,0 +1,103 @@
+<?xml version="1.0"?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!DOCTYPE xsl:stylesheet [
+    <!ENTITY lf SYSTEM "util/lf.xml">
+]>
+<xsl:stylesheet version="1.0"
+              xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                  xmlns="http://www.w3.org/1999/xhtml">
+
+<xsl:output method="text" encoding="ISO-8859-1" indent="no" />
+
+<!-- ==================================================================== -->
+<!-- <modulefilelist>                                                     -->
+<!-- Builds the rewrite map                                               -->
+<!-- ==================================================================== -->
+<xsl:template match="modulefilelist">
+<xsl:text># GENERATED FROM XML -- DO NOT EDIT</xsl:text>&lf;
+<xsl:text>#</xsl:text>&lf;
+<xsl:text># Below is the up-to-date list of existing directives. The list is formatted</xsl:text>&lf;
+<xsl:text># in order to be ready to use for the JS used in prettify.js</xsl:text>&lf;
+&lf;
+<xsl:text># The next line has to be copy/pasted into prettify.js around line 135</xsl:text>&lf;
+<xsl:text># in place of the correponding CONFIG_KEYWORDS array.</xsl:text>&lf;
+&lf;
+
+<xsl:variable name="directives"
+    select="document(modulefile)/modulesynopsis[status!='Obsolete']
+                /directivesynopsis[not(@location)]" />
+
+<xsl:text>  var CONFIG_KEYWORDS = ["</xsl:text>
+<xsl:for-each select="$directives">
+    <!-- Sorting is useless here, but the output is nicer -->
+    <xsl:sort select="name" />
+    <xsl:call-template name="list_directive" />
+</xsl:for-each>
+<xsl:text>"];</xsl:text>
+
+&lf;
+&lf;
+&lf;
+<xsl:text># The next line has to be copy/pasted into prettify.js around line 920</xsl:text>&lf;
+<xsl:text># in place of the correponding PR_TAG array.</xsl:text>&lf;
+&lf;
+
+<xsl:text>        [PR_TAG,     /^&lt;\/?\b(</xsl:text>
+<xsl:for-each select="$directives[@type='section']">
+    <!-- Sorting is useless here, but the output is nicer -->
+    <xsl:sort select="name" />
+    <xsl:call-template name="list_section" />
+</xsl:for-each>
+<xsl:text>).*?>/, null],</xsl:text>
+
+</xsl:template>
+<!-- /modulefilelist -->
+
+<!-- ==================================================================== -->
+<!-- <list_directive>                                                     -->
+<!-- ==================================================================== -->
+<xsl:template name="list_directive">
+
+    <xsl:if test="position()!=1">
+        <xsl:text>,</xsl:text>
+    </xsl:if>
+
+    <xsl:if test="@type = 'section'"><xsl:text>&lt;</xsl:text></xsl:if>
+    <xsl:value-of select="name" />
+    <xsl:if test="@type = 'section'"><xsl:text>&gt;</xsl:text></xsl:if>
+
+</xsl:template>
+<!-- /list_directive -->
+
+<!-- ==================================================================== -->
+<!-- <list_section>                                                       -->
+<!-- ==================================================================== -->
+<xsl:template name="list_section">
+
+    <xsl:if test="position()!=1">
+        <xsl:text>|</xsl:text>
+    </xsl:if>
+
+    <xsl:value-of select="name" />
+
+</xsl:template>
+<!-- /list_section -->
+
+</xsl:stylesheet>