Kaydet (Commit) c4a8c792 authored tarafından Robert Antoni Buj Gelonch's avatar Robert Antoni Buj Gelonch Kaydeden (comit) Adolfo Jayme Barrientos

odt2mediawiki.xsl: vertical & horizontal align of a image

Change-Id: I45cdffe132a796ccf06023f4465a2633df1926f3
Reviewed-on: https://gerrit.libreoffice.org/15544Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarAdolfo Jayme Barrientos <fitojb@ubuntu.com>
üst 4f351515
...@@ -977,53 +977,38 @@ ...@@ -977,53 +977,38 @@
<apply-templates/> <apply-templates/>
</variable> </variable>
<text>[[</text> <variable name="picture">
<call-template name="mk-image-name"> <text>[[</text>
<with-param name="image" select="$image"/> <call-template name="mk-image-name">
<with-param name="image" select="$image"/>
</call-template>
<text>|thumb</text>
</variable>
<!-- Picture markup + Horizontal & Vertical align -->
<call-template name="mk-image-align">
<with-param name="picture" select="$picture"/>
</call-template> </call-template>
<text>|thumb|</text>
<!-- Image alt --> <!-- Image caption -->
<if test="name(following-sibling::*)='svg:title'"> <text>|</text>
<text>alt="</text>
<value-of select="following-sibling::*/text()"/>
<text>"|</text>
</if>
<value-of select="normalize-space($image-description)"/> <value-of select="normalize-space($image-description)"/>
<text>]]</text>
<text>]]</text>
</template> </template>
<template match="draw:image[not(boolean(ancestor::draw:text-box))]"> <template match="draw:image[not(boolean(ancestor::draw:text-box))]">
<text>[[</text> <variable name="picture">
<call-template name="mk-image-name"> <text>[[</text>
<with-param name="image" select="."/> <call-template name="mk-image-name">
</call-template> <with-param name="image" select="."/>
</call-template>
</variable>
<!-- Horizontal align --> <!-- Picture markup + Horizontal & Vertical align -->
<if test="name(..)='draw:frame' and boolean(../@draw:style-name)"> <call-template name="mk-image-align">
<variable name="style-element" select="key('style-ref', ../@draw:style-name)"/> <with-param name="picture" select="$picture"/>
<if test="boolean($style-element/style:graphic-properties/@style:wrap)"> </call-template>
<choose>
<!-- No wrap -->
<when test="$style-element/style:graphic-properties/@style:wrap='none'">
<choose>
<when test="boolean($style-element/style:graphic-properties/@style:horizontal-pos)">
<choose>
<when test="$style-element/style:graphic-properties/@style:horizontal-pos='center'">
<text>|center</text>
</when>
<otherwise>
<text>|none</text>
</otherwise>
</choose>
</when>
<otherwise>
<text>|none</text>
</otherwise>
</choose>
</when>
</choose>
</if>
</if>
<!-- Image alt --> <!-- Image alt -->
<if test="name(following-sibling::*)='svg:title'"> <if test="name(following-sibling::*)='svg:title'">
...@@ -1031,8 +1016,106 @@ ...@@ -1031,8 +1016,106 @@
<value-of select="following-sibling::*/text()"/> <value-of select="following-sibling::*/text()"/>
<text>"</text> <text>"</text>
</if> </if>
<text>]]</text>
</template> <text>]]</text>
</template>
<template name="mk-image-align">
<param name="picture"/>
<choose>
<when test="name(..)='draw:frame' and boolean(../@draw:style-name)">
<variable name="style-element" select="key('style-ref', ../@draw:style-name)"/>
<choose>
<when test="boolean($style-element/style:graphic-properties/@style:wrap)">
<choose>
<!-- wrap=none -->
<when test="$style-element/style:graphic-properties/@style:wrap='none'">
<text>{{clear}}</text>
<value-of select="$NL"/>
<value-of select="$picture"/>
<choose>
<when test="boolean($style-element/style:graphic-properties/@style:horizontal-pos)">
<choose>
<when test="$style-element/style:graphic-properties/@style:horizontal-pos='center'">
<text>|center</text>
</when>
<otherwise>
<text>|none</text>
</otherwise>
</choose>
</when>
<otherwise>
<text>|none</text>
</otherwise>
</choose>
</when>
<!-- wrap != none -->
<otherwise>
<value-of select="$picture"/>
<!-- Horizontal align -->
<call-template name="mk-image-horizontal-align">
<with-param name="style-element" select="$style-element"/>
</call-template>
<!-- Vertical align -->
<call-template name="mk-image-vertical-align">
<with-param name="style-element" select="$style-element"/>
</call-template>
</otherwise>
</choose>
</when>
<!-- without wrap -->
<otherwise>
<value-of select="$picture"/>
<!-- Horizontal align -->
<call-template name="mk-image-horizontal-align">
<with-param name="style-element" select="$style-element"/>
</call-template>
<!-- Vertical align -->
<call-template name="mk-image-vertical-align">
<with-param name="style-element" select="$style-element"/>
</call-template>
</otherwise>
</choose>
</when>
<otherwise>
<value-of select="$picture"/>
</otherwise>
</choose>
</template>
<template name="mk-image-horizontal-align">
<param name="style-element"/>
<if test="boolean($style-element/style:graphic-properties/@style:horizontal-pos)">
<choose>
<when test="$style-element/style:graphic-properties/@style:horizontal-pos='right'">
<text>|right</text>
</when>
<when test="$style-element/style:graphic-properties/@style:horizontal-pos='left'">
<text>|left</text>
</when>
</choose>
</if>
</template>
<template name="mk-image-vertical-align">
<param name="style-element"/>
<if test="boolean($style-element/style:graphic-properties/@style:vertical-pos)">
<choose>
<when test="$style-element/style:graphic-properties/@style:vertical-pos='top'">
<text>|top</text>
</when>
<when test="$style-element/style:graphic-properties/@style:vertical-pos='middle'">
<text>|middle</text>
</when>
<when test="$style-element/style:graphic-properties/@style:vertical-pos='below'">
<text>|below</text>
</when>
</choose>
</if>
</template>
<template name="mk-image-name"> <template name="mk-image-name">
<param name="image"/> <param name="image"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment