diff options
author | Robert Antoni Buj Gelonch <robert.buj@gmail.com> | 2015-04-20 13:01:28 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2015-04-20 13:52:14 +0000 |
commit | 50c43b030b2911d83b2e8fc4bc0499b1641cb043 (patch) | |
tree | d3a207aef00be9ebe8ed422a8f63b14f917045e2 /swext | |
parent | 423cfc2061babc90a61bbd97f38da13ba538396d (diff) |
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@redhat.com>
Reviewed-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'swext')
-rw-r--r-- | swext/mediawiki/src/filter/odt2mediawiki.xsl | 233 |
1 files changed, 78 insertions, 155 deletions
diff --git a/swext/mediawiki/src/filter/odt2mediawiki.xsl b/swext/mediawiki/src/filter/odt2mediawiki.xsl index d6806803f15d..54f60030740b 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"/> |