From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 1A862158087 for ; Mon, 24 Jan 2022 18:16:46 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 38D15E0769; Mon, 24 Jan 2022 18:16:45 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id B4F8CE0769 for ; Mon, 24 Jan 2022 18:16:44 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A0B92342B13 for ; Mon, 24 Jan 2022 18:16:43 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 45A10166 for ; Mon, 24 Jan 2022 18:16:42 +0000 (UTC) From: "Ulrich Müller" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Ulrich Müller" Message-ID: <1643048170.6ef11f64a2d763360542bd6a3c74da46f15dfa23.ulm@gentoo> Subject: [gentoo-commits] proj/devmanual:master commit in: / X-VCS-Repository: proj/devmanual X-VCS-Files: Makefile devbook.dtd devbook.rnc devbook.rng X-VCS-Directories: / X-VCS-Committer: ulm X-VCS-Committer-Name: Ulrich Müller X-VCS-Revision: 6ef11f64a2d763360542bd6a3c74da46f15dfa23 X-VCS-Branch: master Date: Mon, 24 Jan 2022 18:16:42 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: c86f92ac-5b09-4509-93b7-ef4dd57102c0 X-Archives-Hash: f0446572809bed5fa2a7d814c69429f0 commit: 6ef11f64a2d763360542bd6a3c74da46f15dfa23 Author: Ulrich Müller gentoo org> AuthorDate: Sun Jan 16 21:59:15 2022 +0000 Commit: Ulrich Müller gentoo org> CommitDate: Mon Jan 24 18:16:10 2022 +0000 URL: https://gitweb.gentoo.org/proj/devmanual.git/commit/?id=6ef11f64 devbook.rnc: Change from DTD to RELAX NG compact schema The currently used DTD format has several limitations. It does not support data types, and it is not expressive enough for some element syntax used in the devmanual. For example, it cannot accurately describe the uri element which comes in two alternative forms (namely, with the link in its body text or as an attribute). RELAX NG is chosen because it has a variant with a compact and very readable non-XML syntax, and it is well supported both as an input and as an output format by conversion tools like app-text/trang. Also, we need RNC for app-emacs/nxml-gentoo-schemas anyway. devbook.rnc is the source file, but the generated devbook.rng is also committed to the repository, in order to avoid an additional dependency on trang or rnc2rng. Signed-off-by: Ulrich Müller gentoo.org> Makefile | 10 +- devbook.dtd | 94 --------------- devbook.rnc | 113 ++++++++++++++++++ devbook.rng | 391 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 512 insertions(+), 96 deletions(-) diff --git a/Makefile b/Makefile index 2c7952a..cbb31e7 100644 --- a/Makefile +++ b/Makefile @@ -82,10 +82,16 @@ install: all install -m 644 $(JS_FILES) "$(DESTDIR)$(htmldir)"/; \ fi -validate: - @xmllint --noout --dtdvalid devbook.dtd $(XMLS) +# Not all versions of xmllint support --quiet, so test for it first +validate: devbook.rng + @opt=--quiet; xmllint --help 2>&1 | grep -q -- --quiet || opt=; \ + xmllint --noout $${opt} --relaxng $< $(XMLS) @echo "xmllint validation successful" +%.rng: %.rnc + trang $< $@ + sed -i -e '2s/^/\n/' $@ + # Run app-text/htmltidy on the output to detect mistakes. # We have to loop through them because otherwise tidy won't # tell you which file contains a mistake. diff --git a/devbook.dtd b/devbook.dtd deleted file mode 100644 index 77ba737..0000000 --- a/devbook.dtd +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/devbook.rnc b/devbook.rnc new file mode 100644 index 0000000..4ca931d --- /dev/null +++ b/devbook.rnc @@ -0,0 +1,113 @@ +# Copyright 2022 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 +inline.class = attrib.class | d | uri + +attrib = attrib.class* +inline = inline.class* +all = (block.class | inline.class)* + +start = guide + +guide = element guide { + (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 | contentsTree | 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 } +} + +contentsTree = element contentsTree { + attribute maxdepth { xsd:unsignedInt }?, + attribute root { text }?, + attribute extraction { text }? +} + +p = element p { inline } + +pre = element pre { text } + +codesample = element codesample { + attribute lang { "c" | "ebuild" | "make" | "m4" | "sgml" }, + attribute numbering { "lines" }?, + 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 { 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 { 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 } +d = element d { empty } + +uri = element uri { + # uri can have either an URI in the body text or a link attribute + xsd:anyURI + | (attribute link { text }, inline) +} diff --git a/devbook.rng b/devbook.rng new file mode 100644 index 0000000..660e4d2 --- /dev/null +++ b/devbook.rng @@ -0,0 +1,391 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + c + ebuild + make + m4 + sgml + + + + + lines + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + left + center + right + + + + + + + + + + + + + + + + + + + + + nowrap + + + + + + left + center + right + + + + + + + + + + + list-group + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +