summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Antoni Buj Gelonch <robert.buj@gmail.com>2015-04-24 12:19:51 +0200
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2015-04-27 13:21:06 +0000
commitdc2f0921233e63162f6aacf16041d89e318aee35 (patch)
tree31a4c4a652edcbd991c4b831ebc5317d118b2d3d
parent7a2f811a07b99e0b7ff7e1399311da2908301a97 (diff)
tdf#75019 bookmarks in exporting to mediawiki
Change-Id: Ia20fea0a7c265aedb11e0018c321395ee874fd1e Reviewed-on: https://gerrit.libreoffice.org/15507 Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com> Tested-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
-rw-r--r--swext/mediawiki/src/filter/odt2mediawiki.xsl56
1 files changed, 50 insertions, 6 deletions
diff --git a/swext/mediawiki/src/filter/odt2mediawiki.xsl b/swext/mediawiki/src/filter/odt2mediawiki.xsl
index 1205536bac42..44646b1aae80 100644
--- a/swext/mediawiki/src/filter/odt2mediawiki.xsl
+++ b/swext/mediawiki/src/filter/odt2mediawiki.xsl
@@ -514,12 +514,37 @@
<variable name="link-ref" select="@xlink:href"/>
<choose>
<when test="string-length($link-ref) &gt; 0">
- <variable name="link-label" select="string(.)"/>
- <text>[</text>
- <value-of select="$link-ref"/>
- <text> </text>
- <value-of select="$link-label"/>
- <text>]</text>
+ <choose>
+ <when test="starts-with($link-ref, '#')">
+ <text>[[</text>
+ <choose>
+ <when test="contains($link-ref, '_')">
+ <value-of select="translate($link-ref,'_','')"/>
+ </when>
+ <otherwise>
+ <value-of select="$link-ref"/>
+ </otherwise>
+ </choose>
+ <text>|</text>
+ <choose>
+ <when test="text:tab and ancestor::text:index-body">
+ <value-of select="node()[1]"/>
+ </when>
+ <otherwise>
+ <value-of select="string(.)"/>
+ </otherwise>
+ </choose>
+ <text>]]</text>
+ </when>
+
+ <otherwise>
+ <text>[</text>
+ <value-of select="$link-ref"/>
+ <text> </text>
+ <value-of select="string(.)"/>
+ <text>]</text>
+ </otherwise>
+ </choose>
</when>
<otherwise>
@@ -891,6 +916,25 @@
<!-- TODO: Output an anchor. -->
</template>
+ <template match="text:bookmark-start">
+ <if test="boolean(@text:name)">
+ <variable name="bookmark">
+ <choose>
+ <when test="contains(@text:name,'_')">
+ <value-of select="translate(@text:name,'_','')"/>
+ </when>
+ <otherwise>
+ <value-of select="@text:name"/>
+ </otherwise>
+ </choose>
+ </variable>
+ <text>{{anchor|</text>
+ <value-of select="$bookmark"/>
+ <text>}} </text>
+ </if>
+ <apply-templates/>
+ </template>
+
<!--
== Plain text ==
-->