summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile6
-rw-r--r--devbook.rnc144
-rw-r--r--schemas.xml4
3 files changed, 153 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 58802fe..9a40f59 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,5 @@
-DTDS = book.dtd glsa.dtd guide.dtd metadata.dtd projects.dtd repositories.dtd
+DTDS = book.dtd devbook.dtd glsa.dtd guide.dtd metadata.dtd \
+ projects.dtd repositories.dtd
DTDDEPS = $(patsubst %.dtd,%.dep,$(DTDS))
RNCS = $(patsubst %.dtd,%.rnc,$(DTDS))
@@ -46,4 +47,7 @@ $(TARBALL): Makefile LICENCE schemas.xml $(RNCS)
%.dtd:
wget -N --no-verbose https://www.gentoo.org/dtd/$@
+devbook.dtd:
+ wget -N --no-verbose https://devmanual.gentoo.org/$@
+
-include .depend
diff --git a/devbook.rnc b/devbook.rnc
new file mode 100644
index 0000000..1d24153
--- /dev/null
+++ b/devbook.rnc
@@ -0,0 +1,144 @@
+# Copyright 2019 Gentoo Authors
+
+# Distributed under the terms of the MIT/X11 license
+
+# Document Type Definition for the Gentoo Devmanual
+
+# Based on common.dtd from GuideXML
+
+namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
+
+block.class =
+ p
+ | pre
+ | codesample
+ | note
+ | important
+ | warning
+ | todo
+ | figure
+ | table
+ | ul
+ | ol
+ | dl
+ | list-group-u
+ | list-group-d
+inline.class = sup | sub | b | c | d | e | path | uri
+all.class = block.class | inline.class
+guide = element guide { guide.attlist, (\include | chapter)+ }
+guide.attlist &=
+ attribute root { "true" }?,
+ attribute self { text }?
+\include = element include { include.attlist, empty }
+include.attlist &= attribute href { text }
+chapter =
+ element chapter { chapter.attlist, title, (body | section), section* }
+chapter.attlist &= empty
+section =
+ element section {
+ section.attlist, title, (body | subsection), subsection*
+ }
+section.attlist &= empty
+subsection =
+ element subsection {
+ subsection.attlist, title, (body | subsubsection), subsubsection*
+ }
+subsection.attlist &= empty
+subsubsection =
+ element subsubsection { subsubsection.attlist, title, body }
+subsubsection.attlist &= empty
+# Title texts are used as anchors, so we shouldn't allow any formatting,
+# but unfortunately it is used in the document.
+title = element title { title.attlist, (text | inline.class)* }
+title.attlist &= empty
+body =
+ element body { body.attlist, (authors | contentsTree | block.class)+ }
+body.attlist &= empty
+authors = element authors { authors.attlist, author+ }
+authors.attlist &= empty
+author = element author { author.attlist, (text | inline.class)* }
+author.attlist &=
+ attribute name { text },
+ attribute email { text }?
+contentsTree = element contentsTree { contentsTree.attlist, empty }
+contentsTree.attlist &=
+ attribute maxdepth { text }?,
+ attribute root { text }?,
+ attribute extraction { text }?
+p = element p { p.attlist, (text | inline.class)* }
+p.attlist &= empty
+pre = element pre { pre.attlist, text }
+pre.attlist &= empty
+codesample = element codesample { codesample.attlist, text }
+codesample.attlist &=
+ attribute lang { "c" | "ebuild" | "make" | "m4" | "sgml" },
+ attribute numbering { "lines" }?
+note = element note { note.attlist, (text | inline.class)* }
+note.attlist &= empty
+important =
+ element important { important.attlist, (text | inline.class)* }
+important.attlist &= empty
+warning = element warning { warning.attlist, (text | inline.class)* }
+warning.attlist &= empty
+todo = element todo { todo.attlist, (text | inline.class)* }
+todo.attlist &= empty
+figure = element figure { figure.attlist, empty }
+figure.attlist &=
+ attribute link { text },
+ attribute short { text }?,
+ attribute caption { text }?
+table = element table { table.attlist, tcolumn*, tr+ }
+table.attlist &= empty
+tcolumn = element tcolumn { tcolumn.attlist, empty }
+tcolumn.attlist &= attribute width { text }
+tr = element tr { tr.attlist, (th | ti)+ }
+tr.attlist &= empty
+th = element th { th.attlist, (text | inline.class)* }
+th.attlist &=
+ attribute colspan { text }?,
+ attribute rowspan { text }?,
+ [ a:defaultValue = "left" ]
+ attribute align { "left" | "center" | "right" }?
+ti = element ti { ti.attlist, (text | all.class)* }
+ti.attlist &=
+ attribute colspan { text }?,
+ attribute rowspan { text }?,
+ attribute nowrap { text }?,
+ [ a:defaultValue = "left" ]
+ attribute align { "left" | "center" | "right" }?
+ul = element ul { ul.attlist, li+ }
+ul.attlist &= empty
+ol = element ol { ol.attlist, li+ }
+ol.attlist &= empty
+li = element li { li.attlist, (text | all.class)* }
+li.attlist &= empty
+dl = element dl { dl.attlist, (dt, dd)+ }
+dl.attlist &= empty
+dt = element dt { dt.attlist, (text | inline.class)* }
+dt.attlist &= empty
+# The following is strange, but devbook.xsl expects only p elements
+dd = element dd { dd.attlist, p+ }
+dd.attlist &= empty
+list-group-u =
+ element list-group-u { list-group-u.attlist, (text | all.class)* }
+list-group-u.attlist &= empty
+list-group-d =
+ element list-group-d { list-group-d.attlist, (text | all.class)* }
+list-group-d.attlist &= empty
+sup = element sup { sup.attlist, (text | inline.class)* }
+sup.attlist &= empty
+sub = element sub { sub.attlist, (text | inline.class)* }
+sub.attlist &= empty
+b = element b { b.attlist, (text | inline.class)* }
+b.attlist &= empty
+c = element c { c.attlist, (text | inline.class)* }
+c.attlist &= empty
+e = element e { e.attlist, (text | inline.class)* }
+e.attlist &= empty
+path = element path { path.attlist, (text | inline.class)* }
+path.attlist &= empty
+d = element d { d.attlist, empty }
+d.attlist &= empty
+uri = element uri { uri.attlist, (text | inline.class)* }
+uri.attlist &= attribute link { text }?
+start = guide
diff --git a/schemas.xml b/schemas.xml
index 14927b1..7db46ae 100644
--- a/schemas.xml
+++ b/schemas.xml
@@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<locatingRules xmlns="http://thaiopensource.com/ns/locating-rules/1.0">
+ <!-- rng-loc.el cannot combine rules, so unfortunately we cannot
+ select a schema by both document element and filename pattern -->
+ <!-- First match, so make sure that "text.xml" is before "guide" -->
+ <uri pattern="text.xml" uri="devbook.rnc" />
<documentElement localName="catmetadata" uri="metadata.rnc" />
<documentElement localName="glsa" uri="glsa.rnc" />
<documentElement localName="guide" uri="guide.rnc" />