Uh oh!
There was an error while loading. Please reload this page.
XML Entities, individual and grouped - #183
Conversation
Added support for namespace correct, bundled XML entity files. So a line like this on <entityname="link.composer"><linkxlink:href="&url.pecl;">Composer</link></entity>becomes this on <!ENTITY link.composer '<linkxmlns="http://docbook.org/ns/docbook"xmlns:xlink="http://www.w3.org/1999/xlink"xlink:href="&url.pecl;">Composer</link>'>and an file named <methodsynopsis>
<type>int</type><methodname><replaceable>callback</replaceable></methodname>
<methodparam><type>mixed</type><parameter>a</parameter></methodparam>
<methodparam><type>mixed</type><parameter>b</parameter></methodparam>
</methodsynopsis>becomes <!ENTITY callback.cmp '<methodsynopsisxmlns="http://docbook.org/ns/docbook"><type>int</type><methodname><replaceable>callback</replaceable></methodname>
<methodparam><type>mixed</type><parameter>a</parameter></methodparam>
<methodparam><type>mixed</type><parameter>b</parameter></methodparam>
</methodsynopsis>'> |
Girgias
left a comment
There was a problem hiding this comment.
I had a very cursory glance at this, but you might want to rebase and squash some commits together?
Uh oh!
There was an error while loading. Please reload this page.
alfsb
commented
Nov 28, 2024
Yes to squash and rebase. I just found out that manual building is not idempotent, and because of that, my regression testing so far was inadequate. Back to draft, until I can address all points above. I will ping |
alfsb
commented
Nov 29, 2024
Some observations that I gathered while working on making manual build idempotent. At a size of ~41 Mb and actual entity usage, the PHP manual is dangerously close to hinting some hard coded libxml2 limits.Twice I changed the code to avoid the misleading error Specifically, it was necessary to keep entities listings, generated by |
Girgias
commented
Dec 3, 2024
Would changing the entities generated by Yes this would require patching all of the docs, but wondering if this is a way forward as I was thinking of this already. |
alfsb
commented
Dec 3, 2024
Yes. Yet, a better solution would be having an option to change whatever metric libxml2 uses to identify high entity usage. The entity usage is huge in manuals, and this will bite someday.
In the end, I think directly changing entity files for But, priorities. For now, I focused on XInclude/fallback, then XInclude by xml:id, then this infrastructure, then |
Girgias
commented
Dec 3, 2024
Yes, obviously this is lower on the priority. |
alfsb
commented
Dec 4, 2024
I'm thinking of opening an issue, to keep track of these projects. An road map of mentioned projects above, and to document some bottlenecks found in the way, like the entities limit. |
Girgias
commented
Dec 4, 2024
Feel free to do that :) it can be a meta issue like the doc tracking one which you can update overtime and split into individual issues if needed. |
alfsb
commented
Dec 5, 2024
I will change my answer, after this comment.
No. XInclude only "runs" by calling
Let me be clear about this. The PHP manuals are at breaking point as far as libxml2 is concerned. There are files it loads, and there are files it rejects. Full stop. DITA DTDs are unusable on libxml2 for several months, and there are other reports of files being rejected starting at ~40 Mb size. Looking ahead, the PHP community may need to ask/contribute/fund for an "unlimited" option on libxml2, on a libxml2 version that it could use, compile and distribute (or building manual outside servers become impossible). The linked fix for DITA only fixes half the problem (the size amplification one), but PHP manual already are triggering another limit, entity recursion level. This is the |
alfsb
commented
Dec 6, 2024
While doing rebase (and tests) efforts, I found an entity collision. Enity |
Girgias
commented
Dec 6, 2024
Please remove the one in |
alfsb
commented
Dec 6, 2024
I will do it Monday morning, after merging the small PRs. |
alfsb
commented
Dec 9, 2024
Some other notes. I discovered only yesterday that is a whole W3C recommendation for XML Fragments, and I'm surprised to to see solution adopted here is the same of said recommendation. About replacing file entities by Process Instructions and/or XPointer, this might be possible. The problem is the bad iterations between entities and XInclude, so replacing file entities for PI/XI would need to exist as one of two possible stacks bellow: Without XInclude 1.1 native support
With XInclude 1.1 native support
I think it is possible to create an userland XInclude by Href, but I have not created a prototype yet, to test if the bad iteration can be overcome. The risk of succeeding here is that we may paint ourselves into a ugly corner of XML toolage in the end. So the answer might be: if possible, change to a XML processor that does XInclude 1.1. |
alfsb
commented
Dec 9, 2024
Pushed a change to detect duplicated entity names on first language loaded (so translations can detect internal duplications), and finally tested inter repository debug mode. Found two more duplicated entities between doc-base and doc-en, so there is three in total: |
alfsb
commented
Dec 9, 2024
Remove the three duplicated entities from Meanwhile, this is waiting for idempotent to get merged (so regression tests get a little less random), but it's in good enough shape to be merged, if there is demand for experimentation while 8.4 changes are still high. |
Girgias
commented
Dec 9, 2024
Yes I think this is the best approach, those shouldn't be translate. |
alfsb
commented
Dec 20, 2024
And
After some tests today, my answer is that replacing file entities with anything else will only be possible by changing to a XML processor that does XInclude 1.1 and propagate entities between files, something that is not mandated by standards. The test. <!DOCTYPEa [<!ENTITYc"CC">]>
<a>
<b>&c;</b>
<b><xi:includexmlns:xi="http://www.w3.org/2001/XInclude"href="b.xml"/></b>
</a>And <b>&c;</b>That is,
Complete parsed infosets. As |
alfsb
commented
Dec 28, 2024
In the end, a simple
I found hacky ways to do controlled file loading/inclusion in userland code, by entity and XInclude, so in theory it is possible to get rid of |
alfsb
commented
Jan 2, 2025
Conflict resolved. But the main question remains. Do the languages manuals want to split |
Girgias
commented
Jan 14, 2025
I think splitting |
alfsb
commented
Jan 15, 2025
This PR enables splitting
About #173, I think the same problem above applies. Any generated text and common wordings cannot contain entity references (so no I found a very hacky way to workaround this limitation of undefined entity references in external documents and fragments, but it is also possibly very brittle, as it is not documented anywhere I searched. But it will possibly allow to replace all DTD entity stuff (file and text entities) with userland PHP code, to make possible use DTD Entity syntax and XInclude by XPath/ID/href in a compatible way. |
Girgias
commented
Jan 27, 2025
Entity level is already an improvement, so I am fine with the idea and approach. :) |
alfsb
commented
Jan 27, 2025
This will be the my next big project, then, in February. There is incidental extra benefit, in transforming DTD entities into XML file entities: it would be possible to run XML sync tests between languages, and so, to detect misaligned attributes and/or entities inside another entities. |
alfsb
commented
Mar 14, 2025
Now that all my other big projects are mostly concluded, I will start working on this again. After #237, I'm now way more confident that XInclude by |
Uh oh!
There was an error while loading. Please reload this page.
alfsb
commented
Jun 15, 2026
Merged to avoid more rebases. There are still some testing I will make before fully enabling this, with some manual migration of DTD text entities into XML text entities, to exemplify how this works. |
This PR creates a new
doc-base/scripts/entities.entfile, that is called fromconfigure.phpbut can also be called from the command line.The new script start looking
global.ent,manual.entandremove.entin each doc-lang repository. Besides the.entextension, these are normal. XML files, that uses the same namespaces as manual, so small entities placed here can be namespace clean(er),The new script also starts looking for an
entities/dir in each doc-lang repository, and loads any.xmlfile found here as an individual entity file, so bigger entities get easier to edit and can be now revchecked individually.Included are two other scripts,
dtdent-conv.phpanddtdent-split.php, that bulk convert (or split) big files of DTD Entities into XML Entities. These tools are not necessary for implantation.This will make entity experimentation a lot easier, and is the enabling step into splitting
language-entities.entfile. This works well, but is another possibly big change, so I do not plan to push for this until 2025, or the PHP 8.4 doc changes slow down, or if there is some demand for early experimentation.