Re: Section titles, with or without multiple sections in document

David Goodger <[email protected]>
Newsgroups gmane.text.docutils.user
Message-ID <CABiJP=L1EQ7ewjFi990_7grV-PBLA=OdJPAo7ttWfrN2rc+YFA@mail.gmail.com>
On Tue, Jan 6, 2015 at 11:20 PM, Ben Finney <[email protected]> wrote:
> Ben Finney <[email protected]> writes:
>
>> But if the document has only one top-level section
>
> Sorry, I gave the wrong example. Here is an example that shows the
> behaviour:
>
>> the special case applies and I don't get the sections as I want:
>>
>> =====
>> $ cat foo.txt
>> First Section
>> =============
>>
>> Lorem ipsum, dolor sit amet.
>>
>> $ rst2pseudoxml < foo.txt
>> <document ids="first-section" names="first\ section" source="<stdin>" title="First Section">
>>     <title>
>>         First Section
>>     <paragraph>
>>         Lorem ipsum, dolor sit amet.
>> =====
>
> What I want is:
>
> =====
> $ rst2pseudoxml < foo.txt
> <document source="<stdin>">
>     <section ids="first-section" names="first\ section">
>         <title>
>             First Section
>         <paragraph>
>             Lorem ipsum, dolor sit amet.
> =====
>
> In fact, I'm accessing this document programmatically using a custom
> Writer. How can I get the parsing result I want?

http://docutils.sourceforge.net/docs/user/config.html#doctitle-xform

-- 
David Goodger <http://python.net/~goodger>

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.