Hi,

Here is one more patch, that fixes a bug in the descriptions of functions in
the ref.pages.
An examples in the ref.misc page.

Nuno
Index: livedoc.php
===================================================================
RCS file: /repository/livedocs/livedoc.php,v
retrieving revision 1.102
diff -u -r1.102 livedoc.php
--- livedoc.php 5 May 2004 08:49:43 -0000       1.102
+++ livedoc.php 7 May 2004 13:11:42 -0000
@@ -322,6 +322,41 @@
        }
 }
 
+/*****************************************************************************
+ * Search & Replace entities
+ */
+function check_ents($data) {
+
+       global $idx;
+       $entities = array();
+       $sanity = 0;
+
+       do {
+               $ent_count = preg_match_all('/&([a-zA-Z0-9.-]+);/sm', $data, $matches);
+               if ($ent_count == 0) {
+                       break;
+               }
+
+               /* now collect their values */
+               $entities_to_find = array_unique($matches[1]);
+               $ents = implode("','", $entities_to_find);
+               $q = sqlite_query($idx, "SELECT entid, value from ents where entid in 
('" . $ents . "')");
+               if (!$q) {
+                       break;
+               }
+
+               while ($r = sqlite_fetch_array($q, SQLITE_NUM)) {
+                       $entities['&' . $r[0] . ';'] = $r[1];
+               }
+
+               /* substitute */
+               $data = strtr($data, $entities);
+
+       } while ($sanity++ < 5);
+
+       return $data;
+}
+
 
 /*****************************************************************************
  * Helper functions for transformation
@@ -337,7 +372,6 @@
                $replace[] = html_entity_decode($item);
        }
 
-       $sanity = 0;
        $lang_rev = 0;
 
        $data = @file_get_contents($filename);
@@ -360,30 +394,8 @@
        /* strip comments */
        $data = preg_replace('@<!--\s+.*\s-->@Usm', '', $data);
 
-       /* list the entities that are required */
-       $entities = array();
-       do {
-               $ent_count = preg_match_all('/&([a-zA-Z0-9.-]+);/sm', $data, $matches);
-               if ($ent_count == 0) {
-                       break;
-               }
-
-               /* now collect their values */
-               $entities_to_find = array_unique($matches[1]);
-               $ents = implode("','", $entities_to_find);
-               $q = sqlite_query($idx, "SELECT entid, value from ents where entid in 
('" . $ents . "')");
-               if (!$q) {
-                       break;
-               }
-
-               while ($r = sqlite_fetch_array($q, SQLITE_NUM)) {
-                       $entities['&' . $r[0] . ';'] = $r[1];
-               }
-
-               /* substitute */
-               $data = strtr($data, $entities);
-
-       } while ($sanity++ < 5);
+       /* Replace entities */
+       $data = check_ents($data);
 
        /* catch any undefined entities */
        if ($included) {
@@ -514,7 +526,7 @@
        if($parts[3] == 'class') {
                $title = ' - ' . lookup_title($id) . ' class';
        } else {
-               $title = ' - ' . sqlite_single_query($GLOBALS['idx'], "SELECT descr 
from toc where docbook_id='$id'");
+               $title = ' - ' . check_ents(sqlite_single_query($GLOBALS['idx'], 
"SELECT descr from toc where docbook_id='$id'"));
        }
 
        return "<div class=\"function_link\"><$stag>$func_name</$etag>$title</div>";

Reply via email to