Mike Gerwitz

Activist for User Freedom

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Gerwitz <gerwitzm@lovullo.com>2014-12-19 14:30:37 -0500
committerMike Gerwitz <gerwitzm@lovullo.com>2014-12-19 14:30:37 -0500
commitef7d968fe0208f224b0d54008c9f1a8966ae7291 (patch)
treecd53a9780e4f07e1938e412e71d66f9ef48b2a85
parent4b51d40bb509aa5201b89f29a47c46f0e55c1d42 (diff)
downloadliterate-xsl-ef7d968fe0208f224b0d54008c9f1a8966ae7291.tar.gz
literate-xsl-ef7d968fe0208f224b0d54008c9f1a8966ae7291.tar.bz2
literate-xsl-ef7d968fe0208f224b0d54008c9f1a8966ae7291.zip
Proper handling of non-docblock comments
-rw-r--r--src/xsltexi.xsl26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/xsltexi.xsl b/src/xsltexi.xsl
index 0efc5da..ab1ea09 100644
--- a/src/xsltexi.xsl
+++ b/src/xsltexi.xsl
@@ -40,7 +40,8 @@
-->
<template match="xsl:stylesheet|xsl:transform">
<apply-templates mode="xt:doc-gen"
- select="preceding-sibling::comment()|*" />
+ select="preceding-sibling::comment()
+ |node()" />
</template>
@@ -106,6 +107,22 @@
<!--
+ Determine whether the given comment node is a docblock
+-->
+<function name="xt:is-docblock" as="xs:boolean">
+ <param name="node" as="comment()" />
+
+ <variable name="next" as="node()?"
+ select="($node/following-sibling::*
+ |$node/following-sibling::comment())[ 1 ]" />
+
+ <!-- FIXME: this will be a maintenance burden -->
+ <sequence select="$next instance of element( xsl:template )
+ or $next instance of element( xsl:function )" />
+</function>
+
+
+<!--
Echo comment blocks
This allows including arbitrary output, enabling the writing of
@@ -125,6 +142,13 @@
<!--
+ Ignore docblock comments (handled in respective templates)
+-->
+<template mode="xt:doc-gen" priority="7"
+ match="comment()[ xt:is-docblock( . ) ]" />
+
+
+<!--
Generate typed parameter list from @var{params}
The style is consistent with that of the XPath specification: `PARAM