[prev in list] [next in list] [prev in thread] [next in thread]
List: php-doc-cvs
Subject: [DOC-CVS] =?utf-8?q?svn:_/phd/trunk/_package=5Fgeneric.xml_phpdotnet/phd/Format.php_phpdotnet/phd/PI
From: Hannes_Magnusson <bjori () php ! net>
Date: 2011-08-31 14:46:47
Message-ID: svn-bjori-1314802007-315899-974371644 () svn ! php ! net
[Download RAW message or body]
bjori Wed, 31 Aug 2011 14:46:47 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=315899
Log:
Added generate-index-for=(refentry,function,examples) support for the phpdoc PI \
handler (Hannes)
Changed paths:
U phd/trunk/package_generic.xml
U phd/trunk/phpdotnet/phd/Format.php
U phd/trunk/phpdotnet/phd/PI/PHPDOCHandler.php
Modified: phd/trunk/package_generic.xml
===================================================================
--- phd/trunk/package_generic.xml 2011-08-31 14:42:56 UTC (rev 315898)
+++ phd/trunk/package_generic.xml 2011-08-31 14:46:47 UTC (rev 315899)
@@ -47,6 +47,7 @@
<license uri="http://www.opensource.org/licenses/bsd-license.php">BSD \
Style</license> <notes>
- Added support for authorinitials, printhistory, revhistory, revision and \
revremark (Hannes) + - Added generate-index-for=(refentry,function,examples) \
support for the phpdoc PI handler (Hannes) </notes>
<contents>
Modified: phd/trunk/phpdotnet/phd/Format.php
===================================================================
--- phd/trunk/phpdotnet/phd/Format.php 2011-08-31 14:42:56 UTC (rev 315898)
+++ phd/trunk/phpdotnet/phd/Format.php 2011-08-31 14:46:47 UTC (rev 315899)
@@ -284,6 +284,12 @@
public function addVarname($id, $var) {
$this->vars[$var] = $id;
}
+ public function getRefs() {
+ return $this->refs;
+ }
+ public function getExamples() {
+ return $this->examples;
+ }
public function getRefnameLink($ref) {
return isset($this->refs[$ref]) ? $this->refs[$ref] : null;
}
Modified: phd/trunk/phpdotnet/phd/PI/PHPDOCHandler.php
===================================================================
--- phd/trunk/phpdotnet/phd/PI/PHPDOCHandler.php 2011-08-31 14:42:56 UTC (rev 315898)
+++ phd/trunk/phpdotnet/phd/PI/PHPDOCHandler.php 2011-08-31 14:46:47 UTC (rev 315899)
@@ -16,6 +16,55 @@
case "print-version-for":
// FIXME: Figureout a way to detect the current language (for \
unknownversion)
return $this->format->autogenVersionInfo($matches["value"], "en");
+ case "generate-index-for":
+ switch($matches["value"]) {
+ case "function":
+ case "refentry":
+ $ret = "<ul class='gen-index \
index-for-{$matches["value"]}'>"; + $tmp = \
$this->format->getRefs(); + $refs = array();
+ $info = array();
+ foreach($tmp as $id) {
+ $filename = $this->format->createLink($id, $desc);
+ $refs[$filename] = $desc;
+ $info[$filename] = \
array($this->format->getLongDescription($id, $islong), $islong); + \
} +
+ natcasesort($refs);
+
+ // Workaround for 5.3 that doesn't allow func()[index]
+ $current = current($refs);
+ $char = $current[0];
+
+ $ret .= "<li class='gen-index index-for-{$char}'>$char<ul \
class='index-for-{$char}'>\n"; + foreach($refs as $filename => \
$data) { + if ($data[0] != $char && strtolower($data[0]) \
!= $char) { + $char = strtolower($data[0]);
+ $ret .= "</ul></li>\n";
+ $ret .= "<li class='gen-index \
index-for-{$char}'>$char<ul class='index-for-{$char}'>\n"; + \
} + $longdesc = $info[$filename][1] ? " - \
{$info[$filename][0]}" : ""; + $ret .= '<li><a \
href="'.$filename. '" class="index">' .$data. '</a>' . $longdesc . '</li>'."\n"; + \
} + $ret .= "</ul></li></ul>\n\n";
+ return $ret;
+ break;
+
+ case "examples":
+ $ret = "<ul class='gen-index \
index-for-{$matches["value"]}'>"; + \
foreach($this->format->getExamples() as $idx => $id) { + \
$link = $this->format->createLink($id, $desc); + $ret .= \
'<li><a href="'.$link.'" class="index">Example#' .$idx. ' - ' .$desc. \
'</a></li>'."\n"; + }
+ $ret .= "</ul>";
+ return $ret;
+ break;
+ default:
+ trigger_error("Don't know how to handle {$matches["value"]} \
for {$matches["attr"]}", E_USER_WARNING); + break;
+ }
+ break;
+
default:
trigger_error("Don't know how to handle {$matches["attr"]}", \
E_USER_WARNING); break;
--
PHP Documentation Commits Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic