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

Re: [libvirt] [PATCH 2/3] Improve tokenizing of linkable terms



On Thu, Aug 11, 2011 at 02:44:00PM +0200, Philipp Hahn wrote:
> 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 univention de>
> ---
>  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>

  ACK, that's good, thanks for digging and fixing this :-)

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


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