Skip to content

Commit bd3f9a8

Browse files
authored
XML Entities by example (#5634)
* Example of transforming DTD entities into XML entities * Per extension entities example * Remove example file * EOF EOL * Reviews * Per extension entity example
1 parent e565d17 commit bd3f9a8

5 files changed

Lines changed: 118 additions & 13 deletions

File tree

contributors.ent

Lines changed: 0 additions & 12 deletions
This file was deleted.

docbookcs.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
</paths>
2222

2323
<entities>
24-
<file>contributors.ent</file>
2524
<file>extensions.ent</file>
2625
<file>language-defs.ent</file>
2726
<file>language-snippets.ent</file>

entities/entities-remove.ent

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- $Revision$ -->
3+
<!--
4+
5+
This is a "remove" XML Entity file.
6+
See doc-base/script/text-entities.php for details.
7+
8+
Place here only deprecated or removed entities that are
9+
expected NOT be being used in any part of the manual.
10+
11+
If an entity moved here is used in a language in your control,
12+
this means that the entity on the original file is planned to be
13+
removed, or already was removed.
14+
15+
DO NOT TRANSLATE THIS FILE.
16+
17+
This file is tracked by revcheck, so translations have a heads up
18+
when an entity is removed from doc-en. On translations, leave an
19+
empty <entities/> element at the end of file, only updating the revtag.
20+
21+
-->
22+
23+
<entities xmlns = "http://docbook.org/ns/docbook"
24+
xmlns:xlink = "http://www.w3.org/1999/xlink"
25+
translate = "remove">
26+
27+
<!-- Erased in 2026-06, long time empty -->
28+
<entity name="frontpage.authors"/>
29+
<entity name="frontpage.editors"/>
30+
31+
</entities>

entities/entities.ent

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- $Revision$ -->
3+
<!--
4+
5+
This is a translatable XML Entity file.
6+
See doc-base/script/text-entities.php for details.
7+
8+
Place here small entities that are expected to be translated.
9+
For big or complex entities, please create an individual entity
10+
file at doc-lang/entities/entityname.xml.
11+
12+
No inline namespaces are necessary. In fact, they can make things
13+
complicated to debug later. Place any needed namespace in
14+
declaration of root <entities> element.
15+
16+
Keep the lines strictly under 79 columns, to make the process of
17+
manual translation easier, and to avoid wrap-around in some other
18+
contexts.
19+
20+
-->
21+
22+
<entities xmlns = "http://docbook.org/ns/docbook"
23+
xmlns:xlink = "http://www.w3.org/1999/xlink"
24+
translate = "yes">
25+
26+
<entity name="extcat.intro">
27+
<title>Extension List/Categorization</title>
28+
<simpara>This appendix categorizes more than 150 extensions documented
29+
in the PHP Manual by several criteria.</simpara>
30+
</entity>
31+
32+
<entity name="extcat.alphabetical"><title>Alphabetical</title></entity>
33+
<entity name="extcat.alphabetical"><title>Alphabetical</title></entity>
34+
35+
</entities>

reference/entities.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Per extension entities
2+
3+
For textual entities, related to specific extensions, new or migrated
4+
from `language-snippets.ent`, please use the following conventions.
5+
6+
* Use an `ext.` prefix for all entity names;
7+
* Use model file below, for new entities files;
8+
* Place the entities in file named `doc-en/reference/$extension/entities.ent`;
9+
* Keep the entities sorted by name, one empty line separating each entity.
10+
11+
If the entity is "big" or otherwise difficult to edit in a file
12+
with many others, it is possible to create a individual entity per file,
13+
saved as `doc-en/entities/name.$extension.$entname.xml`, whereas the
14+
content can be any valid [well-balanced
15+
region](https://www.w3.org/TR/xml-fragment/#defn-well-balanced).
16+
DTD entity names are also valid here, but XML declarations are not.
17+
18+
XML namespaces are to be placed in the root `<entities>` element, and
19+
avoided in any `<entity>` child.
20+
21+
To rename existing entities to use the `ext.` prefix, is possible to
22+
create temporary aliases, with the following format:
23+
```xml
24+
<entity name="old.name">&new.name;</entity>
25+
```
26+
27+
Temporary aliases are better placed in
28+
`doc-en/entities/entities-remove.ent`, to avoid duplicated work in
29+
translations, but are acceptable here too.
30+
31+
### Example file
32+
33+
```xml
34+
<?xml version="1.0" encoding="utf-8"?>
35+
<!-- $Revision$ -->
36+
<!--
37+
    See `manual.xml` for XML namespaces defaults.
38+
    Keep the lines under 79 columns, to make the process of manual
39+
    translation easier, and to avoid wrap-around in some other contexts.
40+
-->
41+
<entities xmlns       = "http://docbook.org/ns/docbook"
42+
          xmlns:xlink = "http://www.w3.org/1999/xlink"
43+
          translate   = "yes">
44+
45+
<entity name="ext.$extention.$entity-name">
46+
 <simpara>
47+
  Text.
48+
 </simpara>
49+
</entity>
50+
51+
</entities>
52+
```

0 commit comments

Comments
 (0)