[Libreoffice-commits] core.git: swext/mediawiki

Robert Antoni Buj Gelonch robert.buj at gmail.com
Mon Apr 20 06:54:17 PDT 2015


 swext/mediawiki/src/filter/odt2mediawiki.xsl |  233 +++++++++------------------
 1 file changed, 78 insertions(+), 155 deletions(-)

New commits:
commit 50c43b030b2911d83b2e8fc4bc0499b1641cb043
Author: Robert Antoni Buj Gelonch <robert.buj at gmail.com>
Date:   Mon Apr 20 13:01:28 2015 +0200

    odt2mediawiki.xsl: reuse table cell code, check USE_DEFAULT_TABLE_CLASS, use current vbles
    
    Change-Id: Iedaddf11604b13c7db1d2b588a5f205f691ea2b4
    Reviewed-on: https://gerrit.libreoffice.org/15440
    Tested-by: David Tardon <dtardon at redhat.com>
    Reviewed-by: David Tardon <dtardon at redhat.com>

diff --git a/swext/mediawiki/src/filter/odt2mediawiki.xsl b/swext/mediawiki/src/filter/odt2mediawiki.xsl
index d680680..54f6003 100644
--- a/swext/mediawiki/src/filter/odt2mediawiki.xsl
+++ b/swext/mediawiki/src/filter/odt2mediawiki.xsl
@@ -409,67 +409,26 @@
 	</template>
 
         <template match="table:table-row">
-		<variable name="style-name" select="table:table-cell[1]/@table:style-name"/>
-		<variable name="total-style-name" select="count(table:table-cell/@table:style-name)"/>
-		<variable name="total-equal-style-name" select="count(table:table-cell[@table:style-name=$style-name])"/>
-		<variable name="style">
-			<if test="$total-equal-style-name=$total-style-name">
-				<variable name="style-element" select="key('style-ref', $style-name)"/>
-				<call-template name="translate-style-property">
-					<with-param name="style-name" select="'background-color'"/>
-					<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:background-color"/>
-				</call-template>
+		<text>|-</text>
 
-				<call-template name="translate-style-property">
-					<with-param name="style-name" select="'border'"/>
-					<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border"/>
-				</call-template>
-				<call-template name="translate-style-property">
-					<with-param name="style-name" select="'border-top'"/>
-					<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-top"/>
-				</call-template>
-				<call-template name="translate-style-property">
-					<with-param name="style-name" select="'border-bottom'"/>
-					<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-bottom"/>
-				</call-template>
-				<call-template name="translate-style-property">
-					<with-param name="style-name" select="'border-left'"/>
-					<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-left"/>
-				</call-template>
-				<call-template name="translate-style-property">
-					<with-param name="style-name" select="'border-right'"/>
-					<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-right"/>
-				</call-template>
+		<if test="not($USE_DEFAULT_TABLE_CLASS) and boolean(table:table-cell[1]/@table:style-name)">
+			<variable name="style-name" select="table:table-cell[1]/@table:style-name"/>
+			<variable name="total-style-name" select="count(table:table-cell/@table:style-name)"/>
+			<variable name="total-equal-style-name" select="count(table:table-cell[@table:style-name=$style-name])"/>
 
-				<call-template name="translate-style-property">
-					<with-param name="style-name" select="'padding'"/>
-					<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding"/>
-				</call-template>
-				<call-template name="translate-style-property">
-					<with-param name="style-name" select="'padding-top'"/>
-					<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-top"/>
-				</call-template>
-				<call-template name="translate-style-property">
-					<with-param name="style-name" select="'padding-bottom'"/>
-					<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-bottom"/>
-				</call-template>
-				<call-template name="translate-style-property">
-					<with-param name="style-name" select="'padding-left'"/>
-					<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-left"/>
-				</call-template>
-				<call-template name="translate-style-property">
-					<with-param name="style-name" select="'padding-right'"/>
-					<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-right"/>
-				</call-template>
-			</if>
-		</variable>
-
-		<text>|-</text>
+                        <variable name="style">
+				<if test="$total-equal-style-name=$total-style-name">
+					<call-template name="translate-table-cell-properties">
+						<with-param name="style-element" select="key('style-ref', $style-name)"/>
+					</call-template>
+				</if>
+			</variable>
 
-                <if test="string-length($style) > 0">
-			<text> style="</text>
-			<value-of select="$style"/>
-			<text>" </text>
+                        <if test="string-length($style) > 0">
+				<text> style="</text>
+				<value-of select="$style"/>
+				<text>"</text>
+			</if>
 		</if>
 
                 <value-of select="$NL"/>
@@ -509,57 +468,14 @@
 			</choose>
 		</if>
 
-		<variable name="style-name" select="@table:style-name"/>
 		<if test="not($USE_DEFAULT_TABLE_CLASS) and boolean(@table:style-name)">
-	 		<variable name="style-element" select="key('style-ref', @table:style-name)"/>			
+			<variable name="style-name" select="@table:style-name"/>
+
 			<variable name="style">
 				<!-- Only if cells have a different style-name -->
 				<if test="count(../table:table-cell/@table:style-name) !=  count(../table:table-cell[@table:style-name=$style-name]) and count(../table:table-cell/@table:style-name) > 0">
-					<call-template name="translate-style-property">
-						<with-param name="style-name" select="'background-color'"/>
-						<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:background-color"/>
-					</call-template>
-				
-					<call-template name="translate-style-property">
-						<with-param name="style-name" select="'border'"/>
-						<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border"/>
-					</call-template>
-					<call-template name="translate-style-property">
-						<with-param name="style-name" select="'border-top'"/>
-						<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-top"/>
-					</call-template>
-					<call-template name="translate-style-property">
-						<with-param name="style-name" select="'border-bottom'"/>
-						<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-bottom"/>
-					</call-template>
-					<call-template name="translate-style-property">
-						<with-param name="style-name" select="'border-left'"/>
-						<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-left"/>
-					</call-template>
-					<call-template name="translate-style-property">
-						<with-param name="style-name" select="'border-right'"/>
-						<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-right"/>
-					</call-template>
-				
-					<call-template name="translate-style-property">
-						<with-param name="style-name" select="'padding'"/>
-						<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding"/>
-					</call-template>
-					<call-template name="translate-style-property">
-						<with-param name="style-name" select="'padding-top'"/>
-						<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-top"/>
-					</call-template>
-					<call-template name="translate-style-property">
-						<with-param name="style-name" select="'padding-bottom'"/>
-						<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-bottom"/>
-					</call-template>
-					<call-template name="translate-style-property">
-						<with-param name="style-name" select="'padding-left'"/>
-						<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-left"/>
-					</call-template>
-					<call-template name="translate-style-property">
-						<with-param name="style-name" select="'padding-right'"/>
-						<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-right"/>
+					<call-template name="translate-table-cell-properties">
+						<with-param name="style-element" select="key('style-ref', $style-name)"/>
 					</call-template>
 				</if>
                         </variable>
@@ -608,59 +524,16 @@
 			</choose>
 		</if>
 
-		<variable name="style-name" select="@table:style-name"/>
 		<if test="not($USE_DEFAULT_TABLE_CLASS) and boolean(@table:style-name)">
-	 		<variable name="style-element" select="key('style-ref', @table:style-name)"/>			
-			<variable name="style">
+			<variable name="style-name" select="@table:style-name"/>
+
+                        <variable name="style">
 				<!-- Only if cells have a different style-name -->
 				<if test="count(../table:table-cell/@table:style-name) !=  count(../table:table-cell[@table:style-name=$style-name]) and count(../table:table-cell/@table:style-name) > 0">
-					<call-template name="translate-style-property">
-						<with-param name="style-name" select="'background-color'"/>
-						<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:background-color"/>
-					</call-template>
-				
-					<call-template name="translate-style-property">
-						<with-param name="style-name" select="'border'"/>
-						<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border"/>
-					</call-template>
-					<call-template name="translate-style-property">
-						<with-param name="style-name" select="'border-top'"/>
-						<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-top"/>
-					</call-template>
-					<call-template name="translate-style-property">
-						<with-param name="style-name" select="'border-bottom'"/>
-						<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-bottom"/>
-					</call-template>
-					<call-template name="translate-style-property">
-						<with-param name="style-name" select="'border-left'"/>
-						<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-left"/>
-					</call-template>
-					<call-template name="translate-style-property">
-						<with-param name="style-name" select="'border-right'"/>
-						<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-right"/>
-					</call-template>
-				
-					<call-template name="translate-style-property">
-						<with-param name="style-name" select="'padding'"/>
-						<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding"/>
+					<call-template name="translate-table-cell-properties">
+						<with-param name="style-element" select="key('style-ref', $style-name)"/>
 					</call-template>
-					<call-template name="translate-style-property">
-						<with-param name="style-name" select="'padding-top'"/>
-						<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-top"/>
-					</call-template>
-					<call-template name="translate-style-property">
-						<with-param name="style-name" select="'padding-bottom'"/>
-						<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-bottom"/>
-					</call-template>
-					<call-template name="translate-style-property">
-						<with-param name="style-name" select="'padding-left'"/>
-						<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-left"/>
-					</call-template>
-					<call-template name="translate-style-property">
-						<with-param name="style-name" select="'padding-right'"/>
-						<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-right"/>
-					</call-template>
-				</if>
+                                </if>
                         </variable>
 			
 			<if test="string-length($style) > 0">
@@ -674,7 +547,57 @@
 		<value-of select="$NL"/>
 	</template>
 
-	<template name="translate-style-property">
+	<template name="translate-table-cell-properties">
+		<param name="style-element"/>
+		<call-template name="translate-style-property">
+			<with-param name="style-name" select="'background-color'"/>
+			<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:background-color"/>
+		</call-template>
+
+		<call-template name="translate-style-property">
+			<with-param name="style-name" select="'border'"/>
+			<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border"/>
+		</call-template>
+		<call-template name="translate-style-property">
+			<with-param name="style-name" select="'border-top'"/>
+			<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-top"/>
+		</call-template>
+		<call-template name="translate-style-property">
+			<with-param name="style-name" select="'border-bottom'"/>
+			<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-bottom"/>
+		</call-template>
+		<call-template name="translate-style-property">
+			<with-param name="style-name" select="'border-left'"/>
+			<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-left"/>
+		</call-template>
+		<call-template name="translate-style-property">
+			<with-param name="style-name" select="'border-right'"/>
+			<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-right"/>
+		</call-template>
+
+		<call-template name="translate-style-property">
+			<with-param name="style-name" select="'padding'"/>
+			<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding"/>
+		</call-template>
+		<call-template name="translate-style-property">
+			<with-param name="style-name" select="'padding-top'"/>
+			<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-top"/>
+		</call-template>
+		<call-template name="translate-style-property">
+			<with-param name="style-name" select="'padding-bottom'"/>
+			<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-bottom"/>
+		</call-template>
+		<call-template name="translate-style-property">
+			<with-param name="style-name" select="'padding-left'"/>
+			<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-left"/>
+		</call-template>
+		<call-template name="translate-style-property">
+			<with-param name="style-name" select="'padding-right'"/>
+			<with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-right"/>
+		</call-template>
+	</template>
+
+        <template name="translate-style-property">
 		<param name="style-name"/>
 		<param name="style-property"/>
 		


More information about the Libreoffice-commits mailing list