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 @@
<apply-templates/>
</variable>
<text>[[</text>
<call-template name="mk-image-name">
<with-param name="image" select="$image"/>
<variable name="picture">
<text>[[</text>
<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>
<text>|thumb|</text>
<!-- Image alt -->
<if test="name(following-sibling::*)='svg:title'">
<text>alt="</text>
<value-of select="following-sibling::*/text()"/>
<text>"|</text>
</if>
<!-- Image caption -->
<text>|</text>
<value-of select="normalize-space($image-description)"/>
<text>]]</text>
<text>]]</text>
</template>
<template match="draw:image[not(boolean(ancestor::draw:text-box))]">
<text>[[</text>
<call-template name="mk-image-name">
<with-param name="image" select="."/>
</call-template>
<variable name="picture">
<text>[[</text>
<call-template name="mk-image-name">
<with-param name="image" select="."/>
</call-template>
</variable>
<!-- Horizontal align -->
<if test="name(..)='draw:frame' and boolean(../@draw:style-name)">
<variable name="style-element" select="key('style-ref', ../@draw:style-name)"/>
<if test="boolean($style-element/style:graphic-properties/@style:wrap)">
<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>
<!-- Picture markup + Horizontal & Vertical align -->
<call-template name="mk-image-align">
<with-param name="picture" select="$picture"/>
</call-template>
<!-- Image alt -->
<if test="name(following-sibling::*)='svg:title'">
......@@ -1031,8 +1016,106 @@
<value-of select="following-sibling::*/text()"/>
<text>"</text>
</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">
<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