Re: [PHP-DOC] Fixing manual pt-BR( Portuguese Brazilian )

2013-08-06 Thread Moacir de Oliveira
Hi Felipe,

2013/8/6 Felipe Barth 

> Patch attached to fix the manual pt-BR (Brazilian Portuguese), I ask that
> the commit be performed, because as I do not have a SVN account I can not
> do myself.
>
>
I have just committed your patch.


-- 
Moacir de Oliveira


Re: [PHP-DOC] Getting back into the docs.

2013-01-14 Thread Moacir de Oliveira
Hello Richard,


2013/1/14 Richard Quadling 

> Hello all.
>
> Just getting back into the docs and I'm coming up against the changes made
> in
> http://git.php.net/?p=phd.git;a=commitdiff;h=dc61fff7daab9c3498f5c4bd8ddee9fbea139989;hp=e65c062692173f921c16a1bc81f2d70e60a253a4
>
> From what I am seeing, to use optional values (lang::), I need to use the
> = separator (this may be windows only and a bug - I'm not sure).
>
> So, --lang=en rather than --lang en
>
> But the patch gives an error ...
>
> [02:28:41 - E_USER_ERROR  ]
> D:\PHP\Manual\PHD\phpdotnet\phd\Options\Parser.php:84
> Invalid long option --lang=en
>


Yes, that's a bug, and not windows only.
For the patch, would be easier to explode in '=' and then check if the
option is valid.


-- 
Moacir de Oliveira


Re: [PHP-DOC] ext/mysql updates (~deprecated)

2012-06-05 Thread Moacir de Oliveira
Hi,

2012/6/5 Hannes Magnusson 
>
>
> Attached is a patch that introduces phd:argN attribute to
>  and will cause  phd:arg2="PDO::baz>PDOStatement::foo to be rendered as:
> PDOStatement::foo(PDO::bar, PDO::baz)
> That is, it will make the phd:argN look like proper arguments to the
> function.
>
> Should we include include this in the coming PhD release before Friday?
>
> -Hannes
>

Oops... now the correct thread with the correct patch :D.

So my suggestion is to use phd:args="arg1, arg2, arg3...", so we will not
have a limited number of arguments in the dtd specification.


-- 
Moacir de Oliveira


Re: [PHP-DOC] Extension changelogs

2012-06-05 Thread Moacir de Oliveira
Hi,

2012/6/5 Christopher Jones 

>
> On 06/05/2012 10:31 AM, Hannes Magnusson wrote:
>
>>
>> Soo... to start the process I patched PhD to aggregate all the exiting
>> changelog entries and spit them out in a new document.
>>
>> It should be fairly easy to actually even spit out a complete
>> changelog page for every version of PHP automatically on
>> php.net/manual/changelog.php for example.
>>
>> Attached is the PhD patch and trivial phpdoc patch.
>>
>>
>> Screenshots:
>> - http://prntscr.com/a5yml ("ext/strings")
>> - http://prntscr.com/a5yq2 (ext/mysql)
>> - http://prntscr.com/a5yrv ("ext/misc")
>>
>> -Hannes
>>
>
> Hi Hannes,
>
> Looks fine.  Perhaps the repeating version numbers are a little
> tedious and the sentence "Here is a list..." isn't needed, but neither
> is a huge issue.
>
>

Why not just phd:args="arg1, arg2, arg3...", so we will not have a limited
number of arguments in the dtd specification.


-- 
Moacir de Oliveira


[PHP-DOC] Fwd: [Announce] Google Summer of Code 2012

2012-02-05 Thread Moacir de Oliveira
Hi all,


GSoC 2012 was just announced, if we want to participate this year as
organization, the application period is between Feb 27 and Mar 9.


-- Forwarded message --
From: Carol Smith 
Date: 2012/2/4
Subject: [Announce] Google Summer of Code 2012
To: Google Summer of Code Mentors List <
google-summer-of-code-mentors-l...@googlegroups.com>


Hi GSoC mentors and org admins,

We've announced that we're doing Google Summer of Code 2012 [1]. Yay!

If you would like to help spread the word about GSoC, we have presentations
[2], logos [3], and flyers [4] for you all to use this year. Please host
meetups, tell your friends and colleagues about the program, go to
conferences, talk to people about the program, and just generally do all
the awesome word-of-mouth stuff you do every year to promote the program.
We rely on you for your help, so thank you in advance for all the work you
do!

Please consider translating the presentations and/or flyers into your
native language and submitting them directly to me to post on the wiki.
Localization for our material is integral to reaching the widest possible
audience around the world.

Please remember to take pictures at your meetup and write up a blog post
for our blog [4]. We love highlighting the GSoC community on our blog!
Please also considering translating the flyer or the presentation (or both)
into your native language and submitting it to me. The more languages our
resources are in, the better.

If you need goodies for a meetup you're holding in your area, please
contact me directly and let me know. I'd be happy to send along some
promotional items. Please let me know when you decide on a date, time, and
location for a meetup so I can put it on the calendar.

The GSoC calendar has been updated with this year's dates, so please refer
to that as well for important dates and deadlines. Please consider applying
to participate as an organization again this year or maybe joining as a
mentor for your favorite organization if they are selected this year.

[1] -
http://google-opensource.blogspot.com/2012/02/google-summer-of-code-2012-is-on.html
[2] -
http://code.google.com/p/google-summer-of-code/wiki/ProgramPresentations
[3] - http://code.google.com/p/google-summer-of-code/wiki/GsocLogos
[4] - http://code.google.com/p/google-summer-of-code/wiki/GsocFlyers

Cheers,
Carol

-- 
You received this message because you are subscribed to the Google Groups
"Google Summer of Code Mentors List" group.
To post to this group, send email to
google-summer-of-code-mentors-l...@googlegroups.com.
To unsubscribe from this group, send email to
google-summer-of-code-mentors-list+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/google-summer-of-code-mentors-list?hl=en.



-- 
Moacir de Oliveira


Re: [PHP-DOC] Re: PhD generated Indexes

2011-07-06 Thread Moacir de Oliveira
hi all,

PhD_IDE only renders refentries within the funcref set, there is no support
for vars and exceptions yet.

--Moacir de Oliveira

Em 06/07/2011 11:55, "Hannes Magnusson" escreveu:

On Wed, Jul 6, 2011 at 17:15, Philip Olson  wrote:
>
> On Jul 6, 2011, at 4:20 ...
How would that work exactly?
First run PhD_IDE to generate doc-base/funcindex.xml manually every
week and then run PhD_PHP like normal?

And how does PhD_IDE know what is what without scanning the ID and
blindly guessing?

-Hannes


Re: [PHP-DOC] Weird PhD optimizations (10% !)

2011-05-25 Thread Moacir de Oliveira
hey,

Em 25 de maio de 2011 07:48, Hannes Magnusson
escreveu:

>
> The biggest gain with replace it with literals is the lowercasing of
> the classname, class lookup, and the hash lookup.
> Unsure how much we would gain with defines.. a blindfaith guess would
> be 2-3% less.
>


I think we should try the defines, using that literals everywhere would be
really annoying :).


--Moacir de Oliveira


[PHP-DOC] Re: [DOC-CVS] svn: /phd/trunk/phpdotnet/phd/Package/ Generic/Manpage.php PHP/Manpage.php

2011-04-06 Thread Moacir de Oliveira
hi,

Em 6 de abril de 2011 03:00, Hannes Magnusson
escreveu:

>
> The manpage stuff uses the refname, rather then the ID, because thats
> how man searches for items.
> However, removing all the extra stuff, like the core exceptions,
> context and variables, like you did now doesn't seem to be the best
> fix..
>
>
hmm, I thought the manpage format was only for PHP functions, as the old
name was phpfunctions...


--Moacir de Oliveira


[PHP-DOC] PhD Release 1.1.0

2011-03-08 Thread Moacir de Oliveira
Hi all,

We would like to announce that PhD 1.1.0 is now available \o/.

New output formats:
- EnhancedCHM: The same as CHM but with the User Notes (Requires
ext/bz2) (Richard Quadling)
- Epub format for the PHP Package (Moacir)

New features:
- Added support for CLI options per package (Moacir)

Improvements:
- Allow xml:id on  (Richard Quadling)
- Generate an ID for  (Hannes)
- Generate IDS for all s (Hannes)


The complete list of release notes:
http://doc.php.net/phd/

Installation:

To install PhD run:
$ pear install doc.php.net/phd

To see all available packages run:
$ pear remote-list -c doc.php.net

and then install all packages you want:
$ pear install doc.php.net/

To install everything:
$ pear install --alldeps doc.php.net/phd


For PhD Documentation take a look at:
http://doc.php.net/phd/docs


--Moacir de Oliveira


Re: [PHP-DOC] class.classId.html files aren't rendered

2011-02-24 Thread Moacir de Oliveira
hi,

2011/2/24 Miroslav Kubelík 

> On Wed, 23 Feb 2011 19:09:24 +0100, Hannes Magnusson <
> hannes.magnus...@gmail.com> wrote:
>
>  Actually.. No, its probably not a bug. Our class definitions use a
>> custom phpdoc namespace, which the vanilla standard packages do not
>> support.
>> You have to use the PHP package ("-P PHP").
>>
>
> OK, with -P PHP works good. I think it's bug (but I don't know where, I
> don't know
> about phd internals nothing), good behavior with vannila standard package
> is either  render no separate class manuals with no links anywhere or work
> as in PHP package.
>



 $phd -d ~/phpdocs/doc-base/.manual.xml -p book.rrd -o /var/www/phprrd/ -f
xhtml -t chunkedhtml

-t chunkedhtml is a deprecated option that is not used by PhD anymore.

When you don't pass the -P (--package) option PhD will use the Generic
Package which doesn't support 'phpdoc:classref', so the class references
will not be created.

If you are rendering the PHP Manual you must use the -P PHP

regards,

--Moacir de Oliveira


Re: [PHP-DOC] Re: Extended CHM redux?

2011-02-23 Thread Moacir de Oliveira
hi all,

2011/2/23 Richard Quadling 

>
> With regard to PhD, creating both formats is easily achieved by ...
>
> phd/render -P PHP -f chm -f enhancedchm
>
>
Why not just '-f echm' ? :)



>
> I'm about to commit the amendments to the enhanced chm format to NOT
> use the output directory for the usernotes (as this is wiped for each
> language currently).
>
>
I can do the release as soon as the echm format is ready. The next version
will be 1.0.2 or 1.1.0?



--Moacir de Oliveira


Re: Re: [PHP-DOC] Fwd: Farewell CHM, hello EPUB!

2010-09-07 Thread Moacir de Oliveira
hey guys,


I just commited the patch to support epub in PhD. Its not perfect and
epubcheck is returning a lot of xhtml errors. I used the most basic
structure of the .opf and .ncx files and a build.sh file is  been
created to build the .epub

I tried with the firefox plugin, it takes ages to render in my
machine, but its working.

$ phd -d .manual.xml -f epub -P PHP

or you can use the partial rendering

$ phd -d .manual.xml -f epub -P PHP -p 


There are a lot of things to fix, but I'm sure we can add this in the
next release of PhD


--Moacir de Oliveira

2010/9/7, honestqiao :
> Adobe Digital Editions and epubreader for firefox haven't problems for
> chinese.
>
> But epub hasn't build in search index.
> ADE use grep file for search.
> epubreader for firefox hasn't search function.
>
>
>
>
>
>
>
>
> 2010-09-07
>
>
>
> honestqiao
>
>
>
> 发件人: pedram salehpoor
> 发送时间: 2010-09-07  02:25:11
> 收件人: Philip Olson
> 抄送: PHP Documentation ML
> 主题: Re: [PHP-DOC] Fwd: Farewell CHM, hello EPUB!
>
> I hope it will not have problems about right to left languages.
> Regards,
> Pedram
>>
>> We may as well do this too.
>>
>> I immediately downloaded the EPUB version from mysql.com and spent 5
>> minutes
>> trying to open it on my Mac, and failed. Sure this can be overcome with
>> education but it's worth noting that it's not easy, yet, and feels geared
>> towards mobile devices so far. I didn't try the Firefox plugin. Although,
>> the MySQL epub download appears to be missing an .epub file but I don't
>> know
>> the topic.
>>
>> Regardless of my epub ignorance, I think it's a good idea to offer this
>> alternative via PhD. I vaguely remember it coming up before, but now
>> forget.
>>
>> Regards,
>> Philip
>>
>> Begin forwarded message:
>>
>>> From: Brett Bieber 
>>> Date: September 6, 2010 6:10:38 AM PDT
>>> To: PEAR Doc List 
>>> Subject: [PEAR-DOC] Fwd: Farewell CHM, hello EPUB!
>>>
>>> An interesting announcement here ― I know we've had plenty of issues
>>> with our CHM manuals, and maybe this is something we should consider.
>>> I would be in favor of an epub format for our manual.
>>>
>>>
>>> -- Forwarded message --
>>> From: Stefan Hinz 
>>> Date: Mon, Sep 6, 2010 at 4:31 AM
>>> Subject: Farewell CHM, hello EPUB!
>>> To: annou...@lists.mysql.com
>>>
>>>
>>> For a long time, the MySQL Documentation Team has been providing CHM
>>> files for most MySQL documentation we publish. Like many other formats,
>>> CHM-format docs can be downloaded from http://dev.mysql.com/doc. CHM
>>> (Compiled HTML Help) has been the de facto standard help file format on
>>> Windows since 1997, but the technology behind it is outdated and has all
>>> kinds of quirks. The successor format introduced with Windows Vista is
>>> AP Help, but it hasn't taken off in practice so far. So, with CHM being
>>> outdated and AP Help spread anything but widely, lots of vendors have
>>> started providing documentation on Windows in PDF or HTML format.
>>>
>>> Building CHM-format documentation is a challenge of its own. I'll not go
>>> into details here, so let me just state that it requires a dedicated
>>> Windows box (or VM), and while it can be automated using Power Shell
>>> commands, there's no way to find out whether or not a CHM file was built
>>> correctly, except by manual inspection. This makes it different from all
>>> other documentation formats where technical QA is done (successfully) in
>>> an automated fashion.
>>>
>>> With the increasing complexity and size of our documentation (the MySQL
>>> 5.1 Manual contains more than 1.6 million words now!), providing CHM has
>>> become more and more of a pain, because builds tend to break more often.
>>> We've stopped shipping CHM with the MySQL Server on Windows months ago
>>> because we simply couldn't guarantee that the help file shipped with the
>>> software would work. Also, we're running short on hardware resources, so
>>> we'd rather stop wasting the resources we have on building a format
>>> that's of limited use, anyway.
>>>
>>> This is why we'll stop providing CHM for any of the documentation we
>>> publish.
>>>
>>> To alleviate potential pains anyone might have with this decision, let
>>> me tell you that we've started provi

Re: [PHP-DOC] [Patch] - Per Package CLI Options in PhD

2010-08-24 Thread Moacir de Oliveira
Hi Daniel,

2010/8/24 Daniel Convissor 

> Hi Moacir:
>
> On Sat, Aug 21, 2010 at 02:24:40AM -0400, Moacir de Oliveira wrote:
>
> > Some options in PhD are specific for rendering the PHP Manual (--notoc,
> > --lang). These options make no effect if used with the other packages, so
> > would be interesting extract them from the core of PhD and implement
> these
> > options within the PHP package.
> >
> > Syntax:
> > $ phd --- 
>
> Having generic options and package options is cool.  Naming the options
> for the package feels a bit clunky.  Some options may not be used in
> another package now, but could in the future, so it will lead to lots of
> duplication (--php-foo --pear-foo --etc-foo) and extra typing.
>

The idea is to use the package options just for really specific options. I
think that options that could be used for more than one package should be
written as a core option.
I agree that typing --php-foo --pear-foo --etc-foo... is painful but I'm not
sure if is already possible to render more than one package at once, I think
it only works for formats that exist in all packages passed.

The old options were not changed (so $ phd -d .manual.xml -f xhtml -P PHP
stills working fine)


>
> Perhaps leave the option named --foo, but have it only available inside
> the packages that use it?  When used for a package that doesn't utilize
> that option, a warning could be issued.
>
>
The syntax --- is to prevent duplication, it makes all
options unique for PhD. Using just --foo is also a possibility, but I think
it's not so clear for the user to know which package will handle it.

let's discuss it


--Moacir de Oliveira


[PHP-DOC] [Patch] - Per Package CLI Options in PhD

2010-08-20 Thread Moacir de Oliveira
hey guys,


I just wrote a patch that allows the separation of package specific cli
options from the core of PhD. It's just a first idea so let me know what you
think.

Motivation:
Some options in PhD are specific for rendering the PHP Manual (--notoc,
--lang). These options make no effect if used with the other packages, so
would be interesting extract them from the core of PhD and implement these
options within the PHP package.

Syntax:
$ phd --- 

Examples:
$ phd -d path/to/.manual.xml -P PHP -f php --php-toc=true
$ phd --generic-version
$ phd --ide-help

Limitations:
  - Only long options available
  - getopt() based: so you have to use "--" before the options


Implementation Details:

I divided the BuildOptionsParser class in two other classes OptionsParser
and OptionsHandler. The OptionsHandler class will list the options and the
functions to handle those options. The OptionsParser loads all options (core
and per package) and parse them with getopt().

To add options in a package you have to implement a class (that implements
IOptionsHandler) and register in the factory

class Package_Generic_OptionsHandler implements IOptionsHandler {

public function optionList() {
return array(
'foo:',
'bar::',
);
}

public function option_foo($k, $v) {
//do something
}
...

And then use: phd --generic-foo value --generic-bar=false



--Moacir de Oliveira
Index: render.php
===
--- render.php  (revisão 301979)
+++ render.php  (cópia de trabalho)
@@ -23,7 +23,7 @@
 Config::init(array());
 }
 
-BuildOptionsParser::getopt();
+OptionsParser::getopt();
 
 /* If no docbook file was passed, die */
 if (!is_dir(Config::xml_root()) || !is_file(Config::xml_file())) {
Index: phpdotnet/phd/OptionsHandler.php
===
--- phpdotnet/phd/OptionsHandler.php(revisão 301979)
+++ phpdotnet/phd/OptionsHandler.php(cópia de trabalho)
@@ -2,7 +2,7 @@
 namespace phpdotnet\phd;
 /* $Id$ */
 
-class BuildOptionsParser
+class OptionsHandler implements IOptionsHandler
 {
 public function __construct()
 {
@@ -14,7 +14,7 @@
 }
 }
 
-public function getOptionList()
+public function optionList()
 {
 return array(
 'format:'  => 'f:',// The format to render (xhtml, 
pdf...)
@@ -393,35 +393,6 @@
 exit(0);
 }
 
-public function handlerForOption($opt)
-{
-if (method_exists($this, "option_{$opt}")) {
-return array($this, "option_{$opt}");
-} else {
-return NULL;
-}
-}
-
-public static function getopt()
-{
-$bop = new self;
-$opts = $bop->getOptionList();
-$args = getopt(implode('', array_values($opts)), array_keys($opts));
-if ($args === false) {
-trigger_error("Something happend with getopt(), please report a 
bug", E_USER_ERROR);
-}
-
-foreach ($args as $k => $v) {
-$handler = $bop->handlerForOption($k);
-if (is_callable($handler)) {
-call_user_func($handler, $k, $v);
-} else {
-var_dump($k, $v);
-trigger_error("Hmh, something weird has happend, I don't know 
this option", E_USER_ERROR);
-}
-}
-}
-
 /**
  * Makes a string into a boolean (i.e. on/off, yes/no, ..)
  *
Index: phpdotnet/phd/Format/Factory.php
===
--- phpdotnet/phd/Format/Factory.php(revisão 301979)
+++ phpdotnet/phd/Format/Factory.php(cópia de trabalho)
@@ -5,6 +5,7 @@
 abstract class Format_Factory {
 private $formats = array();
 private $packageName = "";
+private $optionsHandler = null;
 
 public final function getOutputFormats() {
 return array_keys($this->formats);
@@ -14,6 +15,14 @@
 $this->formats = $formats;
 }
 
+public final function getOptionsHandler() {
+return $this->optionsHandler;
+}
+
+public final function registerOptionsHandler(IOptionsHandler 
$optionsHandler) {
+$this->optionsHandler = $optionsHandler;
+}
+
 protected final function setPackageName($name) {
 if (!is_string($name)) {
 throw new \Exception("Package names must be strings..");
Index: phpdotnet/phd/IOptionsHandler.php
===
--- phpdotnet/phd/IOptionsHandler.php   (revisão 0)
+++ phpdotnet/phd/IOptionsHandler.php   (revisão 0)
@@ -0,0 +1,14 @@
+formats);
+parent::registerOptionsHandler(new Package_Generic_OptionsHandler());
 }
 }
 
Index: phpdotnet/phd/OptionsParser.php
===

[PHP-DOC] PhD Release 1.0.1

2010-08-10 Thread Moacir de Oliveira
Hi all,

We would like to announce that PhD 1.0.1 is available.

Improvements:
- PhD now searches the include-path for custom package classes (Paul M.
Jones)
- Unix Manual Pages for PHP Predefined Variables (Hannes)
- Added Generic Unix Manual pages output format (Hannes)
- Added support for  (Richard Quadling)
- Added the Persian language for CHM builds (Philip)

New Options:
-S, --saveconfig: Option to generate a config file to load (Hannes)
-e, --ext: Option to specify filename extension (Paul M. Jones)
-t, --notoc: Option to not re-create the cached table of contents of PHP
Package (Phillip)

Bug Fixes:
- Fixed bug #50666 - Missing entries in table (man pages) (Hannes)
- Fixed bug #51301 - Wrong escape sequence (man pages) (Hannes)
- Fixed bug #51346 - Extra whitespace when using <type> and plural
(Daniel Egeberg)
- Fixed bug #51514 - Added tr, th and td mappings (Patch provided by
Paul M Jones) (Richard Quadling)
- Fixed bug #51750 - Add ()'s when rendering methodname elements
(Hannes)
- Fixed bug #51833 - Multiple paragraphs in notes render incorrectly
(Daniel Egeberg)
- Fixed encoding problems with the function iconv() in the CHM format
(Moacir)
- Fixed the --lang option that was creating an infinite recursion
(Moacir)

The complete list of release notes:
http://doc.php.net/phd/


Installation:

To install PhD run:
$ pear install doc.php.net/phd <http://doc.php.net/phd-beta>

To see all available packages run:
$ pear remote-list -c doc.php.net

and then install all packages you want:
$ pear install doc.php.net/

To install everything:
$ pear install --alldeps doc.php.net/phd <http://doc.php.net/phd-beta>


For PhD Documentation take a look at:
http://doc.php.net/phd/docs


--Moacir de Oliveira


Re: [PHP-DOC] CHM builds need help

2010-06-02 Thread Moacir de Oliveira
hey,

2010/6/2 Philip Olson 

>
> Last time I tried (a month or two ago), I ran into memory exhaustion errors
> which iirc lived around the iconv() call, but that can easily be a bogus
> reason. However, the problem is real so please have a look, and discuss.
>
>
I have commited the patches for both iconv and memory problems:
http://svn.php.net/viewvc?view=revision&revision=300138
http://svn.php.net/viewvc?view=revision&revision=300137

The memory problem was a bug with the --lang option, that was entering in an
infinity recursion. A problem with the html_entity_decode encoding was
creating problems with the iconv() function.

I hope it could get the CHMs building again


regards,

--Moacir de Oliveira


Re: [PHP-DOC] PHPDevBar + PHD

2010-05-20 Thread Moacir de Oliveira
hey,

2010/5/18 Felipe Nascimento de Moura 

> Hello.
>
> I've used the PHPDoc to have an up to date list of official functions of
> PHP (and also its details), to build an add-on for firefox, due to help PHP
> Developers.
>
> It'd be great  if you could provide ideas, criticisms, suggestions or
> report any  bug about it.
>
> The url to see  some details more about this addon and to download it, is:
> https://addons.mozilla.org/pt-BR/firefox/addon/12686/
>


The first user of PhD IDE \o/, you also can provide some ideas, criticisms
or suggestions to us :)

--Moacir de Oliveira


[PHP-DOC] PhD Release 1.0.0

2010-03-13 Thread Moacir de Oliveira
Hi all,

We would like to announce that PhD 1.0.0-stable is finally available
\o/\o/\o/.

Improvements:
- Added support to XInclude. (Shahar Evron)
- Added support for edition, inlinemediaobject, exceptionname,
firstterm, trademark and edition Docbook5 elements. (Hannes)
- Added support for DBTimestamp Processing Instruction. (Moacir)
- Stopped double encoding of entities in CHM TOC, Index and keyword
lists (Richard Quadling)
- Textual descriptions for VERBOSE_xxx messages (Richard Quadling)
- Disabled colored output on Windows. (Kalle)
- Updated translations: (Kalle)
- Danish
- Swedish

New Option:
-x, --xinclude: Process XML Inclusions (Shahar Evron)

New Package:
- PhD_IDE (alpha): Package to generate easy-to-parse files with info
about the PHP functions and classes. The goal of this package is to help the
IDEs to stay up to date with the documentation and don't have to use
hardcoded scripts to extract information from the docs.

Bug Fixes:
- Fixed bug #45098 <http://bugs.php.net/45098> - Named constants require
long opt. (Hannes)
- Fixed bug #50668 <http://bugs.php.net/50668> - Add xinclude processing
in PhD. (Shahar Evron)
- Fixed bug #50799 <http://bugs.php.net/50799> - No text mapping for
screen. (Paul Jones)
- Fixed bug #51070 <http://bugs.php.net/51070> - Double acronym tags in
HTML output. (Moacir)

Installation:

To install PhD run:
$ pear install doc.php.net/phd <http://doc.php.net/phd-beta>

To see all available packages run:
$ pear remote-list -c doc.php.net

and then install all packages you want:
$ pear install doc.php.net/

To install everything:
$ pear install --alldeps doc.php.net/phd <http://doc.php.net/phd-beta>


For PhD Documentation take a look at:
    http://doc.php.net/phd/docs


--Moacir de Oliveira


Re: [PHP-DOC] Re: [PHP-WEBMASTER] want a file, to help the comunity

2010-03-11 Thread Moacir de Oliveira
hi Felipe,

2010/3/11 Hannes Magnusson 

> On Thu, Mar 11, 2010 at 05:42, Felipe Nascimento de Moura
>  wrote:
> > Hi there, I'm Felipe, from Brazil.
> > I've built the PHPDevBar, an addon for Firefox (
> > https://addons.mozilla.org/en-US/firefox/addon/12686) which helps a lot,
> PHP
> > programmers.
> > I've used an XML with the most of PHP functions, in my server, to be used
> by
> > this addon when using the quick search. This xml has the name of each
> > function, its return type and its parameters.
> > But this XML is not complete, and I will not be able to keep it
> completely
> > up to date. I wonder if there is a XML file, or something like that, I
> could
> > use to make it work, streight from the PHP official source.
> >
> > There is a video, of how this addon works at http://screenr.com/jpx
>
>
Thats definitely something PhD IDE can do, or in portuguese "Seus problemas
acabaram!" :D

Currently the PhD IDE package generates two output formats:
- funclist - A txt file with all function/method names
- functions - Stand alone xml files, one file per function/method

I'm also thinking in add a JSON format.
The xml used is here: http://wiki.php.net/doc/skeletons/ide-function

I wrote something about PhD in portuguese here:
http://www.phpam.com/blog/2009/10/19/renderizando-o-manual-do-php-com-o-phd/


--Moacir de Oliveira


Re: [PHP-DOC] PhD - Patch to add support to DBTimestamp processing instructions

2010-01-06 Thread Moacir de Oliveira
2010/1/6 Hannes Magnusson 

>
> Out of curiosity, why does the ::PI section in Render.php not do the
> same as all the others?
> All other handlers do similar to:
> foreach($this as $format) {
>$parsed_value = $format->doStuff($with, $value);
>if ($parsed_value === false) {
>  $format->appendData($orginal_value);
>} else {
>   $format->appendData($parsed_value);
>}
> }
> But with PI, you have to manually call $this->format->appendData()
> from the PI handler.. it seems wrong.
>
>
The PI section is different because is not possible to know what the PI will
do. In case of dbhtml you can modify the file name for chunks, set the
directory to write files etc. so it's not just to append data. But is
possible to use the structure of the other handlers and just return false
when there is no data to append.

--Moacir de Oliveira


[PHP-DOC] PhD - Patch to add support to DBTimestamp processing instructions

2010-01-05 Thread Moacir de Oliveira
hi all,

Here a patch to add support to DBTimestamp processing instructions to PhD

Patch:
http://pastie.org/768355

Reference
http://www.sagehill.net/docbookxsl/Datetime.html


--Moacir de Oliveira


[PHP-DOC] PhD 0.9.1 Released!

2009-12-22 Thread Moacir de Oliveira
Hi all,

We would like to announce that PhD 0.9.1 is now available. This release has
some bug fixes, improvements, new options and new cool packages.

New Options:
--css: With this options is possible to add a css file in the xhtml
based formats. (Moacir)
--forceindex:  Option to force PhD to use the indexer. (Christian)

New Packages:
 There are 2 new packages available: GeSHi and GeSHi11x, both code
highlighters. (Christian)
 Ex: phd -g 'phpdotnet\phd\Highlighter_GeSHi11x' -L en -P PEAR -f xhtml
-o build/en -d .manual.xml

Bug Fixes:
Fixed bug #45071 - Links to require/include(_once) not rendered (Moacir)
Fixed bug #47406 - Add support for external css (Moacir)
Fixed bug #48264 - No style for HTML version of php docs (Moacir)
Fixed bug #49547 - default of --color is true, not false (Richard
Quadling)
Fixed bug #49675 - Missing links in SeeAlso (Moacir)
Fixed bug #49743 - Problem with functions both procedural and oo
(Moacir)
Fixed bug #49839 - Patch to clean up peardoc output (Michael Gauthier)
Fixed bug #49925 - imagedata now supports width and/or depth (becomes
width and/or height) (Richard Quadling)
Fixed --noindex option which did not wophd -g
'phpdotnet\phd\Highlighter_GeSHi11x' -L en -P PEAR -f xhtml -o build/en -d
.manual.xmlrk properly (Christian)
Fixed --verbose option which did not work properly (Moacir)

Other Improvements:
Added support for  (Hannes)
Now the verbose levels are grouped in VERBOSE_ERRORS, VERBOSE_INFO and
VERBOSE_WARNINGS (Richard Quadling)
Implemented PEAR request #2390: RSS feeds for PEAR/PHP Documentation
Index (Christian/Moacir)


Installation:

To install PhD run:
$ pear install doc.php.net/phd-beta

To see all available packages run:
$ pear remote-list -c doc.php.net

and then install all packages you want:
$ pear install doc.php.net/-beta

To install everything:
$ pear install --alldeps doc.php.net/phd-beta


For PhD Documentation take a look at:
http://doc.php.net/phd/docs


Re: [PHP-DOC] Patch PhD - Add links to atom feeds in the PHP format.

2009-12-16 Thread Moacir de Oliveira
2009/12/15 Hannes Magnusson 

> On Tue, Dec 15, 2009 at 12:04, Moacir de Oliveira
>  wrote:
>
> > Patch for PhD:
> > http://pastie.org/743735
>
> Remove the count(), if getChildren() will return "true" if there are
> children, no need to count them.
>
> Also, I don't actually know if  applies to  href=""> values, so you may need to specify
> /full/path/to/lang/feed/id.atom, especially since we define the 
> long after we print out the s.
> Otherwise the feed link from http://php.net/strpos for example wont be
> correct.
>
>
Patch fixed:
http://pastie.org/745439

PHPWeb:
http://pastie.org/743733


--Moacir de Oliveira


[PHP-DOC] Patch PhD - Add links to atom feeds in the PHP format.

2009-12-15 Thread Moacir de Oliveira
Hey guys,

Some patches to add links to feeds in the PHP format of the PHP Package.

Patch for PhD:
http://pastie.org/743735

Patch for PHPWeb (Thanks Hannes):
http://pastie.org/743733


--Moacir de Oliveira


Re: [PHP-DOC] Building docs w/ PhD

2009-10-27 Thread Moacir de Oliveira
Fala Thiago,

2009/10/27 Thiago H. Pojda 

> $ phd -d doc-base/.manual.xml --package PHP
> [03:30:13 - VERBOSE_INDEXING] Indexing...
> [03:32:52 - VERBOSE_INDEXING] Indexing done
> [03:32:52 - VERBOSE_RENDER_STYLE] Running full build
> [03:32:57 - E_WARNING] /usr/local/bin/phd:13
> fopen(/usr/local/lib/php//HaruDoc.php): failed to open stream: No such
> file or directory
> PHP Fatal error:  Uncaught exception 'Exception' with message 'Cannot find
> file for HaruDoc: /usr/local/lib/php//HaruDoc.php' in /usr/local/bin/phd:14
>
>


The problem is because you don't have the Haru PDF extension installed. Haru
is used in the pdf based formats and you must install it if you want render
in pdf. If you don't wanna use the pdf formats you can pass the --format
option to only render the formats you want.

Example:

$ phd -d .manual.xml --format xhtml --format bigxhtml --format chm --package
PHP

If you don't pass the --format opt, PhD will try to render all formats of
the package.

To see the packages/formats you have installed you can type:

$ phd --list


--Moacir de Oliveira


[PHP-DOC] PhD Release - Milestones

2009-10-27 Thread Moacir de Oliveira
Hey guys,

Here are the milestones for the next release of PhD (1.0.0).

- tocfeed for php
- Geshi renders (Already Implemented)
- Fix the HowTo format (only some tags missing now)
- Implement the TODO in the IDE Package

more features or bug fixes?


--Moacir de Oliveira


Re: [PHP-DOC] Building docs w/ PhD

2009-10-26 Thread Moacir de Oliveira
Hi Tiago,

:~/PHP/pt_BR/trunk$ phd -d preface.xml
> [01:43:04 - VERBOSE_INDEXING] Indexing...
> [01:43:04 - E_WARNING] /usr/local/bin/phd:13
> fopen(/usr/local/lib/php//
> phpdotnet/phd/ReaderKeeper.php): failed to open stream: No such file or
> directory
> PHP Fatal error:  Class 'phpdotnet\phd\ReaderKeeper' not found in
> /usr/local/lib/php/phpdotnet/phd/Render.php on line 0
>
> Fatal error: Class 'phpdotnet\phd\ReaderKeeper' not found in
> /usr/local/lib/php/phpdotnet/phd/Render.php on line 0
>
>
This problem is already fixed in svn. And how phd from trunk has a lot of
fixes and new features, you have to add the following line:

$ pear install -f package_generic.xml

and remember to always add --package PHP when rendering the PHP Manual with
PhD.

argh I'm not contributing with the pt_BR translations yet (shame), I hope to
join the team soon :)



--Moacir de Oliveira


Re: [PHP-DOC] How to Enable Links for Classes in generated documentation

2009-10-04 Thread Moacir de Oliveira
Hi,

2009/10/4 Israel Ekpo 

>
>
>> > phd -d .manual.xml -o php_israel -f php
>>
>>
Israel you forgot to pass the --package option. You have to look if you
already installed the PHP Package. To see the packages and formats try:

$ phd --list

if the PHP Package isn't installed you have to install:

$ pear install doc.php.net/PhD_PHP-beta

and then

$ phd -d .manual.xml -o php_israel -f php --package PHP


--Moacir


[PHP-DOC] Patch for the Bug 49743

2009-10-02 Thread Moacir de Oliveira
Patch for the Bug #49743 http://bugs.php.net/bug.php?id=49743

http://pastie.org/639588

This patch modify the structure of the table ids of the Indexer, a new auto
increment primary key is used instead of the docbook_id, and now the xml:ids
with multiple sdesc will be stored in the database.


--Moacir


[PHP-DOC] Patch for the bugs #47406 and #48264

2009-09-15 Thread Moacir de Oliveira
Hey guys,

Here a patch for the bugs #47406 and #48264.
Both bugs are about using an external CSS in the xhtml based formats in PhD,
so the patch implements the --css option.

comments?

--Moacir
Index: phpdotnet/phd/Package/Generic/XHTML.php
===
--- phpdotnet/phd/Package/Generic/XHTML.php (revision 288345)
+++ phpdotnet/phd/Package/Generic/XHTML.php (working copy)
@@ -432,6 +432,8 @@
 'dbhtml'=> 'PI_DBHTMLHandler',
 );
 
+protected $stylesheets = array();
+
 public function __construct() {
 parent::__construct();
 $this->registerPIHandlers($this->pihandlers);
@@ -514,6 +516,30 @@
 return $retval;
 }
 
+protected function fetchStylesheet() {
+$stylesDir = $this->getOutputDir();
+if (!$stylesDir) {
+$stylesDir = Config::output_dir();
+}
+$stylesDir .= 'styles/';
+if (file_exists($stylesDir)) {
+if (!is_dir($stylesDir)) {
+v("The styles/ directory is a file?", E_USER_ERROR);
+}
+} else {
+if (!mkdir($stylesDir)) {
+v("Can't create the styles/ directory", E_USER_ERROR);
+}
+}
+foreach ((array)Config::css() as $css) {
+$dest = $stylesDir . basename($css);
+if (@copy($css, $dest)) {
+$this->stylesheets[] = basename($css);
+} else {
+v(sprintf('Impossible to copy the %s file.', $css), 
E_USER_WARNING);
+}
+}
+}
  
 /* Functions format_* */ 
 public function format_suppressed_tags($open, $name, $attrs, $props) {
Index: phpdotnet/phd/Package/Generic/BigXHTML.php
===
--- phpdotnet/phd/Package/Generic/BigXHTML.php  (revision 288345)
+++ phpdotnet/phd/Package/Generic/BigXHTML.php  (working copy)
@@ -36,6 +36,10 @@
 
 public function header() {
 $root = Format::getRootIndex();
+$cssLinks = '';
+foreach ((array)$this->stylesheets as $css) {
+$cssLinks .= "\n";
+}
 return <
@@ -43,6 +47,7 @@
 
 
 {$root["ldesc"]}
+{$cssLinks}
 
 
 HEADER;
@@ -74,9 +79,12 @@
 if ($val) {
 if (!is_resource($this->getFileStream())) {
 $filename = Config::output_dir() . 
strtolower($this->getFormatName()) . '.' . $this->getExt();
+$this->postConstruct();
+if (Config::css()) {
+$this->fetchStylesheet();
+}
 $this->setFileStream(fopen($filename, "w+"));
 fwrite($this->getFileStream(), $this->header());
-$this->postConstruct();
 }
 } 
 break;
Index: phpdotnet/phd/Package/Generic/ChunkedXHTML.php
===
--- phpdotnet/phd/Package/Generic/ChunkedXHTML.php  (revision 288345)
+++ phpdotnet/phd/Package/Generic/ChunkedXHTML.php  (working copy)
@@ -78,6 +78,9 @@
 v("Can't create output directory", E_USER_ERROR);
 }
 }
+if (Config::css()) {
+$this->fetchStylesheet();
+}
 break;
 case Render::VERBOSE:
v("Starting %s rendering", $this->getFormatName(), 
VERBOSE_FORMAT_RENDERING);
@@ -90,6 +93,11 @@
 $lang = Config::language();
 $root = Format::getRootIndex();
 
+$cssLinks = '';
+foreach ((array)$this->stylesheets as $css) {
+$cssLinks .= "\n";
+}
+
 $prev = $next = $parent = array("href" => null, "desc" => null);
 
 if ($parentId = $this->getParent($id)) {
@@ -112,6 +120,7 @@
 
 
 '.(($title != $root["ldesc"]) ? $root["ldesc"].': ' : 
"").$title.'
+'.$cssLinks.'
 
 
 
Index: phpdotnet/phd/Config.php
===
--- phpdotnet/phd/Config.php(revision 288345)
+++ phpdotnet/phd/Config.php(working copy)
@@ -36,6 +36,7 @@
 "package"   => array(
 "Generic",
 ),
+'css'   => array(),
 );
 
 public static function init(array $a) {
Index: phpdotnet/phd/BuildOptionsParser.php
===
--- phpdotnet/phd/BuildOptionsParser.php(revision 288345)
+++ phpdotnet/phd/BuildOptionsParser.php(working copy)
@@ -24,6 +24,7 @@
 "version"  => "V", // Print out version information
 "help" => "h", // Print out help
 "package:" => "P:",// The package of formats   
 
+"css:" => "C:",// External CSS 
 );
 }

[PHP-DOC] PhD 0.9 Released

2009-09-11 Thread Moacir de Oliveira
Hi,

PhD 0.9.0 has been released! This version has the improvements of my GSoC
Project, and a lot of changes.
Now you can install the core of PhD and only install the packages you want,
you can use PhD to render your docbook files using the PhD_Generic package,
and write your own PhD Package.

Now, to run PhD you have to use the --package option, the -t (theme) option
was killed.
$ phd --docbook path/to/docs/.manual.xml --format xhtml --package PHP

To run your own docbook files you can skip the --package (so the Generic
package will be used):
$ phd --docbook path/to/my/doc/.docbook.xml --format bigxhtml

To see which packages and formats you have installed:
$ phd --list

Notes:
- Use namespaces (Moacir)
- Use PEAR classname conventions (Christian)
- Add support for dbhtml Process Instructions (PI) (Moacir)
- Add the --package option (Moacir)
- Add the Generic Package (Moacir)
- Add the phpdotnet/phd namespace (Christian)
- Kill themes and add a concept of "packages" (Moacir)
- Rewrite indexer (Hannes, Rudy, Moacir)
- Rewrite program flow (Hannes)

To upgrade from previous releases:
pear upgrade doc.php.net/phd-beta

To install for the first time:
If you are still using an old PEAR version you have to discover the channel
first by running:
pear channel-discover doc.php.net

If you have a recent PEAR version (1.7.0 or higher) you can skip the
discover step.
To install:
pear install doc.php.net/phd-beta

And you can install packages:
pear install doc.php.net/PhD_PHP-beta
pear install doc.php.net/PhD_PEAR-beta

To install everything:
pear install --alldeps doc.php.net/phd-beta


For PhD Documentation take a look at:
http://doc.php.net/phd/docs/


--Moacir


[PHP-DOC] Release PhD 0.4.8

2009-08-28 Thread Moacir de Oliveira
Hey guys,

PhD 0.4.8 has been released! This version will probably be the last 0.4.*.
The 1.0.0, that will have the improvements of my gsoc project (
http://wiki.php.net/gsoc/2009/phdplugins) is comming soon.

Notes:
- Added support for external troff highlighter in man pages (Christian).
- Added title attribute to anchor tags so address can be seen in CHM
files for external links (Richard Q.).
- Migrated the translations from CVS to SVN  (Philip).
- Fixed bug#49006 (The manpage format groups function arguments
incorrectly). (Moacir)
- Fixed bug#49005 (Reference sign in function prototypes in the manpage
rendering). (Moacir)

To upgrade from previous releases:
pear upgrade doc.php.net/phd-beta

To install for the first time:
If you are still using an old PEAR version you have to discover the channel
first by running:
pear channel-discover doc.php.net

If you have a recent PEAR version (1.7.0 or higher) you can skip the
discover step.
To install:
pear install doc.php.net/phd-beta

For PhD Documentation take a look at:
http://doc.php.net/phd/docs/


--Moacir


[PHP-DOC] PhD Improvements (Plugin System) - Status Report 8

2009-08-03 Thread Moacir de Oliveira
hi all,

This is my 8th status report (20 July to 1 August).

HIGHLIGHTS
-
In the last two weeks I wrote the support to XML Processing Instructions,
did some fixes in trunk and wrote some proof-of-concepts about how to test
PhD. Now is time to write tests. We're also planning to implement a new
feature to allow the use of customized indexers.

Now the IDE-Package(package to create output formats to help the PHP IDEs,
and create funclist.txt and friends) is in trunk, in the Package dir. For
while the IDE-Package is an extra work, I'll pay more attention to it after
GSoC.

We decided to focus in fix the bugs in trunk, write tests and implement
support to multiple indexers, so the packages to render the books Docbook:
The Definitive Guide and Producing Open Source Software will be written when
the priority tasks are done.

KEY ACCOMPLISHMENTS
-
New classes:
PIHandler: Abstract class for the Processing Instructions Handlers
PI_DBHTMLHandler: Class to parse the DBHTML Processing Instructions

Closed Bugs:
#49005: http://bugs.php.net/bug.php?id=49005
#49006: http://bugs.php.net/bug.php?id=49006
#49101: http://bugs.php.net/bug.php?id=49101
#49102: http://bugs.php.net/bug.php?id=49102

IDE-Package:
   funclist.txt output format

Proof of Concepts for testing PhD

MY TODO
-
Write more tests
Implement suport to multiple indexers
Fix bugs in trunk/

---

You can find my schedule here:
http://wiki.php.net/gsoc/2009/phdplugins

Blog:
http://moacirdeoliveira.blogspot.com

Regards,

Moacir de Oliveira


Re: [PHP-DOC] PhD Processing Instructions Design

2009-07-28 Thread Moacir de Oliveira
2009/7/28 Hannes Magnusson 

>
> Do you have any plans of supporting dbhtml filename directly in the
> indexer itself?
>
>
I didn't understand your question, the indexer already supports the dbhtml
filename.


[PHP-DOC] Patch bugs #49005 and #49006

2009-07-23 Thread Moacir de Oliveira
Patch for the bugs:

http://bugs.php.net/bug.php?id=49006
http://bugs.php.net/bug.php?id=49005
Index: phpdotnet/phd/Package/Default/Manpage.php
===
--- phpdotnet/phd/Package/Default/Manpage.php   (revision 284228)
+++ phpdotnet/phd/Package/Default/Manpage.php   (working copy)
@@ -100,7 +100,7 @@
 'paramdef'  => 'format_suppressed_tags',
 'parameter' => array(
 /* DEFAULT */  'format_suppressed_tags',
-'methodparam'   => 'format_suppressed_tags',
+'methodparam'   => 'format_parameter_method',
 'code'  => '\\fI',
 ),
 'productname'   => 'format_suppressed_tags',
@@ -303,7 +303,7 @@
 }
 
 public function format_parameter_text($value, $tag) {
-return "\n\\fI$" . $value . "\\fP";
+return "\n\\fI" . ((isset($value[0]) && $value[0] == "$") ? "" : "$") 
. $value . "\\fP";
 }
 
 public function format_parameter_term_text($value, $tag) {
@@ -379,7 +379,8 @@
 "optional" => $opt,
 "type" => "",
 "name" => "",
-"initializer" => "");
+"initializer" => "",
+"reference" => false);
 }
 return "";
 }
@@ -390,7 +391,8 @@
 "optional" => false,
 "type" => "void",
 "name" => "",
-"initializer" => "");
+"initializer" => "",
+"reference" => false);
 }
 return "";
 }
@@ -400,6 +402,13 @@
 return "";
 }
 
+public function format_parameter_method($open, $name, $attrs, $props) {
+if ($open && isset($attrs[Reader::XMLNS_DOCBOOK]["role"]) && 
$attrs[Reader::XMLNS_DOCBOOK]["role"] == "reference") {
+
$this->cchunk['methodsynopsis']['params'][count($this->cchunk['methodsynopsis']['params'])-1]['reference']
 = true;
+}
+return "";
+}
+
 public function format_parameter_method_text($value, $tag) {
 
$this->cchunk['methodsynopsis']['params'][count($this->cchunk['methodsynopsis']['params'])-1]['name']
 = $value;
 return "";
@@ -430,9 +439,14 @@
 return "\n.br";
 $params = array();
 // write the formatted synopsis
-foreach ($this->cchunk['methodsynopsis']['params'] as $parameter)
-array_push( $params, ($parameter['optional'] ? "[" : "") . 
$parameter['type'] .
-($parameter['name'] ? " \\fI$" . $parameter['name'] . "\\fP" : 
"") . ($parameter['initializer'] ? " = " . $parameter['initializer'] : "") . 
($parameter['optional'] ? "]" : "") );
+foreach ($this->cchunk['methodsynopsis']['params'] as $parameter) {
+array_push($params, ($parameter['optional'] ? "[" : "") 
+. $parameter['type'] 
+. ($parameter['reference'] ? " \\fI&\\fP" : " ") 
+. ($parameter['name'] ? "\\fI$" . $parameter['name'] . 
"\\fP" : "") 
+. ($parameter['initializer'] ? " = " . 
$parameter['initializer'] : "") 
+. ($parameter['optional'] ? "]" : "") );
+}
 $ret = "\n(" . join($params, ", ") . ")";
 $this->cchunk['methodsynopsis']['params'] = array();
 


[PHP-DOC] PhD Processing Instructions Design

2009-07-22 Thread Moacir de Oliveira
Hey guys,

The first design of the PhD Processing Instructions Handler.
The idea is choose the correct PIHandler class for each target you want.

ex:
In the Package_Default_XHTML class we have:
$pihandlers = array(
"dbhtml"=> "PI_DBHTMLHandler",
);

In your own package:
$pihandlers = array(
"dbhtml"=> "MyOwnDBHTMLHandler",
);

Also we can write a class to handler all targets:
$pihandlers = array(
"dbhtml"=> "PIHandler",
"dbman" => "PIHandler",
"tdg-purp"  => "PIHandler",
);


The Render class will only know the parsePI method:
case \XMLReader::PI:
$target = $r->name;
$data = $r->value;
foreach ($this as $format) {
$format->parsePI($target, $data);
}
break;

The parsePI method will act like a factory to instanciate the PIHandler
class:
public final function parsePI($target, $data) {
if (isset($this->pihandlers[$target])) {
//I'm thinking in a way to not have to create a new instance
here
//every time. Maybe a singleton?
$classname = __NAMESPACE__ . "\\" . $this->pihandlers[$target];
$pihandler = new $classname($this);
return $pihandler->parse($data);
}
}

The PIHandler classes will have to parse and process the data in the PI.


Sugestions?

--Moacir
 "format_background_color",
"bgcolor"   => "format_bgcolor",
"cellpadding"   => "format_cellpadding",
"cellspacing"   => "format_cellspacing",
"class" => "format_class",
"dir"   => "format_dir",
"filename"  => "format_filename",
"funcsynopsis-style"=> "format_funcsynopsis_style",
"img.src.path"  => "format_img_src_path",
"label-width"   => "format_label_width",
"linenumbering.everyNth"=> "format_linenumbering_everyNth",
"linenumbering.separator"   => "format_linenumbering_separator",
"linenumbering.width"   => "format_linenumbering_width",
"list-presentation" => "format_list_presentation",
"list-width"=> "format_list_width",
"row-height"=> "format_row_height",
"start" => "format_start", //obsolete
"stop-chunking" => "format_stop_chunking",
"table-summary" => "format_table_summary",
"table-width"   => "format_table_width",
"term-presentation" => "format_term_presentation",
"term-separator"=> "format_term_separator",
"term-width"=> "format_term_width",
"toc"   => "format_toc",
);

public function __construct($format) {
parent::__construct($format);
}

/**
 * Function to parse the data and redirect it to the 
 * correct format_ function.
 */
public function parse($data) {}

public function format_background_color($data) {}
public function format_bgcolor($data) {}
public function format_cellpadding($data) {}
public function format_cellspacing($data) {}
public function format_class($data) {}
public function format_dir($data) {}
public function format_filename($data) {}
public function format_funcsynopsis_style($data) {}
public function format_img_src_path($data) {}
public function format_label_width($data) {}
public function format_linenumbering_everyNth($data) {}
public function format_linenumbering_separator($data) {}
public function format_linenumbering_width($data) {}
public function format_list_presentation($data) {}
public function format_list_width($data) {}
public function format_row_height($data) {}
public function format_start($data) {}
public function format_stop_chunking($data) {}
public function format_table_summary($data) {}
public function format_table_width($data) {}
public function format_term_presentation($data) {}
public function format_term_separator($data) {}
public function format_term_width($data) {}
public function format_toc($data) {}

}

?>
Index: phpdotnet/phd/Package/Default/XHTML.php
===
--- phpdotnet/phd/Package/Default/XHTML.php (revision 284295)
+++ phpdotnet/phd/Package/Default/XHTML.php (working copy)
@@ -413,6 +413,10 @@
 ),
 );
 
+protected $pihandlers = array(
+"dbhtml"=> "PI_DBHTMLHandler",
+);
+
 public function __construct() {
 parent::__construct();
 $this->setExt("html");
Index: phpdotnet/phd/Format.php
===
--- phpdotnet/p

[PHP-DOC] PhD Improvements (Plugin System) - Status Report 7

2009-07-20 Thread Moacir de Oliveira
hi all,

This is my 7th status report (05 July to 19 July).

HIGHLIGHTS
-
This week I fixed some bugs, made some improvements in the factory system
(now the formats are dynamically loaded, no more predefined formats), some
refactorings in the Format classes and started reading about XML Processing
Instructions and dbhtml.

This weekend I started writing an example Package
http://gitorious.org/phd-ide-package (to render the Philip Olson's alpha
especification of an IDE function
http://wiki.php.net/doc/skeletons/ide-function), in the next days I'll write
a brief documentation about how to write and run your own PhD Package.

KEY ACCOMPLISHMENTS
-
New classes:
Package_PHP_PDF: Class to render of the xhtml formats
Package_PHP_BigPDF: Base class of the xhtml formats
Package_PHP_KDevelop: Base class of the xhtml formats

Format_Abstract_PDF: Abstract base to the PDF format and the PDF Wrapper
Pakage_Default_PDF: Class with the (element|text)maps and format_
functions

Improvements in the Factory system.
Some refactorings in the Format classes.

MY TODO
-
Design the XML Processing Instructions support (dbhtml).
Start coding the dbhtml support.

---

You can find my schedule here:
http://wiki.php.net/gsoc/2009/phdplugins

Blog:
http://moacirdeoliveira.blogspot.com

Regards,

Moacir de Oliveira


[PHP-DOC] Patch Bug 48953

2009-07-17 Thread Moacir de Oliveira
Patch for the bug: http://bugs.php.net/bug.php?id=48953

The method getDescription should return false or ""?

--Moacir
Index: include/PhDHelper.class.php
===
--- include/PhDHelper.class.php (revision 284228)
+++ include/PhDHelper.class.php (working copy)
@@ -73,6 +73,9 @@
 }
 
 final public function getDescription($id, $long = false) {
+if (!isset($this->IDs[$id])) {
+return "";
+}
 return $long ?
 ($this->IDs[$id]["ldesc"] ? $this->IDs[$id]["ldesc"] : 
$this->IDs[$id]["sdesc"]) :
 ($this->IDs[$id]["sdesc"] ? $this->IDs[$id]["sdesc"] : 
$this->IDs[$id]["ldesc"]);
@@ -89,7 +92,7 @@
 */
 final public function getChildren($id)
 {
-return $this->IDs[$id]["children"];
+return isset($this->IDs[$id]) ? $this->IDs[$id]["children"] : array();
 }
 
 /**
@@ -117,7 +120,7 @@
 */
 final public function getParent($id)
 {
-return $this->IDs[$id]["parent"];
+return isset($this->IDs[$id]) ? $this->IDs[$id]["parent"] : false;
 }
 
 /**


Re: [PHP-DOC] Patches

2009-07-16 Thread Moacir de Oliveira
Patch Explanation

Factory:

The last implementation of the class Format_Factory had a lot of creational
methods, one for each output format.

ex:

public function createXhtmlFormat() {
trigger_error("This format is not supported by this package",
E_USER_ERROR);
}
public function createBigXhtmlFormat() {
trigger_error("This format is not supported by this package",
E_USER_ERROR);
}
public function createPHPFormat() {
trigger_error("This format is not supported by this package",
E_USER_ERROR);
}
...


Problem:

What if a package had a really new output format? Will be necessary modify
the abstract factory to add the new output format


Solution:

Now the abstract factory has only one creational method:
createFormat($format), and the concrete factories have an array with the
output formats and classes to return

class Package_PHP_Factory extends Format_Factory {
private $formats = array(
'xhtml' => 'Package_PHP_ChunkedXHTML',
'bigxhtml' => 'Package_PHP_BigXHTML',
'php'=> 'Package_PHP_Web',
'howto' => 'Package_PHP_HowTo',
'manpage'=> 'Package_PHP_Functions',
'pdf' => 'Package_PHP_PDF',
'bigpdf' => 'Package_PHP_BigPDF',
'kdevelop' => 'Package_PHP_KDevelop',
);

public function __construct() {
parent::registerOutputFormats($this->formats);
}
}


But we still have the new format problem, because the classes Config and
BuildOptionsParser have predefined output formats:

class Config
{
private static $optionArray = array(
'output_format' => array(
'xhtml',
'php',
'bigxhtml',
'howto',
'manpage',
'kdevelop',
'pdf',
'bigpdf',
),

The solution is load the output formats dynamically, and now we can do this
using the factory:

Config::set_output_format($factory->getOutputFormats());


examples:

php render.php -d phpdoc/.manual.xml --format xhtml --package PHP

If the package PHP have the xhtml format everything is ok.


php render.php -d phpdoc/.manual.xml --package PHP

If we don't pass the --format arg, all the formats in the PHP factory will
be loaded.


php render.php -d phpdoc/.manual.xml --package Pear

only the pear output formats will be loaded


php render.php -d phpdoc/.manual.xml --format newformat --package NewPackage

now we can run new formats \o/




--Moacir


[PHP-DOC] Patches

2009-07-15 Thread Moacir de Oliveira
Hey guys,

Some patches to improve the factory system and load the formats dynamically.

what do you  think?

--Moacir
Index: phpdotnet/phd/BuildOptionsParser.php
===
--- phpdotnet/phd/BuildOptionsParser.php(revision 284053)
+++ phpdotnet/phd/BuildOptionsParser.php(working copy)
@@ -36,21 +36,8 @@
 {
 $formats = array();
 foreach((array)$v as $i => $val) {
-switch($val) {
-case "xhtml":
-case "bigxhtml":
-case "howto":
-case "php":
-case "manpage":
-case "kdevelop":
-case "pdf":
-case "bigpdf":
-if (!in_array($val, $formats)) {
-$formats[] = $val;
-}
-break;
-default:
-trigger_error("Format not supported at this time", 
E_USER_ERROR);
+if (!in_array($val, $formats)) {
+$formats[] = $val;
 }
 }
 Config::set_output_format($formats);
@@ -139,7 +126,7 @@
 if (is_null($packageList)) {
 $packageList = array();
 foreach (glob($GLOBALS['ROOT'] . "/phpdotnet/phd/Package/*", 
GLOB_ONLYDIR) as $item) {
-if (!in_array(basename($item), array('CVS', '.', '..'))) {
+if (!in_array(basename($item), array('.svn', '.', '..'))) {
 $packageList[] = basename($item);
 }
 }
@@ -223,21 +210,16 @@
 if (is_null($packageList)) {
 $packageList = array();
 foreach (glob($GLOBALS['ROOT'] . "/phpdotnet/phd/Package/*", 
GLOB_ONLYDIR) as $item) {
-if (!in_array(basename($item), array('CVS', '.', '..'))) {
-$formats = array();
-foreach (glob($item . "/*.php") as $subitem) {
-if (strcmp(basename($subitem), "Factory.php") != 0) {
-$formats[] = substr(basename($subitem), 0, -4);
   
-}
-}
-$packageList[basename($item)] = $formats;
+if (!in_array(basename($item), array('.svn', '.', '..'))) {
+   $packageList[] = basename($item);
 }
 }
 }
 
 echo "Supported packages:\n";
-foreach ($packageList as $package => $formats) {
-echo "\t" . $package . "\n\t\t" . implode("\n\t\t", $formats) . 
"\n";
+foreach ($packageList as $package) {
+$factory = Format_Factory::createFactory($package);
+echo "\t" . $package . "\n\t\t" . implode("\n\t\t", 
$factory->getOutputFormats()) . "\n";
 }
   
 exit(0);
Index: phpdotnet/phd/Config.php
===
--- phpdotnet/phd/Config.php(revision 284053)
+++ phpdotnet/phd/Config.php(working copy)
@@ -7,16 +7,7 @@
 class Config
 {
 private static $optionArray = array(
-'output_format' => array(
-'xhtml',
-'php',
-'bigxhtml',
-'howto',
-'manpage',
-'kdevelop',
-'pdf',
-'bigpdf',
-),
+'output_format' => array(),
 'chunk_extra' => array(
 "legalnotice" => true,
 "phpdoc:exception" => true,
Index: ../phpdotnet/phd/Package/Default/Factory.php
===
--- ../phpdotnet/phd/Package/Default/Factory.php(revision 283894)
+++ ../phpdotnet/phd/Package/Default/Factory.php(working copy)
@@ -2,18 +2,15 @@
 namespace phpdotnet\phd;
 
 class Package_Default_Factory extends Format_Factory {
-public function createXhtmlFormat() {
-return new Package_Default_ChunkedXHTML();
-}
-
-public function createBigXhtmlFormat() {
-return new Package_Default_BigXHTML();
-}
-   
-public function createPHPFormat() {
-return new Package_Default_PHP();
-}
+private $formats = array(
+'xhtml' => 'Package_Default_ChunkedXHTML',
+'bigxhtml'  => 'Package_Default_BigXHTML',
+'php'   => 'Package_Default_PHP',
+);
 
+public function __construct() {
+parent::registerOutputFormats($this->formats);
+}
 }
 
 ?>
Index: phpdotnet/phd/Format/Factory.php
===
--- phpdotnet/phd/Format/Factory.php(revision 284054)
+++ phpdotnet/phd/Format/Factory.php(working copy)
@@ -1,36 +1,34 @@
 formats);
 }
-public function createBigXhtmlFormat() {
-trigger_error("This format is not supported by this package", 
E_USER_ERROR);
+
+public final function registerOutputFormats($formats) {
+$this->formats = $

[PHP-DOC] PhD Improvements (Plugin System) - Status Report 6

2009-07-06 Thread Moacir de Oliveira
hi all,

This is my 6th status report (28 June to 04 July).

HIGHLIGHTS
-
This week was very productive, I wrote all the xhtml formats from the PHP
Package (chunked, big, web, howto) and the manpage output format (functions)
\o/. Now I have to port the PDF and CHM formats. After that, tests and
remove the old code from HEAD (maybe a new release? :) ).

Now is time to make the midterms evaluations.

KEY ACCOMPLISHMENTS
-
New classes:
Package_PHP_XHTML: Base class of the xhtml formats
Package_PHP_BigXHTML: Big html format
Package_PHP_ChunkedXHTML: Chunked html format
Package_PHP_Web: The .php chunked format
Package_PHP_HowTo: Other .php format
Package_PHP_Functions: The Manpage output format \o/

Format_Abstract_Manpage: Abstract base to the manpage format
Pakage_Default_Manpage: Class with the (element|text)maps and format_
functions

Implemented the functionality(refs, classes, vars) of the mktoc.php file
using the SQLite Indexer. Now we don't need the mktoc file.
Bug fixes in the Default Package.

MY TODO
-
Fix bugs in the PHP Formats
Begin porting the PHP themes:
Package_PHP_PDF
Package_PHP_BigPDF
Package_PHP_CHM
Package_PHP_KDevelop

Write the Abstract Formats:
Format_Abstract_PDF

---

You can find my schedule here:
http://wiki.php.net/gsoc/2009/phdplugins

Blog:
http://moacirdeoliveira.blogspot.com

Regards,

Moacir de Oliveira


[PHP-DOC] Patch Review

2009-07-02 Thread Moacir de Oliveira
Hi guys,

can you review this patch?

do you think I should use aggregators or just use elseif sections in the
function SQLiteIndex?

thx

--Moacir
Index: Format.php
===
RCS file: /repository/phd/phpdotnet/phd/Format.php,v
retrieving revision 1.4
diff -u -r1.4 Format.php
--- Format.php  22 Jun 2009 01:22:52 -  1.4
+++ Format.php  2 Jul 2009 05:09:49 -
@@ -14,6 +14,10 @@
 protected $indexes = array();
 protected $childrens = array();
 
+protected $refs = array();
+protected $vars = array();
+protected $classes = array();
+
 private static $autogen = array();
 
 /* PhDHelper */
@@ -37,8 +41,14 @@
 public function sortIDs() {
 $this->sqlite->createAggregate("indexes", array($this, "SQLiteIndex"), 
array($this, "SQLiteFinal"), 8);
 $this->sqlite->createAggregate("childrens", array($this, 
"SQLiteChildrens"), array($this, "SQLiteFinal"), 2);
+$this->sqlite->createAggregate("refname", array($this, 
"SQLiteRefname"), array($this, "SQLiteFinal"), 2);
+$this->sqlite->createAggregate("varname", array($this, 
"SQLiteVarname"), array($this, "SQLiteFinal"), 2);
+$this->sqlite->createAggregate("classname", array($this, 
"SQLiteClassname"), array($this, "SQLiteFinal"), 2);
 $this->sqlite->query('SELECT indexes(docbook_id, filename, parent_id, 
sdesc, ldesc, element, previous, next) FROM ids');
 $this->sqlite->query('SELECT childrens(docbook_id, parent_id) FROM 
ids');
+$this->sqlite->query('SELECT refname(docbook_id, sdesc) FROM ids WHERE 
element=\'refentry\'');
+$this->sqlite->query('SELECT varname(docbook_id, sdesc) FROM ids WHERE 
element=\'phpdoc:varentry\'');
+$this->sqlite->query('SELECT classname(docbook_id, sdesc) FROM ids 
WHERE element=\'phpdoc:exceptionref\' OR element=\'phpdoc:classref\'');
 }
 
 public function SQLiteIndex(&$context, $index, $id, $filename, $parent, 
$sdesc, $ldesc, $element, $previous, $next) {
@@ -52,10 +62,6 @@
 "previous"   => $previous,
 "next"   => $next
 );
+/*
+if ($element == "refentry") {
+$ref = strtolower(str_replace(array("_", "::", "->"), array("-", 
"-", "-"), $sdesc));
+$this->refs[$sdesc] = $id;
+} elseif ($element == "phpdoc:varentry") {
+$this->vars[$sdesc] = $id;
+} elseif ($element == "phpdoc:exceptionref" || element == 
"phpdoc:classref") {
+$this->classes[strtolower($sdesc)] = $id;
+}
+*/
 }
 
 public function SQLiteChildrens(&$context, $index, $id, $parent) {
@@ -65,6 +71,19 @@
 $this->childrens[$parent][] = $id;
 }
 
+public function SQLiteRefname(&$context, $index, $id, $sdesc) {
+$ref = strtolower(str_replace(array("_", "::", "->"), array("-", "-", 
"-"), $sdesc));
+$this->refs[$ref] = $id;
+}
+
+public function SQLiteVarname(&$context, $index, $id, $sdesc) {
+$this->vars[$sdesc] = $id;
+}
+
+public function SQLiteClassname(&$context, $index, $id, $sdesc) {
+$this->classes[strtolower($sdesc)] = $id;
+}
+
 public static function SQLiteFinal(&$context) {
 return $context;
 }
@@ -75,6 +94,19 @@
 $format->update($event, $val);
 }
 }
+
+function getRefnameLink($ref) {
+return isset($this->refs[$ref]) ? $this->refs[$ref] : null;
+}
+
+public function getClassnameLink($class) {
+return isset($this->classes[$class]) ? $this->classes[$class] : null;
+}
+
+public function getVarnameLink($var) {
+return isset($this->vars[$var]) ? $this->vars[$var] : null;
+}
+
 final public function registerElementMap(array $map) {
 $this->elementmap = $map;
 }


Re: [PHP-DOC] PhD Improvements (Plugin System) - Status Report 5

2009-06-30 Thread Moacir de Oliveira
Hi Fernando,


I see you talking about php and pear, anything about php-gtk?


For my GSoC project I'm planning to render 2 books
Docbook the Definitive Guide: http://www.docbook.org/tdg/
Producing Open Source Software: http://producingoss.com/



> What is exactly a phd plugin?

The "Plugins" are about packages. In a package you will write the classes to
render your manual. So if you wanna render the GTK Manual you have to write
a GTK Package with classes for each output format you want.


> If I write one, I can use phd to process a book with a xml markup that is
> not same as phpdoc?

Yes, in your package you will handle the docbook tags.


You can find useful information about the installation here:
http://wiki.php.net/doc/phd/install

question: are you from Brazil? :)


--Moacir de Oliveira


[PHP-DOC] PhD Improvements (Plugin System) - Status Report 5

2009-06-29 Thread Moacir de Oliveira
hi all,

This is my 5th status report (21 June to 27 June).

HIGHLIGHTS
-
This week I wrote the Pear Formats: bigxhtml, xhtml and php \o/. A lot of
fun, some problems with the indexer and a lot of code.
The SQLite indexer needs some fixes (some broken TOCs and links).
Now I have to port the PHP Formats, a LOT of work to do, I think this week
will be most difficult of my project, and also the most fun.

KEY ACCOMPLISHMENTS
-
New classes:
Package_Pear_XHTML: Base class of the xhtml formats
Package_Pear_BigXHTML: Big html format
Package_Pear_ChunkedXHTML: Chunked html format
Package_Pear_Web: The .php chunked format.
Package_Pear_CHM: The CHM output format, not finished yet

Bug fixes in the Index class
Bug fixes in the Default Package

MY TODO
-
Fix bugs in the Index class
Fix bugs in the Pear Formats
Begin porting the PHP themes:
Package_PHP_XHTML
Package_PHP_BigXHTML
Package_PHP_ChunkedXHTML
Package_PHP_Web
Begin writing the Abstract Formats:
Format_Abstract_PDF
Format_Abstract_Manpage

KEY CONCERNS
-
My only concern is because we have to many php themes, but I think two weeks
will be enough to port all of them.

---

You can find my schedule here:
http://wiki.php.net/gsoc/2009/phdplugins

Blog:
http://moacirdeoliveira.blogspot.com

Regards,

Moacir de Oliveira


Re: [PHP-DOC] PhD Improvements (Plugin System) - Status Report 4

2009-06-22 Thread Moacir de Oliveira
Hi Christian,

2009/6/22 Christian Weiske 

>
> > KEY CONCERNS
> > -
> > In the Pear Themes we have a CHM theme and I have to study this format
> > before code, I think this task will spend more time to be done.
> Once you're done with the other pear themes (excluding chm), go on to the
> php ones - I'll take care of the chm one.
>
>
thanks a lot, is good to know that I'm in a team


--Moacir


[PHP-DOC] PhD Improvements (Plugin System) - Status Report 4

2009-06-22 Thread Moacir de Oliveira
hi all,

This is my 4th status report (14 June to 20 June).

HIGHLIGHTS
-
This week I wrote the Default package, that will be the base of the next
packages (TDG, ProducingOSS). Also I started porting the Pear Themes to the
new design.
PhD now is working with namespaces and pear conventions \o/, kudos to
Christian Weiske that made the changes so fast. One day I'll be as fast as
you guys ;)


KEY ACCOMPLISHMENTS
-
New classes:
Package_Default_XHTML: Base class of the xhtml formats
Package_Default_ChunkedXHTML: Chunked html format
Package_Default_BigXHTML: Big html format
Package_Default_PHP: PHP format, working only with the phpdoc yet.

Started porting the Pear Themes to the new design:
Package_Pear_ChunkedXHTML
Package_Pear_BigXHTML

Merged the code of Theme, Theme_XHTML, Helper, with the Format and
Format_Abstract_XHTML classes.


MY TODO
-
Port the Pear Themes to the new design (Using the SQLite indexer/Remove
the legacy code from HEAD)
Fix bugs in the Default Package


KEY CONCERNS
-
In the Pear Themes we have a CHM theme and I have to study this format
before code, I think this task will spend more time to be done.


---

You can find my schedule here:
http://wiki.php.net/gsoc/2009/phdplugins

Blog:
http://moacirdeoliveira.blogspot.com

Regards,

Moacir de Oliveira


[PHP-DOC] Re: Enterprise classes

2009-06-15 Thread Moacir de Oliveira
Hi Christian

2009/6/15 Christian Weiske 

>
> Do I assume correctly that files like
> include/PhDEnterpriseReader.class.php are meant to replace
> include/PhDReader.class.php?
>
>
The classes PhDReader and PhDFormat still there just for compatibility with
the themes, and now are deprecated. I don't think is a good idea remove them
now. The idea is write packages that will adapt the old themes to the
enterprise formats.

regards,

Moacir


[PHP-DOC] PhD Improvements (Plugin System) - Status Report 3

2009-06-14 Thread Moacir de Oliveira
hi all,

This is my third status report (7 June to 13 June).

This week I proposed a design for merging PhD Enterprise to HEAD
http://img30.yfrog.com/img30/2370/design2.png. With that design we will be
able to use all the features of PhD Enterprise and the current output
formats of HEAD (using adapters), the formats will be grouped in packages
and the packages are pluggable. We will reuse almost all the classes of PhD
Enterprise, the PhDFormatFactory class was written in my first week. To
reuse the themes of HEAD is necessary to write packages to adapt them to
formats.

This week I also begin coding the abstract formats and the default package.

In my schedule the current task is "Make concrete formats plug and play" but
it's already done, so my tasks now are:
- Discuss the interface of the abstract formats.
- Finish coding the Default package.
- Begin porting the old PhD Themes to the current design.

Important Note: This week we are planning to begin moving PhD to use the
PEAR filename and class convention.

---

You can find my schedule here:
http://wiki.php.net/gsoc/2009/phdplugins

Blog:
http://moacirdeoliveira.blogspot.com

Regards,

Moacir de Oliveira


[PHP-DOC] CVS Account Request: moacir

2009-05-28 Thread Moacir de Oliveira Miranda Júnior
Working on PhD. 
I'm the GSoC student working on PhD and my mentor (Hannes Magnusson) asked me 
to request an account.


[PHP-DOC] Implementation of the --package option in PhD

2009-05-27 Thread Moacir de Oliveira
Hi all,

My name is Moacir de Oliveira and I am the GSoC student working on PhD. In
this first week, I'm working in a new feature for PhD, the --package option.
Follows a brief explanation as well as the patches with the implementation.


Implementation of the --package option in PhD.

This proposal is based in the design pattern Abstract Factory, and only
compatible with PHD_ENTERPRISE yet.
The main idea is: when you have a new "package" of formats (to render some
book or documentation), all you have to do is paste the formats in a folder
and run PhD. Nowadays, we can't create a new set of classes for rendering
some book or documentation without modify the main code of PhD. With this
implementation the new packages will be "plug and play".

Example: If you have a new set of formats for rendering Docbook: The
Definitive Guide 5, you will have to paste the files in a folder with the
name of your package (TDG5) and paste in the packages directory.

Ex: packages/TDG5/

To make your package compatible with PhD you must write a concrete factory
that inherits PhDFormatFactory and implement the creational methods. The
name of your factory must follow the convention: Factory. The
file must have the same name.

Ex: class TDG5Factory in the file TDG5Factory.class.php

And now run:
phd -d ../phpdoc/.manual.xml -f xhtml --package TDG5

If you skip the --package option a default package will be considered.

We don't need to modify the main code of PhD.

Package Example:
packages/TDG5/TDG5Factory.class.php
packages/TDG5/tdgxhtml.php
packages/TDG5/tdgbigxhtml.php
packages/TDG5/tdgphp.php

The classes in tdgxhtml.php, tdgphp.php etc. must inherit PhDFormat or
subclasses (example PhDXHTMLFormat).

After the implementation of this feature, the next step is make the current
formats generic enough for rendering other documentations.


I'm waiting for comments.

-Moacir
Index: config.php
===
RCS file: /repository/phd/config.php,v
retrieving revision 1.53.2.4
diff -u -r1.53.2.4 config.php
--- config.php  1 Aug 2008 18:57:52 -   1.53.2.4
+++ config.php  28 May 2009 02:07:43 -
@@ -37,6 +37,7 @@
 'user_error_color' => false,
 'phd_info_output' => NULL,
 'phd_info_color' => false,
+'package' => 'PHP',
 );
 
 public static function init(array $a) {

Index: include/PhDBuildOptions.class.php
===
RCS file: /repository/phd/include/PhDBuildOptions.class.php,v
retrieving revision 1.6.2.4
diff -u -r1.6.2.4 PhDBuildOptions.class.php
--- include/PhDBuildOptions.class.php   1 Aug 2008 11:02:04 -   1.6.2.4
+++ include/PhDBuildOptions.class.php   28 May 2009 02:08:22 -
@@ -20,6 +20,7 @@
 "color:"=> "c:",// Use color output if possible
 "version"   => "V", // Print out version information
 "help"  => "h", // Print out help
+"package:"  => "P:",// The package of formats
 );
 }
 
@@ -99,6 +100,9 @@
 
 public function option_p($k, $v)
 {
+if ($k == "P") {
+return $this->option_package($k, $v);
+}
 $this->option_partial($k, $v);
 }
 public function option_partial($k, $v)
@@ -119,6 +123,25 @@
 PhDConfig::set_render_ids($render_ids);
 }
 
+public function option_package($k, $v) {
+static $packageList = NULL;
+
+if (is_null($packageList)) {
+$packageList = array();
+foreach (glob($GLOBALS['ROOT'] . "/packages/*") as $item) {
+if (is_dir($item) && !($item == "." || $item == "..")) {
+$packageList[] = basename($item);
+}
+}
+}
+
+if (in_array($v, $packageList)) {
+PhDConfig::set_package($v);
+} else {
+trigger_error("Invalid Package", E_USER_ERROR);
+}
+}
+
 public function option_s($k, $v)
 {
 $this->option_skip($k, $v);
@@ -193,7 +216,7 @@
 
 echo "Supported formats:\n";
 echo "\t" . implode("\n\t", $formatList) . "\n";
-break;
+//break;
   
 exit(0);
 }

Index: render.php
===
RCS file: /repository/phd/Attic/render.php,v
retrieving revision 1.3.2.10
diff -u -r1.3.2.10 render.php
--- render.php  11 Aug 2008 12:46:48 -  1.3.2.10
+++ render.php  28 May 2009 02:07:22 -
@@ -11,9 +11,11 @@
 require $ROOT . "/include/PhDFormat.class.php";

[PHP-DOC] PhD Plugin System

2009-05-01 Thread Moacir de Oliveira
Hi all,

My name is Moacir de Oliveira, i am a undergraduate Computer Engineering
student in Brazil.
This is my first GSoC and i'm working in a PHP project called PhD[1].

Phd is the software that renders the DocBook based documentation of both PHP
Manual
and PEAR Manual.

In this summer, i'm going to do a Plugin System to PhD. The idea is simplify
the creation
of new themes, and make PhD generic enough to be useful for non-php.netprojects.
After, i'm planning to do some examples of theme package, for example the
book Producing
Open Source Software[2], or DocBook 5.0: The Definitive Guide[3].

Another example of theme would render the funcindex.xml file from the PHP
documentation source.[4]

I'm waiting for comments.

I will post my progress here:
http://moacirdeoliveira.blogspot.com/

WikiPage:
http://wiki.php.net/gsoc/2009/phdplugins

[1] - http://wiki.php.net/doc/phd
[2] - http://producingoss.com/
[3] - http://www.docbook.org/tdg5/
[4] - http://bugs.php.net/bug.php?id=47651


Moacir de Oliveira