Here is an updated version of my patch (to current HEAD).
It alsos fixes the problem in the DOM extension!!! You may now use just
<function> that my hacked version of format_function() will handle it
properly.
Nuno
Index: livedoc.php
===================================================================
RCS file: /repository/livedocs/livedoc.php,v
retrieving revision 1.103
diff -u -r1.103 livedoc.php
--- livedoc.php 7 May 2004 13:32:58 -0000 1.103
+++ livedoc.php 10 May 2004 13:14:25 -0000
@@ -127,7 +127,7 @@
}
/* Checks if translated file is updated */
-if ($lang != 'en' && isset($lang_rev)) {
+if ($lang != 'en' && $lang_rev) {
/* get english file revision */
$data = @file_get_contents(FALLBACK_BASE . $filename);
@@ -349,6 +349,19 @@
$entities['&' . $r[0] . ';'] = $r[1];
}
+ /* If language!=English and entity was not found */
+ if($GLOBALS['lang'] != 'en') {
+ foreach($entities_to_find as $ent) {
+ if(!isset($entities['&' . $ent . ';'])) {
+ $q = sqlite_single_query($GLOBALS['fb_idx'],
"SELECT value FROM ents WHERE entid='$ent'");
+ if (!$q) {
+ break;
+ }
+ $entities['&' . $ent . ';'] = $q;
+ }
+ }
+ }
+
/* substitute */
$data = strtr($data, $entities);
@@ -395,6 +408,7 @@
$data = preg_replace('@<!--\s+.*\s-->@Usm', '', $data);
/* Replace entities */
+ $data = str_replace($search, $replace, $data);
$data = bind_entities($data);
/* catch any undefined entities */
@@ -413,8 +427,6 @@
$data = preg_replace('/&([a-zA-Z0-9-]+)\.([a-zA-Z0-9.-]+);/sm',
'<phpdoc_include ref="\\1.\\2"/>', $data);
}
- $data = str_replace($search, $replace, $data);
-
$page = new DocBookToHTML($data);
@@ -506,30 +518,34 @@
{
$parts = explode('.', $ref);
- $stag = 'function';
- $etag = 'function';
-
- if (count($parts) == 4) {
- $id = 'function.' . $parts[3];
- $func_name = lookup_title($id);
- } elseif ($parts[3] == 'class' && count($parts) == 5) {
- $id = 'class.' . $parts[4];
- $func_name = strtr($parts[4], array('-'=>'_'));
- $stag = "xref linkend=\"$id\"";
- $etag = "xref";
- } else {
- /* some weird node type we don't understand */
- $id = $ref;
- $func_name = 'Unknown ??';
- }
-
- if($parts[3] == 'class') {
- $title = ' - ' . lookup_title($id) . ' class';
- } else {
- $title = ' - ' . bind_entities(sqlite_single_query($GLOBALS['idx'],
"SELECT descr from toc where docbook_id='$id'"));
- }
+ $stag = 'function';
+ $etag = 'function';
+
+ if (count($parts) == 5 && $parts[3] == 'class') {
+ $id = 'class.' . $parts[4];
+ $stag = "xref linkend=\"$id\"";
+ $etag = 'xref';
+ $name = strtoupper($parts[4]);
+ $title = "$name class";
+ } else {
+ $id = 'function.' . strtolower($parts[3]);
+ $q = sqlite_array_query($GLOBALS['idx'], "SELECT title,descr from toc
where docbook_id='$id'", SQLITE_NUM);
+
+ if($q) {
+ $name = $q[0][0];
+ $title = $q[0][1];
+ } else {
+ $name = $id;
+ $title = '???';
+ }
- return "<div class=\"function_link\"><$stag>$func_name</$etag>$title</div>";
+ /* Fetch english description */
+ if($GLOBALS['lang'] != 'en' && $name == $title) {
+ $title = sqlite_single_query($GLOBALS['fb_idx'], "SELECT descr
from toc where docbook_id='$id'");
+ }
+ }
+
+ return "<div class=\"function_link\"><$stag>$name</$etag> - " .
bind_entities($title) . '</div>';
}
function make_xref($ref)
Index: mk_phpdoc.php
===================================================================
RCS file: /repository/livedocs/mk_phpdoc.php,v
retrieving revision 1.8
diff -u -r1.8 mk_phpdoc.php
--- mk_phpdoc.php 1 May 2004 09:46:46 -0000 1.8
+++ mk_phpdoc.php 10 May 2004 13:14:26 -0000
@@ -46,7 +46,7 @@
if ($f == 'configure.xml' || $f ==
'constants.xml' || $f == 'ini.xml' || $f == 'reference.xml') {
$docbook_id = 'ref.' .
basename($path);
} else {
- $docbook_id = 'function.' .
substr($f, 0, -4);
+ $docbook_id = 'function.' .
strtolower(substr($f, 0, -4));
}
break;
case 'language' :
Index: mkindex.php
===================================================================
RCS file: /repository/livedocs/mkindex.php,v
retrieving revision 1.32
diff -u -r1.32 mkindex.php
--- mkindex.php 27 Apr 2004 14:43:28 -0000 1.32
+++ mkindex.php 10 May 2004 13:14:26 -0000
@@ -96,7 +96,7 @@
if ($this->last_id !== false) {
echo "\tAdded ID {$this->last_id}\n";
- $this->data .= "INSERT INTO idents VALUES ('{$this->last_id}',
{$this->fileid}, '" . sqlite_escape_string(trim($this->cdata)) . "');";
+ $this->data .= "INSERT INTO idents VALUES ('".
strtolower($this->last_id) . "', {$this->fileid}, '" .
sqlite_escape_string(trim($this->cdata)) . "');";
$this->last_id = false;
}
Index: mktoc.php
===================================================================
RCS file: /repository/livedocs/mktoc.php,v
retrieving revision 1.8
diff -u -r1.8 mktoc.php
--- mktoc.php 16 Feb 2004 17:54:59 -0000 1.8
+++ mktoc.php 10 May 2004 13:14:26 -0000
@@ -68,7 +68,7 @@
array_push($this->id_stack, $this->last_id);
array_push($this->docbook_id_stack, $docbook_id);
- echo "INSERT INTO toc VALUES ({$this->last_id}, {$level},
{$parent_id}, '{$docbook_id}', '{$docbook_parent_id}', '{$path}', '{$title}',
'{$title}');\n";
+ echo "INSERT INTO toc VALUES ({$this->last_id}, {$level},
{$parent_id}, '".strtolower($docbook_id)."', '{$docbook_parent_id}', '{$path}',
'{$title}', '{$title}');\n";
$this->last_id++;
}
Index: style_mapping.php
===================================================================
RCS file: /repository/livedocs/style_mapping.php,v
retrieving revision 1.14
diff -u -r1.14 style_mapping.php
--- style_mapping.php 10 May 2004 10:20:42 -0000 1.14
+++ style_mapping.php 10 May 2004 13:14:26 -0000
@@ -203,7 +203,7 @@
function format_pubdate($node)
{
- return sprintf('<div class="%s">Published on: %s</div>', $node->tagname,
htmlspecialchars($node->content, ENT_NOQUOTES));
+ return sprintf('<div class="%s">' . bind_entities('&livedocs.published;') .
'</div>', $node->tagname, htmlspecialchars($node->content, ENT_NOQUOTES));
}
function format_ulink($node)
@@ -254,16 +254,21 @@
'->' => '-');
$itemid = strtr($node->content, $replace);
- $itemid = strtr($itemid, array('---' => '-'));
+ $itemid = strtolower(strtr($itemid, array('---' => '-')));
- $class = 'function';
if (isset($node->attributes['class'])) {
$class = 'method';
$dest = $node->attributes['class'] . '.method.' . $itemid;
} else {
- $dest = 'function.' . $itemid;
+ $class = 'function';
+
+ if($current_page == 'ref.dom' || substr($current_page, 0, 13) ==
'function.dom-') {
+ $dest = 'function.dom-' . $itemid;
+ } else {
+ $dest = 'function.' . $itemid;
+ }
}
-
+
if ($current_page == $dest) {
return sprintf('<span class="%s"%s>%s()</span>', $class, LTR,
$node->content);
}
@@ -281,9 +286,12 @@
{
global $lang;
- $link = strtr($matches[1], array('_' => '-'));
- $link = WEBBASE . (FORCE_DYNAMIC ? "?l=$lang&q=function.$link" :
"$lang/function.$link.html");
- return '<a class="phpfunc" href="' . $link . '">' . $matches[1] . '</a>(';
+ $link = 'function.' . strtr($matches[1], array('_' => '-'));
+ if ($link == $GLOBALS['current_page'])
+ return $matches[0];
+
+ $link = WEBBASE . (FORCE_DYNAMIC ? "?l=$lang&q=$link" : "$lang/$link.html");
+ return '<a class="phpfunc" href="' . $link . '">' . $matches[1] .
'</a></span>' . $matches[3];
}
function format_listing($node)
Index: themes/default/html_format.php
===================================================================
RCS file: /repository/livedocs/themes/default/html_format.php,v
retrieving revision 1.8
diff -u -r1.8 html_format.php
--- themes/default/html_format.php 10 May 2004 10:20:42 -0000 1.8
+++ themes/default/html_format.php 10 May 2004 13:14:26 -0000
@@ -36,7 +36,7 @@
<title>$title</title>
<link rel="stylesheet" href="$css_url" />
</head>
-<body $dir>
+<body$dir>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td height="1"></td><td rowspan="2" valign="top">
HEAD;
Index: themes/php.net/html_format.php
===================================================================
RCS file: /repository/livedocs/themes/php.net/html_format.php,v
retrieving revision 1.10
diff -u -r1.10 html_format.php
--- themes/php.net/html_format.php 10 May 2004 10:20:42 -0000 1.10
+++ themes/php.net/html_format.php 10 May 2004 13:14:26 -0000
@@ -45,7 +45,7 @@
<link rel="shortcut icon" href="/favicon.ico" />
<script language="Javascript" type="text/javascript" src="/userprefs.js" />
</head>
-<body $dir>
+<body$dir>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#9999cc">
<td align="center" rowspan="2" width="126"><a href="/"><img src="/images/php.gif"
alt="PHP" width="120" height="67" hspace="3" /></a></td>
Index: themes/smarty/html_format.php
===================================================================
RCS file: /repository/livedocs/themes/smarty/html_format.php,v
retrieving revision 1.2
diff -u -r1.2 html_format.php
--- themes/smarty/html_format.php 10 May 2004 10:20:42 -0000 1.2
+++ themes/smarty/html_format.php 10 May 2004 13:14:26 -0000
@@ -97,7 +97,7 @@
</table>
-<table cellpadding="0" cellspacing="0" $dir>
+<table cellpadding="0" cellspacing="0"$dir>
<tr valign="top">
<td bgcolor="#f0ead8">
<table width="170" cellpadding="4" cellspacing="0">