Tagging methodsynopsis with role="oop" / role="proc".
| From: | Richard Quadling | Date: | Thu, 13 May 2010 13:00:16 +0000 |
| Subject: | Tagging methodsynopsis with role="oop" / role="proc". | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969381822@lists.php.net to get a copy of this message | ||
Hi.
Currently, only the first methodsynoposis for each method is
xincluded using ...
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook)
xpointer(id('class.xyz')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])"
/>
In looking at separating __construct/__destruct (constructorsynopsis /
destructorsynopsis), there are sometimes more than 1 way to construct
a class (DatePeriod is the first one I've come across - has 3 ways).
Using [1] introduces the difference between
http://docs.php.net/manual/en/class.dateperiod.php
and
http://docs.php.net/manual/en/dateperiod.construct.php.
So ...
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook)
xpointer(id('class.xyz')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])"
/>
becomes ...
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook)
xpointer(id('class.xyz')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis)"
/>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook)
xpointer(id('class.xyz')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])"
/>
Now, in the event that a method has multiple signatures (can't find
one at the moment), the [1] will only pick up the first one for the
main class description page.
So, removing [1] will include all of them.
That's fine until a class is documented to have both an OOP and a
procedural interface.
Now, removing [1] includes both the OOP and the procedural prototypes
in the class description page.
Not good.
Essentially, DocBook doesn't have a way to differentiate between an
OOP and non-OOP "method" (functionsynopsis would have been an option
but for "The content model of this element (funcsynopsis) was designed
specifically to capture the semantics of most C-language function
prototypes (for use in UNIX reference pages)." [TDG]).
But that would be a significant change.
So, I would like to use a role on the methodsynopsis to indicate OOP
or PROC use. This will allow me to include only the OOP methodsynopsis
via the xinclude in the event of method overloading.
Changing
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook)
xpointer(id('class.xyz')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])"
/>
to
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook)
xpointer(id('class.xyz')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis)"
/>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook)
xpointer(id('class.xyz')/db:refentry/db:refsect1[@role='description']/descendant::db:destructorsynopsis)"
/>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook)
xpointer(id('class.xyz')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='oop'])"
/>
Richard.
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling