diff --git a/phpdotnet/phd/Format.php b/phpdotnet/phd/Format.php index f59e6a02..e4e5c7fd 100644 --- a/phpdotnet/phd/Format.php +++ b/phpdotnet/phd/Format.php @@ -270,12 +270,15 @@ public function getExamples() { return $this->examples; } public function getRefnameLink($ref) { + $ref = trim($ref); return isset($this->refs[$ref]) ? $this->refs[$ref] : null; } public function getClassnameLink($class) { + $class = trim($class); return isset($this->classes[$class]) ? $this->classes[$class] : null; } public function getVarnameLink($var) { + $var = trim($var); return isset($this->vars[$var]) ? $this->vars[$var] : null; } public function getGeneratedExampleID($index) { diff --git a/tests/render/bug_GH-80.phpt b/tests/render/bug_GH-80.phpt new file mode 100644 index 00000000..2dcb53cb --- /dev/null +++ b/tests/render/bug_GH-80.phpt @@ -0,0 +1,104 @@ +--TEST-- +GH-80: Be more lax in function/methodnames tag in regards to whitespace +--FILE-- +setXml_file($xml_file); +$config->setForce_index(true); + +$render = new Render(); + +$indexRepository = new IndexRepository(new \SQLite3(":memory:")); +$indexRepository->init(); +$config->set_indexcache($indexRepository); + +$index = new TestIndex($indexRepository, $config); +$render->attach($index); + +$reader = new Reader; +$reader->open($config->xml_file(), null, LIBXML_PARSEHUGE | LIBXML_XINCLUDE); +$render->execute($reader); + +$render->detach($index); + +$format = new TestPHPChunkedXHTML($config); +$render = new TestRender(new Reader, $config, $format); + +$render->run(); +?> +--EXPECT-- +Filename: test-function.html +Content: +
+
+

test_function

+
+

(No version information available, might only be in Git)

test_functionFor testing

+ +
+Filename: example.test-method.html +Content: +
+
+

Example::testMethod

+

(No version information available, might only be in Git)

Example::testMethodAn example method for testing

+ +
+
+Filename: test-class.html +Content: +
+ +
+ + class Example + {
+ }
+ +

Table of Contents

+
+ +Filename: test-variable.html +Content: +
+
+

$TEST_VARIABLE

+

(No version information available, might only be in Git)

$TEST_VARIABLEA test variable

+ +
+
+Filename: test-references.html +Content: +
+
+

+ test_function() should be linked. +

+

+ Example should be linked. +

+

+ Example::testMethod() should be linked. +

+

+ $TEST_VARIABLE should be linked. +

+
+ +
+Filename: test-references.html +Content: +
+ + + + + + + +
diff --git a/tests/render/data/bug_GH-80.xml b/tests/render/data/bug_GH-80.xml new file mode 100644 index 00000000..8c4fa171 --- /dev/null +++ b/tests/render/data/bug_GH-80.xml @@ -0,0 +1,47 @@ + + + + test_function + + For testing + + + + Example + + + Example + + + + + Example::testMethod + An example method for testing + + + + + + + $TEST_VARIABLE + A test variable + + + + + + + test_function should be linked. + + + Example should be linked. + + + Example::testMethod should be linked. + + + $TEST_VARIABLE should be linked. + + + +