diff --git a/.doc/README.md b/.doc/README.md new file mode 100644 index 000000000..2bc851cd7 --- /dev/null +++ b/.doc/README.md @@ -0,0 +1,52 @@ +# phpdoc dokuwiki template +This directory contains a template rendering iTop phpdoc as wiki pages. + + + +## special instructions + +some tags where added : + * `@api-advanced`: it means that a method is an `@api` but mark it also as "complex" to use + * `@overwritable-hook`: used to mark a method as "designed to be extended" + * `@extension-hook`: not used for now + * `@phpdoc-tunning-exclude-inherited`: tunning tag that inform this template to ignere inherited methods in the rendrering. + +some behaviours where added : + * only public `@api` and `@api-advanced` are showed + * class properties are hidden (subject to change, but will require to white list them using `@api` tag) + +known limitations: + * inline tag do not work properly + * links are hardcoded instead of using phpdoc routes (adding our own routes was too complex) + * `@see` tags must be very specific: + * always prefix class members with `Class::` (ie: `DBObject::Get()`) + * for methods always suffix them with `()`, + * for variables, always prefix them with `$`. + * do not use inline @see + * as spaces are used to mark code, the templates have very few indentation, thus they are awful to read (sorry) + * `@example` + * the sentence in the first line (next to the tag) is the title, it must be enclose by double quotes + * the following lines are the sample code. + * 💔 since we simply hack the official tag, this syntax must be respected carefully 💔 + + + +## dokuwiki requirements + * the templates uses the [wrap plugin](https://www.dokuwiki.org/plugin:wrap). + * the generated files have to be placed under an arbitrary directory of `[/path/to/dokuwiki]/data/pages`. + * the html as to be activated [config:htmlok](https://www.dokuwiki.org/config:htmlok) + * the generated files have to be in lowercase + +## installation +``` +composer require phpdocumentor/phpdocumentor:~2 --dev +``` + +## bin +`.doc/bin/build-doc-object-manipulation` and `.doc/bin/build-doc-extensions` contains examples of doc. generation, beware: they have to be called from iTop root directory: +```shell +cd /path/to/itop/ +./.doc/bin/build-doc-object-manipulation +``` + +the resulting documentation is written into `data/phpdocumentor/output` \ No newline at end of file diff --git a/.doc/bin/build-doc-extensions b/.doc/bin/build-doc-extensions new file mode 100755 index 000000000..77be02873 --- /dev/null +++ b/.doc/bin/build-doc-extensions @@ -0,0 +1,7 @@ +#!/bin/sh -x + +rm -rf /tmp/phpdoc-twig-cache/ && rm -rf data/phpdocumentor/output/extensions/ && rm -rf data/phpdocumentor/temp/extensions/ && vendor/bin/phpdoc -c .doc/phpdoc-extensions.dist.xml -vvv + +# now wee need to lowercase every generated file because dokuwiki can't handle uppercase +cd data/phpdocumentor/output/extensions/ +for i in $( ls | grep [A-Z] ); do mv -i $i `echo $i | tr 'A-Z' 'a-z'`; done \ No newline at end of file diff --git a/.doc/bin/build-doc-object-manipulation b/.doc/bin/build-doc-object-manipulation new file mode 100755 index 000000000..ca959a26e --- /dev/null +++ b/.doc/bin/build-doc-object-manipulation @@ -0,0 +1,8 @@ +#!/bin/sh -x + +rm -rf /tmp/phpdoc-twig-cache/ && rm -rf data/phpdocumentor/output/objects-manipulation/ && rm -rf data/phpdocumentor/temp/objects-manipulation/ && vendor/bin/phpdoc -c .doc/phpdoc-objects-manipulation.dist.xml -vvv + + +# now wee need to lowercase every generated file because dokuwiki can't handle uppercase +cd data/phpdocumentor/output/objects-manipulation/ +for i in $( ls | grep [A-Z] ); do mv -i $i `echo $i | tr 'A-Z' 'a-z'`; done \ No newline at end of file diff --git a/.doc/phpdoc-extensions.dist.xml b/.doc/phpdoc-extensions.dist.xml new file mode 100755 index 000000000..826cd61f2 --- /dev/null +++ b/.doc/phpdoc-extensions.dist.xml @@ -0,0 +1,20 @@ + + + <![CDATA[iTop extensions]]> + + + ../data/phpdocumentor/temp/extensions + + + + ../data/phpdocumentor/output/extensions + + + +