diff options
author | Robert Antoni Buj Gelonch <robert.buj@gmail.com> | 2015-04-23 00:17:00 +0200 |
---|---|---|
committer | Adolfo Jayme Barrientos <fitojb@ubuntu.com> | 2015-04-27 13:16:07 +0000 |
commit | 26b9122e7861906337c260d233910ed5ebf19dfa (patch) | |
tree | 53fefc319a1815cc2680249d2702c79487298ee8 /swext | |
parent | cc89e15a875f4644e32d92690e35f6a08ff5f7d7 (diff) |
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@libreoffice.org>
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Diffstat (limited to 'swext')
-rw-r--r-- | swext/mediawiki/src/filter/odt2mediawiki.xsl | 58 |
1 files changed, 51 insertions, 7 deletions
diff --git a/swext/mediawiki/src/filter/odt2mediawiki.xsl b/swext/mediawiki/src/filter/odt2mediawiki.xsl index c9f5964b9c71..88354e30801b 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 == --> |