[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/kioslave/man
From:       Nicolas Goutte <nicolasg () snafu ! de>
Date:       2005-06-02 18:05:20
Message-ID: 1117735520.435066.4731.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 421302 by goutte:

Add support for references to man pages where a non-breaking space exists
between command and section number
(as using a non-breaking space in this case is even more logical than
using a normal space.)
BUG:85753


 M  +18 -10    man2html.cpp  


--- trunk/KDE/kdebase/kioslave/man/man2html.cpp #421301:421302
@@ -315,7 +315,7 @@
     s_stringDefinitionMap.insert( "Gt", StringDefinition( 1, "&gt;" ) );
     s_stringDefinitionMap.insert( "Pm", StringDefinition( 1, "&plusmn;" ) );
     s_stringDefinitionMap.insert( "If", StringDefinition( 1, "&infin;" ) );
-    s_stringDefinitionMap.insert( "Na", StringDefinition( 3, "NaN" ) ); // Not a \
Number ### TODO: does it exist in Unicode? +    s_stringDefinitionMap.insert( "Na", \
StringDefinition( 3, "NaN" ) );  s_stringDefinitionMap.insert( "Ba", \
StringDefinition( 1, "|" ) );  // end mdoc-only
     // man(7)
@@ -778,7 +778,8 @@
 	    f=idtest[j];
 	    /* check section */
 	    g=strchr(f,')');
-	    if (g!=NULL && (g-f)<12 && (isalnum(f[-1]) || f[-1]=='>') &&
+            // The character before f must alphanumeric, the end of a HTML tag or \
the end of a &nbsp; +            if (g!=NULL && f>c && (g-f)<12 && (isalnum(f[-1]) || \
f[-1]=='>' || ( f[-1] == ';' ) ) &&  isdigit(f[1]) && f[1]!='0' && ((g-f)<=2 || \
isalpha(f[2])))  {
 		ok = TRUE;
@@ -792,14 +793,12 @@
 		    }
 		}
 	    }
-	    else ok = FALSE;
+            else
+                ok = false;
 
-	    if (ok)
-	    {
-		/* this might be a link */
-		h=f-1;
-  // ### TODO
-#if 0
+            h = f - 1;
+            if ( ok )
+            {
                 // Skip &nbsp;
                 kdDebug(7107) << "BEFORE SECTION:" <<  *h << endl;
                 if ( ( h > c + 5 ) && ( ! memcmp( h-5, "&nbsp;", 6 ) ) )
@@ -807,7 +806,16 @@
                     h -= 6;
                     kdDebug(7107) << "Skip &nbsp;" << endl;
                 }
-#endif
+                else if ( *h == ';' )
+                {
+                    // Not a non-breaking space, so probably not ok
+                    ok = false;
+                }
+            }
+            
+	    if (ok)
+	    {
+		/* this might be a link */
 		/* skip html makeup */
 		while (h>c && *h=='>') {
 		    while (h!=c && *h!='<') h--;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic