php / doc-en

English PHP documentation
482 stars 717 forks source link

Migrate PHP Documentation schema to DocBook 5.2 #3326

Open Girgias opened 4 months ago

Girgias commented 4 months ago

DocBook 5.2 has finally been released: https://www.oasis-open.org/2024/02/13/the-docbook-schema-version-5-2-oasis-standard-published/

The primary motivation to migrate to this new version is to be able to use the new <enumsynopsis> tag.

However, there a some issues with the current documentation which makes this migration challenging.

RelaxNG Schema

The new schema is only provided as a RelaxNG schema, whereas most of our tooling expects a DTD. I have made progress in checking the documentation against it, but this required compiling jing-trang locally to check what is causing issues. It is likely we will need to have this on CI somehow to improve the debugging experience for new contributors.

Legacy custom markup

Classes, Interfaces, and Exceptions use a custom phpdoc: tag, and need to be converted to a structure that fits the DocBook schema, I have written a script that converts the relevant files to a new markup, but this does not validate the schema yet.

Turns out jumping directly to DocBook 5.2 simplifies some stuff as we just need to replace those tags with <reference>.

However, our "new" markup for extending classes/implementing interfaces doesn't comply :( There seems to either be a bug in the DocBook 5.2 schema, or an undocumented BC break. Trying to contact the relevant people about this issue.

Minor schema violation issues

Various files do not follow the DocBook schema properly and need to be fixed some bigger issues are:

Migration Procedure

haszi commented 3 months ago

Maybe we can convert some of the tooling (e.g. doc-base's configure.php) to use DOMDocument::relaxNGValidate() to switch from DTD to RelaxNG schema validation. Do you think that could work?

Girgias commented 3 months ago

Maybe we can convert some of the tooling (e.g. doc-base's configure.php) to use DOMDocument::relaxNGValidate() to switch from DTD to RelaxNG schema validation. Do you think that could work?

So yes that's the plan, but libxml2 is terrible at giving useful errors when the schema fails, and also it somehow doesn't validate the schema properly unless I reload the whole file.

You can see what I have here: https://github.com/php/doc-base/compare/master...Girgias:doc-base:docbook-5