swext/mediawiki/src/filter/odt2mediawiki.xsl |   56 ++++++++++++++++++++++++---
 1 file changed, 50 insertions(+), 6 deletions(-)

New commits:
commit dc2f0921233e63162f6aacf16041d89e318aee35
Author: Robert Antoni Buj Gelonch <robert....@gmail.com>
Date:   Fri Apr 24 12:19:51 2015 +0200

    tdf#75019 bookmarks in exporting to mediawiki
    
    Change-Id: Ia20fea0a7c265aedb11e0018c321395ee874fd1e
    Reviewed-on: https://gerrit.libreoffice.org/15507
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>
    Tested-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>

diff --git a/swext/mediawiki/src/filter/odt2mediawiki.xsl 
b/swext/mediawiki/src/filter/odt2mediawiki.xsl
index 1205536..44646b1 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) &gt; 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 == 
        -->
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to