[Libreoffice-commits] core.git: swext/mediawiki
Robert Antoni Buj Gelonch
robert.buj at gmail.com
Mon Apr 27 06:16:27 PDT 2015
swext/mediawiki/src/filter/odt2mediawiki.xsl | 58 +++++++++++++++++++++++----
1 file changed, 51 insertions(+), 7 deletions(-)
New commits:
commit 26b9122e7861906337c260d233910ed5ebf19dfa
Author: Robert Antoni Buj Gelonch <robert.buj at gmail.com>
Date: Thu Apr 23 00:17:00 2015 +0200
tdf#75019 bookmarks in exporting to mediawiki
Add support for exporting common bookmarks
Add support for going to a specific bookmark (including TOC)
Change-Id: I2775d8b03a5bd986ffcbdf7c95a1fbed755e3bd6
Reviewed-on: https://gerrit.libreoffice.org/15486
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
diff --git a/swext/mediawiki/src/filter/odt2mediawiki.xsl b/swext/mediawiki/src/filter/odt2mediawiki.xsl
index c9f5964..88354e3 100644
--- a/swext/mediawiki/src/filter/odt2mediawiki.xsl
+++ b/swext/mediawiki/src/filter/odt2mediawiki.xsl
@@ -658,12 +658,37 @@
<variable name="link-ref" select="@xlink:href"/>
<choose>
<when test="string-length($link-ref) > 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>
@@ -1124,7 +1149,26 @@
<!-- 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 ==
-->
More information about the Libreoffice-commits
mailing list