Say I have the following reST input:
Some text ...
:foo: bar
Some text ...
What I would like to end up with is a dict like this:
{"foo": "bar"}
I tried to use this:
tree = docutils.core.publish_parts(text)
It does parse the field list, but I end up with some pseudo XML in tree["whole"]?
:
<document source="<string>">
<docinfo>
<field>
<field_name>
foo
<field_body>
<paragraph>
bar
Since the tree
dict does not contain any other useful information and that is just a string, I am not sure how to parse the field list out of the reST document. How would I do that?