commit:     516a45ecf94530fc37b8b61ba297ab8595d38766
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 31 19:13:14 2024 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Thu Oct 31 19:13:14 2024 +0000
URL:        
https://gitweb.gentoo.org/proj/nxml-gentoo-schemas.git/commit/?id=516a45ec

devbook2.rnc: New file

Preparing to rename the document element from "guide" to "devbook".

Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 Makefile     |   2 +-
 devbook2.rnc | 131 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 schemas.xml  |   1 +
 3 files changed, 133 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index a3a384a..5f30260 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-RNCS = devbook.rnc glsa.rnc metadata.rnc mirrors.rnc projects.rnc \
+RNCS = devbook.rnc devbook2.rnc glsa.rnc metadata.rnc mirrors.rnc projects.rnc 
\
        repositories.rnc userinfo.rnc
 
 ifneq ($(PV),)

diff --git a/devbook2.rnc b/devbook2.rnc
new file mode 100644
index 0000000..0097a97
--- /dev/null
+++ b/devbook2.rnc
@@ -0,0 +1,131 @@
+# Copyright 2022-2024 Gentoo Authors
+# Distributed under the terms of the MIT license
+# or the CC-BY-SA-4.0 license (dual-licensed)
+
+# RELAX NG schema for the Gentoo Devmanual
+# Based on common.dtd from GuideXML
+
+block.class = p | pre | codesample | note | important | warning | todo
+| figure | table | ul | ol | dl
+attrib.class = text | b | c | e | sub | sup
+inline.class = attrib.class | d | uri
+
+attrib = attrib.class*
+inline = inline.class*
+all = (block.class | inline.class)*
+
+start = devbook
+
+devbook = element devbook {
+  (attribute root { "true" } | attribute self { text }),
+  chapter,
+  \include*
+}
+
+\include = element include { attribute href { text } }
+
+chapter = element chapter { title, (body | section), section* }
+section = element section { title, (body | subsection), subsection* }
+subsection =
+  element subsection { title, (body | subsubsection), subsubsection* }
+subsubsection = element subsubsection { title, body }
+
+# Title texts are used as anchors, so allow only text attributes
+title = element title { attrib }
+
+body = element body { (authors | contents | block.class)+ }
+
+authors = element authors { author+ | authorlist+ }
+
+author = element author {
+  attribute name { text },
+  attribute email { text }?,
+  inline
+}
+
+authorlist = element authorlist {
+  attribute title { text },
+  attribute href { text }
+}
+
+contents = element contents {
+  attribute maxdepth { xsd:unsignedInt }?,
+  attribute root { text }?,
+  attribute extraction { text }?
+}
+
+p = element p { inline }
+
+pre = element pre {
+  attribute caption { text }?,
+  text
+}
+
+codesample = element codesample {
+  attribute lang { "c" | "ebuild" | "make" | "m4" | "sgml" },
+  attribute numbering { "lines" }?,
+  attribute caption { text }?,
+  text
+}
+
+note = element note { inline }
+important = element important { inline }
+warning = element warning { inline }
+todo = element todo { inline }
+
+figure = element figure {
+  attribute link { text },
+  attribute short { text }?,
+  attribute caption { text }?
+}
+
+table = element table {
+  attribute caption { text }?,
+  tr+
+}
+
+tr = element tr { (th | ti)+ }
+
+th = element th {
+  attribute colspan { xsd:unsignedInt }?,
+  attribute rowspan { xsd:unsignedInt }?,
+  attribute align { "left" | "center" | "right" }?,
+  inline
+}
+
+ti = element ti {
+  attribute colspan { xsd:unsignedInt }?,
+  attribute rowspan { xsd:unsignedInt }?,
+  attribute nowrap { "nowrap" }?,
+  attribute align { "left" | "center" | "right" }?,
+  all
+}
+
+ul = element ul {
+  attribute class { "list-group" }?,
+  li+
+}
+
+ol = element ol {
+  attribute type { "1" | "A" | "a" | "I" | "i" }?,
+  li+
+}
+
+li = element li { all }
+
+dl = element dl { (dt | dd)+ }
+dt = element dt { inline }
+dd = element dd { all }
+
+b = element b { inline }
+c = element c { inline }
+e = element e { inline }
+sub = element sub { inline }
+sup = element sup { inline }
+d = element d { empty }
+
+uri = element uri {
+  # uri can have either a URI in the body text or a link attribute
+  xsd:anyURI
+  | (attribute link { text }, inline)
+}

diff --git a/schemas.xml b/schemas.xml
index 129b6bf..ce5c0d3 100644
--- a/schemas.xml
+++ b/schemas.xml
@@ -5,6 +5,7 @@
 -->
 <locatingRules xmlns="http://thaiopensource.com/ns/locating-rules/1.0";>
   <documentElement prefix="" localName="catmetadata" uri="metadata.rnc"/>
+  <documentElement prefix="" localName="devbook" uri="devbook2.rnc"/>
   <documentElement prefix="" localName="glsa" uri="glsa.rnc"/>
   <documentElement prefix="" localName="guide" uri="devbook.rnc"/>
   <!-- rng-loc.el cannot combine rules, so unfortunately we cannot

Reply via email to