diff --git a/phpdotnet/phd/Package/PHP/XHTML.php b/phpdotnet/phd/Package/PHP/XHTML.php index 6d8a4bec..878afb83 100644 --- a/phpdotnet/phd/Package/PHP/XHTML.php +++ b/phpdotnet/phd/Package/PHP/XHTML.php @@ -827,12 +827,24 @@ public function format_classsynopsis_methodsynopsis_methodname_text($value, $tag public function format_function($open, $tag, $attrs, $props) { if ($open) { + if (str_contains($props["innerXml"], 'pushRole("function_replaceable"); + } return ''; } + + if ($this->getRole() === "function_replaceable") { + $this->popRole(); + } + return ""; } public function format_function_text($value, $tag, $display_value = null) { + if ($this->getRole() === "function_replaceable") { + return $this->TEXT($value); + } + static $non_functions = array( "echo" => true, "print" => true, "include" => true, "include_once" => true, diff --git a/phpdotnet/phd/Render.php b/phpdotnet/phd/Render.php index 5e4201cd..eeacc68e 100644 --- a/phpdotnet/phd/Render.php +++ b/phpdotnet/phd/Render.php @@ -77,7 +77,7 @@ public function execute(Reader $r) { /* {{{ */ $r->name === "type" || $r->name === "classsynopsis" || $r->name === "qandaset" || - in_array($r->name, ["methodsynopsis", "constructorsynopsis", "destructorsynopsis", "constant"], true) + in_array($r->name, ["methodsynopsis", "constructorsynopsis", "destructorsynopsis", "constant", "function"], true) ) ) { $innerXml = $r->readInnerXml(); diff --git a/tests/package/php/data/function_replaceable_rendering.xml b/tests/package/php/data/function_replaceable_rendering.xml new file mode 100644 index 00000000..75168e33 --- /dev/null +++ b/tests/package/php/data/function_replaceable_rendering.xml @@ -0,0 +1,18 @@ + + + + + 1. Function with replaceable + + xml_set_* + + + + + 2. Normal function (no replaceable) + + strlen + + + + diff --git a/tests/package/php/function_replaceable_rendering.phpt b/tests/package/php/function_replaceable_rendering.phpt new file mode 100644 index 00000000..bd2ae496 --- /dev/null +++ b/tests/package/php/function_replaceable_rendering.phpt @@ -0,0 +1,38 @@ +--TEST-- +Function with replaceable rendering +--FILE-- +xmlFile = $xmlFile; + +$format = new TestPHPChunkedXHTML($config, $outputHandler); + +$render = new TestRender(new Reader($outputHandler), $config, $format); + +$render->run(); +?> +--EXPECTF-- +Filename: function_replaceable_rendering.html +Content: + + + + 1. Function with replaceable + + xml_set_* + + + + + 2. Normal function (no replaceable) + + strlen() + + + +
1. Function with replaceable
+ xml_set_* +
2. Normal function (no replaceable)
+ strlen() +