[PATCH 02/17] XHTML export: improve comments

andrew-libreoffice.org at pileofstuff.org andrew-libreoffice.org at pileofstuff.org
Thu Aug 14 14:53:42 PDT 2014


From: Andrew Sayers <andrew-libreoffice.org at pileofstuff.org>

---
 .../export/common/styles/style_collector.xsl       |  2 +-
 filter/source/xslt/odf2xhtml/export/xhtml/body.xsl | 45 +++++++++++-----------
 .../source/xslt/odf2xhtml/export/xhtml/table.xsl   |  4 +-
 3 files changed, 25 insertions(+), 26 deletions(-)

diff --git filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl
index 9b02d94..69d34a4 100644
--- filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl
+++ filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl
@@ -661,7 +661,7 @@
     
             <!-- for-each changes the key environment from the previously globalData back to the document root  -->
         <xsl:for-each select="$documentRoot">
-                <!-- only styles, which are used in the content are written as CSS styles -->
+                <!-- ignore styles that aren't used in the content -->
             <xsl:choose>
                 <xsl:when test="key('elementUsingStyle', $style/@style:name)/@* or key('listLabelStyleInContent', $style/@style:name)/@*">
                     <xsl:call-template name="writeUsedStyles2">
diff --git filter/source/xslt/odf2xhtml/export/xhtml/body.xsl filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
index 3ecde5e..6f3e980 100644
--- filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
+++ filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
@@ -433,8 +433,8 @@
 			<xsl:otherwise>
 				<xsl:choose>
 					<!-- !!Check if paragraph is empty!!
-						OOo writes out empty paragraphs layouted behind an image (= draw:image within draw:frame)
-						those have to be neglected in HTML -->
+						OOo writes out empty paragraphs laid out behind an image (= draw:image within draw:frame),
+						those must be neglected in HTML -->
 					<xsl:when test="name() = 'text:p' and not($childText) and not(*)">
 						<xsl:variable name="isFollowingImage">
 							<xsl:call-template name="follows-empty-paragraphs-and-image">
@@ -479,7 +479,7 @@
 
 
 		<!--
-			Every tabulator indents its following content, encapuslated in a span
+			Every tabulator indents its following content, contained in a span
 			element.
 
 			This template have two modes:
@@ -499,7 +499,7 @@
 
 		<xsl:choose>
 			<xsl:when test="name() = 'text:tab'">
-				<!-- every frame sibling have to be incapuslated within a div with left indent  -->
+				<!-- every frame sibling must be contained within a left-indented div -->
 				<xsl:element name="span">
 					<xsl:choose>
 						<xsl:when test="count($tabStops/style:tab-stop) > 0 and count($tabStops/style:tab-stop) < 3">
@@ -630,15 +630,15 @@
 		<xsl:apply-templates select="$tabStops/style:tab-stop[$tabCount]/@style:type"/>
 	</xsl:template>
 
-	<!-- OOo writes out empty paragraphs layouted behind an image,
-		those have to be neglected in HTML
+	<!-- OOo writes out empty paragraphs laid out behind an image,
+		those must be neglected in HTML
 	This method checks if an empty paragraph is of that kind! -->
 	<xsl:template name="follows-empty-paragraphs-and-image">
 		<xsl:param name="precedingElement" />
 		<xsl:param name="elementToCheck" select="1"/>
 		<xsl:choose>
-			<!-- OOo writes out empty paragraphs layouted behind the image,
-				those have to be neglected in HTML
+			<!-- OOo writes out empty paragraphs laid out behind the image,
+				those must be neglected in HTML
 			<xsl:when test="name() = 'text:p' and (normalize-space($childText) = '')">                         -->
 				<!-- WorkAround: Test if the empty paragraph was added after an image, which OOO often does -->
 			<xsl:when test="(name($precedingElement) = 'text:p' and not($precedingElement/text()) and not($precedingElement/*))">
@@ -729,8 +729,8 @@
 		<!-- the footnote symbol is the prefix for a footnote in the footer -->
 		<xsl:param name="footnotePrefix" />
 
-			<!-- empty paragraph tags does not provoke an carridge return,
-				therefore an non breakable space (&nbsp) have been inserted.-->
+			<!-- empty paragraph tags do not cause a carriage return -
+				insert a non-breakable space (&nbsp) to force the issue -->
 		<xsl:choose>
 			<xsl:when test="node()">
 				<xsl:call-template name="apply-styles-and-content">
@@ -790,9 +790,9 @@
 				<xsl:variable name="nextSiblingIsFrame" select="name(following-sibling::node()[1]) = 'draw:frame'"/>
 				<xsl:choose>
 					<xsl:when test="$createDiv and normalize-space(.) != ''">
-						<!-- every following frame sibling till the next draw:frame
-							have to be incapuslated within a div with left indent.
-							To be moved altogether arcording the indent (usually right) -->
+						<!-- 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:element name="div">
 							<xsl:attribute name="style">
@@ -803,7 +803,7 @@
 							<xsl:apply-templates select=".">
 								<xsl:with-param name="globalData" select="$globalData"/>
 							</xsl:apply-templates>
-							<!-- if it is a frame sibling it will be NOT incapuslated within the div (as already within one) -->
+							<!-- if it is a frame sibling, it must not be contained within the div (as already within one) -->
 							<xsl:if test="not($nextSiblingIsFrame)">
 								<xsl:apply-templates select="following-sibling::node()[1]" mode="frameFloating">
 									<xsl:with-param name="globalData" select="$globalData"/>
@@ -1325,7 +1325,7 @@
 	and preceding siblings of 'text:h' with the same 'text:outline-level' (until a text:outline-level with lower value is found).
 	If the 'text:start-value is not set the default value of '1' has to be taken.
 	If a heading number is found (e.g. text:outline-level='3') all heading numbers
-	for the higher levels have to be written out -->
+	for the higher levels must be written out -->
 	<xsl:template name="calc-heading-number">
 		<xsl:param name="globalData"/>
 		<xsl:param name="outlineLevel"/><!-- text level of the heading -->
@@ -2004,10 +2004,9 @@
 											</xsl:otherwise>
 										</xsl:choose>
 									</xsl:variable>
-									<!-- Numbering is being done by this transformation creating a HTML span representing the number label
-										 The html:span represents the list item/header label (e.g. 1.A.III)
-										 As the html:span is usually a inline element is formated by CSS as block element to use width upon it,
-										 to disable the caridge return float:left is used and later neglected -->
+									<!-- Create an HTML span to represent the label for a numbered list item
+										 The <html:span> represents the list item/header label (e.g. 1.A.III).
+										 We use CSS to make the <span> a block element, to set its width, and to float in the correct place -->
 									<xsl:element name="span">
 										<xsl:if test="$listLevelStyle/@text:style-name">
 											<xsl:attribute name="class">
@@ -2046,8 +2045,8 @@
 												</xsl:otherwise>
 											</xsl:choose>
 										</xsl:variable>
-										<!-- Some browsers have problem with stand-alone elements (e.g. <span/>)
-											Therefore a comment is being inserted into an empty label -->
+										<!-- Some browsers have problems with stand-alone elements (i.e. <span/>),
+											so we use a non-breaking space instead -->
 										<xsl:choose>
 											<xsl:when test="$labelContent != ''">
 												<xsl:value-of select="$labelContent"/>
@@ -2186,7 +2185,7 @@
 
 
 	<!-- The Numbering start value (or offset from regular counteing) is used at the first item of offset,
-	but have to be reused on following items with no text:start-value -->
+	but must be reused on following items with no text:start-value -->
 	<xsl:template name="getItemNumber">
 		<xsl:param name="listLevel"/>
 		<xsl:param name="listLevelStyle"/>
@@ -2204,7 +2203,7 @@
 		</xsl:call-template>
 	</xsl:template>
 
-	<!-- When there is a text:start-value the last have to be found and added to the number -->
+	<!-- When there is a text:start-value the last must be found and added to the number -->
 	<xsl:template name="countListItemTillStartValue">
 		<xsl:param name="IteratorSameLevelAndStyle" select="1"/>
 		<xsl:param name="IteratorSameStyle" select="1"/>
diff --git filter/source/xslt/odf2xhtml/export/xhtml/table.xsl filter/source/xslt/odf2xhtml/export/xhtml/table.xsl
index 417e4f7..2f72ee7 100644
--- filter/source/xslt/odf2xhtml/export/xhtml/table.xsl
+++ filter/source/xslt/odf2xhtml/export/xhtml/table.xsl
@@ -158,8 +158,8 @@
 				<xsl:message>A table cell '<xsl:value-of select="$tableDataType" />' element has been added!</xsl:message>
 			</xsl:if>
 
-			<!-- empty cell tags produce problems with width CSS style on itself other table cells as well
-				therefore an non breakable space ( / ) have been inserted.-->
+			<!-- empty cell tags cause problems with with CSS styles (for the empty cells and others)
+				therefore a non-breaking space ( / ) has been inserted -->
 			<xsl:choose>
 				<xsl:when test="node()">
 					<xsl:call-template name="apply-styles-and-content">
-- 
1.8.5.1



More information about the LibreOffice mailing list