diff options
author | Robert Antoni Buj Gelonch <robert.buj@gmail.com> | 2015-04-24 12:19:51 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2015-04-28 10:01:18 +0200 |
commit | f2dd216f3bd3414b12b30e4ce39b7b72baaf7554 (patch) | |
tree | 295c89d15e4242a511366ed0eeb0ee65d1abe512 /swext | |
parent | 929bca0797ae344b0fca337508a6b1e313b6f613 (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>
Diffstat (limited to 'swext')
-rw-r--r-- | swext/mediawiki/src/filter/odt2mediawiki.xsl | 56 |
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) > 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 == --> |