Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 113 additions & 4 deletions phpdotnet/phd/Package/Generic/XHTML.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ abstract class Package_Generic_XHTML extends Format_Abstract_XHTML {
/* DEFAULT */ 'span',
'ooclass' => array(
/* DEFAULT */ 'strong',
'classsynopsisinfo' => 'format_classsynopsisinfo_ooclass_classname',
'classsynopsisinfo' => 'format_classsynopsisinfo_ooclass_classname',
'interfacesynopsisinfo' => 'format_interfacesynopsisinfo_ooclass_classname',
),
),
'classsynopsis' => 'format_classsynopsis',
Expand Down Expand Up @@ -134,6 +135,8 @@ abstract class Package_Generic_XHTML extends Format_Abstract_XHTML {
'indexdiv' => 'format_dl',
'indexentry' => 'dd',
'initializer' => 'format_initializer',
'interfacesynopsis' => 'format_interfacesynopsis',
'interfacesynopsisinfo' => 'format_interfacesynopsisinfo',
'itemizedlist' => 'format_itemizedlist',
'legalnotice' => 'format_chunk',
'listitem' => array(
Expand Down Expand Up @@ -162,12 +165,14 @@ abstract class Package_Generic_XHTML extends Format_Abstract_XHTML {
'oointerface' => array(
/* DEFAULT */ 'span',
'classsynopsisinfo' => 'format_classsynopsisinfo_oointerface',
'interfacesynopsisinfo' => 'format_interfacesynopsisinfo_oointerface',
),
'interfacename' => array(
/* DEFAULT */ 'span',
'oointerface' => array(
/* DEFAULT */ 'span',
'classsynopsisinfo' => 'format_classsynopsisinfo_oointerface_interfacename',
/* DEFAULT */ 'format_suppressed_tags',
'classsynopsisinfo' => 'format_classsynopsisinfo_oointerface_interfacename',
'interfacesynopsisinfo' => 'format_suppressed_tags',
),
),
'exceptionname' => 'span',
Expand Down Expand Up @@ -381,7 +386,8 @@ abstract class Package_Generic_XHTML extends Format_Abstract_XHTML {
/* DEFAULT */ false,
'ooclass' => array(
/* DEFAULT */ false,
'classsynopsis' => 'format_classsynopsis_ooclass_classname_text',
'classsynopsis' => 'format_classsynopsis_ooclass_classname_text',
'interfacesynopsis' => 'format_interfacesynopsis_ooclass_classname_text',
),
),
'methodname' => array(
Expand All @@ -393,6 +399,7 @@ abstract class Package_Generic_XHTML extends Format_Abstract_XHTML {
'methodsynopsis' => array(
/* DEFAULT */ false,
'classsynopsis' => 'format_classsynopsis_methodsynopsis_methodname_text',
'interfacesynopsis' => 'format_interfacesynopsis_methodsynopsis_methodname_text',
),
'destructorsynopsis' => array(
/* DEFAULT */ false,
Expand Down Expand Up @@ -432,6 +439,14 @@ abstract class Package_Generic_XHTML extends Format_Abstract_XHTML {
"fieldsynopsis" => array(
"modifier" => "public",
),
"interfacesynopsis" => array(
"close" => false,
"classname" => false,
),
"interfacesynopsisinfo" => array(
"extends" => false,
"oointerface" => false,
),
"methodsynopsis" => array(
"returntypes" => [],
"type_separator" => null,
Expand Down Expand Up @@ -974,6 +989,94 @@ public function format_classsynopsis($open, $name, $attrs) {
return "</div>";
}

public function format_interfacesynopsisinfo_ooclass_classname($open, $name, $attrs)
{
if ($open) {
if ($this->cchunk["interfacesynopsisinfo"]["oointerface"] === false) {
$this->cchunk["interfacesynopsisinfo"]["oointerface"] = true;
return '<span class="modifier">interface</span> ';
}

return "";
}

if ($this->cchunk["interfacesynopsisinfo"]["oointerface"] === true) {
$this->cchunk["interfacesynopsisinfo"]["oointerface"] = null;
}

return "";
}

public function format_interfacesynopsisinfo_oointerface($open, $name, $attrs) {
if ($open) {
if ($this->cchunk["interfacesynopsisinfo"]["extends"] === false) {
$this->cchunk["interfacesynopsisinfo"]["extends"] = true;
return '<span class="' . $name . '">';
}

return '<span class="'.$name.'">, ';
}

return "</span>";
}

public function format_interfacesynopsisinfo($open, $name, $attrs)
{
$this->cchunk["interfacesynopsisinfo"] = $this->dchunk["interfacesynopsisinfo"];
if ($open) {
$name .= ' classsynopsisinfo';

if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"]) && $attrs[Reader::XMLNS_DOCBOOK]["role"] == "comment") {
return '<div class="'.$name.' classsynopsisinfo_comment">/* ';
}

return '<div class="'.$name.'">';
}

if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"]) && $attrs[Reader::XMLNS_DOCBOOK]["role"] == "comment") {
return ' */</div>';
}
$this->cchunk["interfacesynopsis"]["close"] = true;

return ' {</div>';
}

public function format_interfacesynopsis_methodsynopsis_methodname_text($value, $tag) {
$value = $this->TEXT($value);
if ($this->cchunk["interfacesynopsis"]["classname"] === false) {
return $value;
}
if (strpos($value, '::')) {
$explode = '::';
} elseif (strpos($value, '->')) {
$explode = '->';
} elseif (strpos($value, '-&gt;')) {
$explode = '-&gt;';
} else {
return $value;
}

list($class, $method) = explode($explode, $value);
if ($class !== $this->cchunk["interfacesynopsis"]["classname"]) {
return $value;
}
return $method;
}

public function format_interfacesynopsis($open, $name, $attrs) {
if ($open) {
$name .= ' classsynopsis';
return '<div class="'.$name.'">';
}

if ($this->cchunk["interfacesynopsis"]["close"] === true) {
$this->cchunk["interfacesynopsis"]["close"] = false;
return "}</div>";
}

return "</div>";
}

public function format_classsynopsis_methodsynopsis_methodname_text($value, $tag) {
$value = $this->TEXT($value);
if ($this->cchunk["classsynopsis"]["classname"] === false) {
Expand Down Expand Up @@ -1001,6 +1104,11 @@ public function format_classsynopsis_ooclass_classname_text($value, $tag) {
return $this->TEXT($value);
}

public function format_interfacesynopsis_ooclass_classname_text($value, $tag) {
$this->cchunk["interfacesynopsis"]["classname"] = $value;
return $this->TEXT($value);
}

public function format_fieldsynopsis($open, $name, $attrs) {
$this->cchunk["fieldsynopsis"] = $this->dchunk["fieldsynopsis"];
if ($open) {
Expand Down Expand Up @@ -1063,6 +1171,7 @@ public function format_initializer($open, $name, $attrs) {
}
return '</span>';
}

public function format_parameter($open, $name, $attrs, $props)
{
if ($props["empty"]) {
Expand Down
23 changes: 21 additions & 2 deletions phpdotnet/phd/Package/PHP/XHTML.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ abstract class Package_PHP_XHTML extends Package_Generic_XHTML {
/* DEFAULT */ 'span',
'ooclass' => array(
/* DEFAULT */ 'format_suppressed_tags',
'classsynopsisinfo' => 'format_classsynopsisinfo_ooclass_classname',
'classsynopsisinfo' => 'format_classsynopsisinfo_ooclass_classname',
'interfacesynopsisinfo' => 'format_interfacesynopsisinfo_ooclass_classname',
),
),
'chapter' => 'format_container_chunk',
Expand Down Expand Up @@ -96,7 +97,8 @@ abstract class Package_PHP_XHTML extends Package_Generic_XHTML {
/* DEFAULT */ 'format_classname_text',
'ooclass' => array(
/* DEFAULT */ 'format_classname_text',
'classsynopsis' => 'format_classsynopsis_ooclass_classname_text',
'classsynopsis' => 'format_classsynopsis_ooclass_classname_text',
'interfacesynopsis' => 'format_interfacesynopsis_ooclass_classname_text',
),
),
'methodname' => array(
Expand All @@ -106,6 +108,7 @@ abstract class Package_PHP_XHTML extends Package_Generic_XHTML {
),
'methodsynopsis' => array(
/* DEFAULT */ 'format_classsynopsis_methodsynopsis_methodname_text',
'interfacesynopsis' => 'format_interfacesynopsis_methodsynopsis_methodname_text',
),
'destructorsynopsis' => array(
/* DEFAULT */ 'format_classsynopsis_methodsynopsis_methodname_text',
Expand Down Expand Up @@ -710,6 +713,22 @@ public function format_classsynopsis_ooclass_classname_text($value, $tag) {
parent::format_classsynopsis_ooclass_classname_text($value, $tag);
}

public function format_interfacesynopsis_methodsynopsis_methodname_text($value, $tag) {
if ($this->cchunk["interfacesynopsis"]["classname"]) {
if (strpos($value, "::") === false && strpos($value, "->") === false) {
$value = $this->cchunk["interfacesynopsis"]["classname"] . "::" . $value;
}
}

$display_value = parent::format_interfacesynopsis_methodsynopsis_methodname_text($value, $tag);
return $this->format_function_text($value, $tag, $display_value);
}

public function format_interfacesynopsis_ooclass_classname_text($value, $tag) {
/* intentionally not return the value */
parent::format_interfacesynopsis_ooclass_classname_text($value, $tag);
}

public function format_classname_text($value, $tag) {
if (($filename = $this->getClassnameLink(strtolower($value))) !== null && $this->cchunk["phpdoc:classref"] !== strtolower($value)) {
$href = $this->chunked ? $filename.$this->ext : "#$filename";
Expand Down
1 change: 1 addition & 0 deletions phpdotnet/phd/Render.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ public function execute(Reader $r) { /* {{{ */

/* The following if is to skip unnecessary whitespaces in the implements list */
if (
($this->STACK[$r->depth - 1] === 'interfacesynopsisinfo' && $this->STACK[$r->depth] === 'oointerface') ||
($this->STACK[$r->depth - 1] === 'classsynopsisinfo' && $this->STACK[$r->depth] === 'oointerface') ||
($this->STACK[$r->depth - 1] === 'oointerface' && $this->STACK[$r->depth] === 'interfacename')
) {
Expand Down