diff options
Diffstat (limited to 'swext/mediawiki')
-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 == --> |