[PATCH 2/3] Improve tokenizing of linkable terms

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently only tabs and blanks are used for tokenizing the description,
which breaks when a term is at the end of a line or has () appended to
it.
1. Use also other white space characters such as new-lines and carriage
   return for splitting.
2. Remove some common non-word characters from the token before lookup.

Signed-off-by: Philipp Hahn <hahn@xxxxxxxxxxxxx>
---
 docs/newapi.xsl |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/docs/newapi.xsl b/docs/newapi.xsl
index 445a48c..6e1c646 100644
--- a/docs/newapi.xsl
+++ b/docs/newapi.xsl
@@ -54,10 +54,13 @@
        because the keys are only defined on the main document -->
   <xsl:template mode="dumptoken" match='*'>
     <xsl:param name="token"/>
-    <xsl:variable name="ref" select="key('symbols', $token)"/>
+    <xsl:variable name="stem" select="translate($token, '(),.:;@', '')"/>
+    <xsl:variable name="ref" select="key('symbols', $stem)"/>
     <xsl:choose>
       <xsl:when test="$ref">
-        <a href="libvirt-{$ref/@file}.html#{$ref/@name}"><xsl:value-of select="$token"/></a>
+        <xsl:value-of select="substring-before($token, $stem)"/>
+        <a href="libvirt-{$ref/@file}.html#{$ref/@name}"><xsl:value-of select="$stem"/></a>
+        <xsl:value-of select="substring-after($token, $stem)"/>
       </xsl:when>
       <xsl:otherwise>
         <xsl:value-of select="$token"/>
@@ -70,7 +73,7 @@
     <xsl:param name="text"/>
     <xsl:variable name="ctxt" select='.'/>
     <!-- <xsl:value-of select="$text"/> -->
-    <xsl:for-each select="str:tokenize($text, ' &#9;')">
+    <xsl:for-each select="str:tokenize($text, ' &#9;&#10;&#13;')">
       <xsl:apply-templates select="$ctxt" mode='dumptoken'>
         <xsl:with-param name="token" select="string(.)"/>
       </xsl:apply-templates>
-- 
1.7.1


--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]