On Fri, Dec 06, 2002 at 10:21:03PM -0500, Steve Howell wrote:
> I parsed the YAML spec and dumped it in YAML:
>
> http://mountainwebtools.com/PyYaml/yamlspec.htm
This isn't really the right way to do it. Rather than dumping the YAML spec
to YAML, you've just translated an HTML document into YAML. All of the real
logical structure (ie. productions, examples, descriptions, sections) is
lost. You can't, for example, pull all the productions out of that document
in any usable form any easier than you could from the original HTML.
I'm thinking something more along the lines illustrated in the example
below. I'll only sketch out a little bit but I think you can get the idea.
Links around are merely aliases and anchors. Productions are presented as
one big list up front to make them easy to pull out and then simply
referenced as aliases throughout the rest of the text. The basic structure
of the document is just a list of lists. Presentation is completely a
decision of the reader and there should be enough data in the spec to
reproduce the existing HTML almost exactly.
Something like that anyway. I'll keep poking at it.
---
productions:
- &prod001
name: printable_char
desc: |
characters as defined by the Unicode standard, excluding most
control characters and the surrogate blocks
grammar: |
#x9 | #xA | #xD | #x85
| [#x20-#x7E]
| [#xA0-#xD7FF]
| [#xE000-#xFFFD]
| [#x10000-#x10FFFF]
- &prod002
...etc...
sections:
- name: Introduction
text: |
YAML Ain't Markup Language, abbreviated YAML, is both a
human-readable data serialization format and processing model.
This text describes the class of data objects called YAML document
streams and partially describes the behavior of computer programs
that process them.
YAML document streams encode in a textual form the native data
constructs of modern scripting languages. Strings, arrays, hashes,
and other user- defined data types are supported. A YAML document
stream consists of a sequence of characters, some of which are
considered part of the document's content, and others that are
used to indicate document structure.
YAML information can be viewed in two primary ways, for machine
processing and for human presentation. A YAML processor is a tool
for converting information between these complementary views. It
is assumed that a YAML processor does its work on behalf of
another module, called an application. This specification
describes the required behavior of a YAML processor. It describes
how a YAML processor must read or write YAML document streams and
the information structures it must provide to or obtain from the
application.
--
Michael G. Schwern <schwern@...> http://www.pobox.com/~schwern/
Perl Quality Assurance <perl-qa@...> Kwalitee Is Job One
Playstation? Of course Perl runs on Playstation.
-- Jarkko Hietaniemi
|