[PATCH 15/17] XHTML export: hide unhelpful comments
andrew-libreoffice.org at pileofstuff.org
andrew-libreoffice.org at pileofstuff.org
Thu Aug 14 14:53:55 PDT 2014
From: Andrew Sayers <andrew-libreoffice.org at pileofstuff.org>
---
filter/source/xslt/odf2xhtml/export/xhtml/body.xsl | 26 +++++++++++-----------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git filter/source/xslt/odf2xhtml/export/xhtml/body.xsl filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
index 1126f8e..60b5808 100644
--- filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
+++ filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
@@ -250,7 +250,7 @@
<xsl:template match="draw:text-box">
<xsl:param name="globalData"/>
- <xsl:comment>Next 'div' was a 'draw:text-box'.</xsl:comment>
+ <xsl:if test="$debugEnabled"><xsl:comment>Next 'div' was a 'draw:text-box'.</xsl:comment></xsl:if>
<xsl:element name="div">
<xsl:variable name="dimension">
<xsl:apply-templates select="@fo:min-width"/>
@@ -374,10 +374,10 @@
<!-- The paragraph is written as DIV as there might be nested paragraphs (see above choose block) -->
<xsl:choose>
<xsl:when test="name() = 'text:p'">
- <xsl:comment>Next 'div' was a 'text:p'.</xsl:comment>
+ <xsl:if test="$debugEnabled"><xsl:comment>Next 'div' was a 'text:p'.</xsl:comment></xsl:if>
</xsl:when>
<xsl:otherwise>
- <xsl:comment>Next 'div' was a 'draw:page'.</xsl:comment>
+ <xsl:if test="$debugEnabled"><xsl:comment>Next 'div' was a 'draw:page'.</xsl:comment></xsl:if>
</xsl:otherwise>
</xsl:choose>
<xsl:element name="div">
@@ -801,7 +801,7 @@
<!-- every following frame sibling until the next <draw:frame>
must be contained within a left-indented div, so they can
be indented correctly (usually right-indented) -->
- <xsl:comment>Next 'div' added for floating.</xsl:comment>
+ <xsl:if test="$debugEnabled"><xsl:comment>Next 'div' added for floating.</xsl:comment></xsl:if>
<xsl:element name="div">
<xsl:attribute name="style">
<xsl:text>position:relative; left:</xsl:text>
@@ -991,7 +991,7 @@
</xsl:variable>
<!-- if the frame is anchored on a paragraph -->
<xsl:if test="@text:anchor-type='paragraph'">
- <xsl:comment>Next 'div' is emulating the top hight of a draw:frame.</xsl:comment>
+ <xsl:if test="$debugEnabled"><xsl:comment>Next 'div' is emulating the top hight of a draw:frame.</xsl:comment></xsl:if>
<!-- When the svg:y is set relative to the paragraph content, the best way to emulate a positive height,
is to add an invisbile division inbetween with a height.
Often text will flow into this 'gap', which is handled separately!
@@ -1072,9 +1072,9 @@
<xsl:otherwise>div</xsl:otherwise>
</xsl:choose>
</xsl:variable>
- <xsl:comment>Next '
+ <xsl:if test="$debugEnabled"><xsl:comment>Next '
<xsl:value-of select="$elem-name"/>' is a draw:frame.
- </xsl:comment>
+ </xsl:comment></xsl:if>
<xsl:element name="{$elem-name}">
<xsl:choose>
<xsl:when test="draw:object/math:math">
@@ -2072,7 +2072,7 @@
<xsl:value-of select="$labelContent"/>
</xsl:when>
<xsl:otherwise>
- <xsl:comment>​</xsl:comment>
+ <xsl:if test="$debugEnabled"><xsl:comment>​</xsl:comment></xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
@@ -2106,7 +2106,7 @@
<xsl:value-of select="$listLabelWidth"/>
<xsl:text>cm</xsl:text>
</xsl:attribute>
- <xsl:comment> </xsl:comment>
+ <xsl:if test="$debugEnabled"><xsl:comment> </xsl:comment></xsl:if>
</xsl:element>
</xsl:with-param>
<xsl:with-param name="listLevel" select="$listLevel + 1"/>
@@ -2474,7 +2474,7 @@
</xsl:when>
<xsl:otherwise>
<xsl:variable name="numberedSymbol">
- <xsl:comment> </xsl:comment>
+ <xsl:if test="$debugEnabled"><xsl:comment> </xsl:comment></xsl:if>
<!-- only give out a number when number format is not empty -->
<xsl:if test="$listLevelStyle/@style:num-format != ''">
<xsl:number value="$itemNumber" format="{$listLevelStyle/@style:num-format}"/>
@@ -2775,7 +2775,7 @@
<xsl:param name="globalData"/>
<xsl:if test="not(contains(@text:display, 'none'))">
- <xsl:comment>Next 'div' was a 'text:section'.</xsl:comment>
+ <xsl:if test="$debugEnabled"><xsl:comment>Next 'div' was a 'text:section'.</xsl:comment></xsl:if>
<xsl:element name="div">
<xsl:call-template name="apply-styles-and-content">
<xsl:with-param name="globalData" select="$globalData"/>
@@ -2800,11 +2800,11 @@
<xsl:value-of select="@text:string-value"/>
</xsl:when>
<xsl:otherwise>
- <xsl:comment>
+ <xsl:if test="$debugEnabled"><xsl:comment>
<xsl:value-of select="$varName"/>
<xsl:value-of select="@text:string-value"/>
<xsl:value-of select="$varName"/>
- </xsl:comment>
+ </xsl:comment></xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
--
1.8.5.1
More information about the LibreOffice
mailing list