8 May 22:27
Re: Querying valid children of an element?
From: Brad Smith <usernamenumber <at> gmail.com>
Subject: Re: Querying valid children of an element?
Newsgroups: gmane.comp.python.lxml.devel
Date: 2008-05-08 20:27:02 GMT
Subject: Re: Querying valid children of an element?
Newsgroups: gmane.comp.python.lxml.devel
Date: 2008-05-08 20:27:02 GMT
To clarify about what I'm doing. The goal is to have a shorthand
language (not entirely tag-based) that is easier for subject matter
experts to learn than docbook, which can then be converted into full
docbook once they've written a first draft. So, to illustrate one
aspect of it, instead of writing
<itemizedlist>
<listitem><para><command>foomaster</command> example...</para>
<itemizedlist>
<listitem><screen>$ foomaster [OPTIONS]</screen></listitem>
</itemizedlist>
</listitem>
</itemizedlist>
They can write
* <command>foomaster</command> example...
** <screen>$ foomaster [OPTIONS]</screen>
As you can see, the translation process consists of not just
converting asterisks into the appropriate combination of itemizedlists
and listitems, but also protecting cdata within paras where necessary.
In the first one, the interpreter sees that <command> isn't allowed
inside <listitem>, which is its cue to try inserting a <para>.
<screen> is allowed within <listitem>, so it does not insert a para.
Making that determination is what I'm trying to find the best approach
for.
Currently I use a function like this:
(Continue reading)
RSS Feed