-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add non-parameter attribute rendering
Enable rendering of attributes for classes, exceptions, interfaces, methods and functions.
- Loading branch information
1 parent
e18fd3e
commit 472dd3c
Showing
5 changed files
with
339 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
--TEST-- | ||
Attribute formatting 002 - Class and method attributes | ||
--FILE-- | ||
<?php | ||
namespace phpdotnet\phd; | ||
|
||
require_once __DIR__ . "/../../setup.php"; | ||
|
||
$xml_file = __DIR__ . "/data/attribute_formatting_002.xml"; | ||
|
||
Config::init(["xml_file" => $xml_file]); | ||
|
||
$format = new TestGenericChunkedXHTML; | ||
|
||
$format->SQLiteIndex( | ||
null, // $context, | ||
null, // $index, | ||
"class.knownattribute", // $id, | ||
"file.knownattribute.is.in", // $filename, | ||
"", // $parent, | ||
"", // $sdesc, | ||
"", // $ldesc, | ||
"", // $element, | ||
"", // $previous, | ||
"", // $next, | ||
0, // $chunk | ||
); | ||
$format->SQLiteIndex( | ||
null, // $context, | ||
null, // $index, | ||
"class.anotherknownattribute", // $id, | ||
"file.anotherknownattribute.is.in", // $filename, | ||
"", // $parent, | ||
"", // $sdesc, | ||
"", // $ldesc, | ||
"", // $element, | ||
"", // $previous, | ||
"", // $next, | ||
0, // $chunk | ||
); | ||
|
||
$render = new TestRender(new Reader, new Config, $format); | ||
|
||
$render->run(); | ||
?> | ||
--EXPECT-- | ||
Filename: attribute-formatting-002.html | ||
Content: | ||
<div id="attribute-formatting-002" class="chapter"> | ||
<div class="section"> | ||
<p class="para">1. Class with unknown attributes</p> | ||
<div class="classsynopsis"><div class="classsynopsisinfo"> | ||
|
||
<span class="attribute">#[\UnknownAttribute]</span><br> | ||
<span class="attribute">#[\AnotherUnknownAttribute]</span><br> | ||
<span class="modifier">class</span> <strong class="classname">DateTime</strong> | ||
{</div> | ||
}</div> | ||
</div> | ||
|
||
<div class="section"> | ||
<p class="para">2. Class with known attributes</p> | ||
<div class="classsynopsis"><div class="classsynopsisinfo"> | ||
|
||
<span class="attribute"><a href="file.knownattribute.is.in.html">#[\KnownAttribute]</a> </span><br> | ||
<span class="attribute"><a href="file.anotherknownattribute.is.in.html">#[\AnotherKnownAttribute]</a> </span><br> | ||
<span class="modifier">class</span> <strong class="classname">DateTime</strong> | ||
{</div> | ||
}</div> | ||
</div> | ||
|
||
<div class="section"> | ||
<p class="para">3. Method with unknown attributes</p> | ||
<div class="methodsynopsis dc-description"> | ||
<span class="attribute">#[\UnknownAttribute]</span><br> | ||
<span class="attribute">#[\AnotherUnknownAttribute]</span><br> | ||
<span class="modifier">public</span> <span class="methodname">ClassName::methodName</span>()</div> | ||
|
||
</div> | ||
|
||
<div class="section"> | ||
<p class="para">4. Method with known attributes</p> | ||
<div class="methodsynopsis dc-description"><span class="attribute"><a href="file.knownattribute.is.in.html">#[\KnownAttribute]</a> </span><br> | ||
<span class="attribute"><a href="file.anotherknownattribute.is.in.html">#[\AnotherKnownAttribute]</a> </span><br> | ||
<span class="modifier">public</span> <span class="methodname">ClassName::methodName</span>()</div> | ||
|
||
</div> | ||
|
||
<div class="section"> | ||
<p class="para">5. Constructor with unknown attributes</p> | ||
<div class="constructorsynopsis dc-description"><span class="attribute">#[\UnknownAttribute]</span><br> | ||
<span class="attribute">#[\AnotherUnknownAttribute]</span><br> | ||
<span class="modifier">public</span> <span class="methodname">ClassName::__construct</span>()</div> | ||
|
||
</div> | ||
|
||
<div class="section"> | ||
<p class="para">6. Constructor with known attributes</p> | ||
<div class="constructorsynopsis dc-description"><span class="attribute"><a href="file.knownattribute.is.in.html">#[\KnownAttribute]</a> </span><br> | ||
<span class="attribute"><a href="file.anotherknownattribute.is.in.html">#[\AnotherKnownAttribute]</a> </span><br> | ||
<span class="modifier">public</span> <span class="methodname">ClassName::__construct</span>()</div> | ||
|
||
</div> | ||
|
||
<div class="section"> | ||
<p class="para">7. Class, constructor and methods with unknown attributes</p> | ||
<div class="classsynopsis"><div class="classsynopsisinfo"> | ||
|
||
<span class="attribute">#[\UnknownAttribute]</span><br> | ||
<span class="attribute">#[\AnotherUnknownAttribute]</span><br> | ||
<span class="modifier">class</span> <strong class="classname">DateTime</strong> | ||
{</div> | ||
<div class="constructorsynopsis dc-description"> | ||
<span class="attribute">#[\UnknownAttribute]</span><br> | ||
<span class="attribute">#[\AnotherUnknownAttribute]</span><br> | ||
<span class="modifier">public</span> <span class="methodname">ClassName::__construct</span>()</div> | ||
|
||
<div class="methodsynopsis dc-description"><span class="attribute">#[\UnknownAttribute]</span><br> | ||
<span class="attribute">#[\AnotherUnknownAttribute]</span><br> | ||
<span class="modifier">public</span> <span class="methodname">ClassName::methodName1</span>()</div> | ||
|
||
<div class="methodsynopsis dc-description"><span class="attribute">#[\UnknownAttribute]</span><br> | ||
<span class="attribute">#[\AnotherUnknownAttribute]</span><br> | ||
<span class="modifier">public</span> <span class="methodname">ClassName::methodName2</span>()</div> | ||
|
||
}</div> | ||
</div> | ||
|
||
<div class="section"> | ||
<p class="para">8. Class, constructor and methods with known attributes</p> | ||
<div class="classsynopsis"><div class="classsynopsisinfo"> | ||
|
||
<span class="attribute"><a href="file.knownattribute.is.in.html">#[\KnownAttribute]</a> </span><br> | ||
<span class="attribute"><a href="file.anotherknownattribute.is.in.html">#[\AnotherKnownAttribute]</a> </span><br> | ||
<span class="modifier">class</span> <strong class="classname">DateTime</strong> | ||
{</div> | ||
<div class="constructorsynopsis dc-description"> | ||
<span class="attribute"><a href="file.knownattribute.is.in.html">#[\KnownAttribute]</a> </span><br> | ||
<span class="attribute"><a href="file.anotherknownattribute.is.in.html">#[\AnotherKnownAttribute]</a> </span><br> | ||
<span class="modifier">public</span> <span class="methodname">ClassName::__construct</span>()</div> | ||
|
||
<div class="methodsynopsis dc-description"><span class="attribute"><a href="file.knownattribute.is.in.html">#[\KnownAttribute]</a> </span><br> | ||
<span class="attribute"><a href="file.anotherknownattribute.is.in.html">#[\AnotherKnownAttribute]</a> </span><br> | ||
<span class="modifier">public</span> <span class="methodname">ClassName::methodName1</span>()</div> | ||
|
||
<div class="methodsynopsis dc-description"><span class="attribute"><a href="file.knownattribute.is.in.html">#[\KnownAttribute]</a> </span><br> | ||
<span class="attribute"><a href="file.anotherknownattribute.is.in.html">#[\AnotherKnownAttribute]</a> </span><br> | ||
<span class="modifier">public</span> <span class="methodname">ClassName::methodName2</span>()</div> | ||
|
||
}</div> | ||
</div> | ||
|
||
<div class="section"> | ||
<p class="para">9. Function with unknown attributes</p> | ||
<div class="methodsynopsis dc-description"> | ||
<span class="attribute">#[\UnknownAttribute]</span><br> | ||
<span class="attribute">#[\AnotherUnknownAttribute]</span><br> | ||
<span class="type">void</span> <span class="methodname">function_name</span>)</div> | ||
|
||
</div> | ||
|
||
<div class="section"> | ||
<p class="para">10. Function with known attributes</p> | ||
<div class="methodsynopsis dc-description"><span class="attribute"><a href="file.knownattribute.is.in.html">#[\KnownAttribute]</a> </span><br> | ||
<span class="attribute"><a href="file.anotherknownattribute.is.in.html">#[\AnotherKnownAttribute]</a> </span><br> | ||
<span class="type">void</span> <span class="methodname">function_name</span>)</div> | ||
|
||
</div> | ||
|
||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
140 changes: 140 additions & 0 deletions
140
tests/package/generic/data/attribute_formatting_002.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
<chapter xml:id="attribute-formatting-002"> | ||
<section> | ||
<para>1. Class with unknown attributes</para> | ||
<classsynopsis class="class"> | ||
<ooclass> | ||
<modifier role="attribute">#[\UnknownAttribute]</modifier> | ||
<modifier role="attribute">#[\AnotherUnknownAttribute]</modifier> | ||
<classname>DateTime</classname> | ||
</ooclass> | ||
</classsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>2. Class with known attributes</para> | ||
<classsynopsis class="class"> | ||
<ooclass> | ||
<modifier role="attribute">#[\KnownAttribute]</modifier> | ||
<modifier role="attribute">#[\AnotherKnownAttribute]</modifier> | ||
<classname>DateTime</classname> | ||
</ooclass> | ||
</classsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>3. Method with unknown attributes</para> | ||
<methodsynopsis> | ||
<modifier role="attribute">#[\UnknownAttribute]</modifier> | ||
<modifier role="attribute">#[\AnotherUnknownAttribute]</modifier> | ||
<modifier>public</modifier> <methodname>ClassName::methodName</methodname> | ||
<void/> | ||
</methodsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>4. Method with known attributes</para> | ||
<methodsynopsis> | ||
<modifier role="attribute">#[\KnownAttribute]</modifier> | ||
<modifier role="attribute">#[\AnotherKnownAttribute]</modifier> | ||
<modifier>public</modifier> <methodname>ClassName::methodName</methodname> | ||
<void/> | ||
</methodsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>5. Constructor with unknown attributes</para> | ||
<constructorsynopsis> | ||
<modifier role="attribute">#[\UnknownAttribute]</modifier> | ||
<modifier role="attribute">#[\AnotherUnknownAttribute]</modifier> | ||
<modifier>public</modifier> <methodname>ClassName::__construct</methodname> | ||
<void/> | ||
</constructorsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>6. Constructor with known attributes</para> | ||
<constructorsynopsis> | ||
<modifier role="attribute">#[\KnownAttribute]</modifier> | ||
<modifier role="attribute">#[\AnotherKnownAttribute]</modifier> | ||
<modifier>public</modifier> <methodname>ClassName::__construct</methodname> | ||
<void/> | ||
</constructorsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>7. Class, constructor and methods with unknown attributes</para> | ||
<classsynopsis class="class"> | ||
<ooclass> | ||
<modifier role="attribute">#[\UnknownAttribute]</modifier> | ||
<modifier role="attribute">#[\AnotherUnknownAttribute]</modifier> | ||
<classname>DateTime</classname> | ||
</ooclass> | ||
<constructorsynopsis> | ||
<modifier role="attribute">#[\UnknownAttribute]</modifier> | ||
<modifier role="attribute">#[\AnotherUnknownAttribute]</modifier> | ||
<modifier>public</modifier> <methodname>ClassName::__construct</methodname> | ||
<void/> | ||
</constructorsynopsis> | ||
<methodsynopsis> | ||
<modifier role="attribute">#[\UnknownAttribute]</modifier> | ||
<modifier role="attribute">#[\AnotherUnknownAttribute]</modifier> | ||
<modifier>public</modifier> <methodname>ClassName::methodName1</methodname> | ||
<void/> | ||
</methodsynopsis> | ||
<methodsynopsis> | ||
<modifier role="attribute">#[\UnknownAttribute]</modifier> | ||
<modifier role="attribute">#[\AnotherUnknownAttribute]</modifier> | ||
<modifier>public</modifier> <methodname>ClassName::methodName2</methodname> | ||
<void/> | ||
</methodsynopsis> | ||
</classsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>8. Class, constructor and methods with known attributes</para> | ||
<classsynopsis class="class"> | ||
<ooclass> | ||
<modifier role="attribute">#[\KnownAttribute]</modifier> | ||
<modifier role="attribute">#[\AnotherKnownAttribute]</modifier> | ||
<classname>DateTime</classname> | ||
</ooclass> | ||
<constructorsynopsis> | ||
<modifier role="attribute">#[\KnownAttribute]</modifier> | ||
<modifier role="attribute">#[\AnotherKnownAttribute]</modifier> | ||
<modifier>public</modifier> <methodname>ClassName::__construct</methodname> | ||
<void/> | ||
</constructorsynopsis> | ||
<methodsynopsis> | ||
<modifier role="attribute">#[\KnownAttribute]</modifier> | ||
<modifier role="attribute">#[\AnotherKnownAttribute]</modifier> | ||
<modifier>public</modifier> <methodname>ClassName::methodName1</methodname> | ||
<void/> | ||
</methodsynopsis> | ||
<methodsynopsis> | ||
<modifier role="attribute">#[\KnownAttribute]</modifier> | ||
<modifier role="attribute">#[\AnotherKnownAttribute]</modifier> | ||
<modifier>public</modifier> <methodname>ClassName::methodName2</methodname> | ||
<void/> | ||
</methodsynopsis> | ||
</classsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>9. Function with unknown attributes</para> | ||
<methodsynopsis> | ||
<modifier role="attribute">#[\UnknownAttribute]</modifier> | ||
<modifier role="attribute">#[\AnotherUnknownAttribute]</modifier> | ||
<type>void</type><methodname>function_name</methodname> | ||
</methodsynopsis> | ||
</section> | ||
|
||
<section> | ||
<para>10. Function with known attributes</para> | ||
<methodsynopsis> | ||
<modifier role="attribute">#[\KnownAttribute]</modifier> | ||
<modifier role="attribute">#[\AnotherKnownAttribute]</modifier> | ||
<type>void</type><methodname>function_name</methodname> | ||
</methodsynopsis> | ||
</section> | ||
|
||
</chapter> |