[PATCH] Added check for duplicate macros

Wald Commits scm-commit at wald.intevation.org
Wed Oct 9 16:17:27 CEST 2013


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1381328242 -7200
# Node ID 9543b768d7406ec9b4a4a24c0ac36ac871dc175a
# Parent  a365e587af6724abe842d72ecae4b0559b4f4a26
Added check for duplicate macros.

diff -r a365e587af67 -r 9543b768d740 artifacts/contrib/list-unused-macros.xsl
--- a/artifacts/contrib/list-unused-macros.xsl	Wed Oct 09 13:05:37 2013 +0200
+++ b/artifacts/contrib/list-unused-macros.xsl	Wed Oct 09 16:17:22 2013 +0200
@@ -7,6 +7,16 @@
   <xsl:output method="text" encoding="UTF-8"/>
 
   <xsl:template match="/">
+    <xsl:text>Duplicate macros:&#xa;</xsl:text>
+    <xsl:for-each select="//dc:macro/@name">
+      <xsl:variable name="mname" select="."/>
+      <xsl:if test="count(//dc:macro[@name=$mname]) > 1">
+        <xsl:text>  </xsl:text>
+        <xsl:value-of select="$mname"/>
+        <xsl:text>&#xa;</xsl:text>
+      </xsl:if>
+    </xsl:for-each>
+
     <xsl:text>Marcos defined but not called:&#xa;</xsl:text>
     <xsl:for-each select="//dc:macro/@name">
       <xsl:variable name="mname" select="."/>


More information about the Dive4elements-commits mailing list