reST Wiki mode, was [Doc-SIG] Suggestions for reST "modes"

Garth T Kidd garth@deadlybloodyserious.com
Fri, 10 Aug 2001 15:13:08 +1000


>> For pragma directives, if the directive is not recognised, I think
>> that the directive *itself* should be emitted as a <literal> node,
>> and that it should be flagged as an Error. That gives the user some
>> hint of why their document looks odd (!).
>
> Yes, this is the plan.

How do we dodge the reversability problem for that one?

Here's a literal block:

$ ./quicktest.py
::

  This is a literal block.
=>
<document>
    <literal_block>
        This is a literal block.
    </literal_block>
</document>


So, to *reverse* that, we spit out the literal block delimiter at the
current indentation level (0), indent, and then spit out the contents of
the literal block. Cool.

Now let's try an unrecognised directive:

$ ./quicktest.py
.. disguised::
=>
<document>
    <directive type="disguised"/>
</document>

If we spit the directive itself out in a literal block if it's not
recognised, we'd get something like:

<document>
    <literal_block>
        .. disguised::
    </literal_block>
</document>

... which would reverse to ``::``, a blank line, and the directive as
some text in a literal block.

Oops.

I think we're better off spitting out the directive tag with some kind
of "unrecognised" attribute, its argument as the argument attribute, and
its *contents* as a literal block.

Regards,
Garth.