diff options
author | Robert Antoni Buj Gelonch <robert.buj@gmail.com> | 2015-04-24 12:29:54 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-04-30 12:20:24 +0000 |
commit | 57a283ed3c7a09a75c7a755313a4df8038664e83 (patch) | |
tree | c84131d1a40a79e1fab677124097e4b8386fdd11 | |
parent | 9c054bb47127559513a40b0df4a5e3f6d8dcc1d7 (diff) |
tdf#75019 bookmarks in exporting to mediawiki
Change-Id: Ieb066d37196a22e67226d59e12c7869c1fc8cc8a
Reviewed-on: https://gerrit.libreoffice.org/15509
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-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 7d03510666db..7198a1fb22ff 100644 --- a/swext/mediawiki/src/filter/odt2mediawiki.xsl +++ b/swext/mediawiki/src/filter/odt2mediawiki.xsl @@ -516,12 +516,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> @@ -894,6 +919,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 == --> |