Re: [docbook] Help advance DocBook standard
flyx <[email protected]> Tue, 24 Oct 2017 10:57:02 +0200
| Newsgroups | gmane.text.yaml.general |
|---|---|
| Message-ID | <[email protected]> |
On 2017-10-24 05:31, Zenaan Harkness wrote:
> We loves YAML we do, we wants it for EVERYTHING.
> Yess my precious, everything‼
>
>
> DocBook is unlikely to switch markup language (again - it already did
> once from SGML (lisp brackets) to XML), but the thought arises, could
> YAML be suitable for such a task, or would inline markup (e.g.
> specific words in a paragraph) be too much of a challenge?
YAML is definitely not the right tool for this. Both SGML and XML allow
a mixture of raw content and child nodes at any level beyond the root.
This is not something you could easily emulate with YAML. Let us have a
look at a very simple example:
<document>
<p>Here be text.</p>
</document>
(Forgive me for not using DocBook's tags, I would have to look them up.)
This could be translated into YAML like this:
document:
p: Here be text.
Does not look that bad. However, let us see what happens when we use
inline markup:
<document>
<p>Here be <b>bold</b> text.</p>
</document>
To adapt our YAML, we now need to transform p's content into a sequence:
document:
p:
- Here be
- b: bold
- text.
No-one wants to write documents like that. Let use have a look at an
alternative approach, using some more sophisticated YAML:
--- !document
- !p [Here be, !b bold, text.]
I fixed an error I made earlier: The document should not be a YAML
mapping
because a) YAML defines mapping keys to be unordered while in XML, child
nodes are always ordered and b) this would make in impossible to have to
'p's
inside the document. So instead, I translate every level into a YAML
sequence
and give their node name as YAML tag.
The resulting YAML above does not seem to be something that can easily
be
written without errors when it comes to complex documents. Using flow
sequences does enable one to do inline markup as shown above, but it
also
makes the comma a special character which I would imagine is very
annoying
for writing documents.
To some up: YAML is ill-suited for authoring DocBook documents. It can
be
done, but I do only see disadvantages compared to XML.
Cheers,
Felix
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Yaml-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/yaml-core