Field lists for directive attributes?
reStructuredText's image and figure directives currently use a specialized "[name=value]" attribute specification syntax:: .. image:: picture.png [height=100 width=200 scale=50 alt="alternate text"] There's a mini-parser called "dps.utils.parseattributes". It does a decent job, but it can't handle complex stuff like:: [alt="Joe \"Bulldog\" O'Roarke"] I'm thinking of replacing the "[name=value]" syntax with field lists for attributes:: .. image:: picture.png :height: 100 :width: 200 :scale: 50 :alt: alternate text Advantages: standard syntax (less to remember), easier implementation, more straightforward, more robust, more flexible, emphasizes role of field lists as "extension/specialized syntax" (as currently used in bibliographic field lists and the "meta" directive). Disadvantage: more verbose. It seems useful to standardize on a single syntax, which may be used in other directives in the future. Throwing away the current system and reusing field lists appeals to me on minimalistic principles. Any objections or alternate ideas? -- David Goodger goodger@users.sourceforge.net Open-source projects: - Python Docstring Processing System: http://docstring.sourceforge.net - reStructuredText: http://structuredtext.sourceforge.net - The Go Tools Project: http://gotools.sourceforge.net
Garth Kidd wrote:
How does someone specify \n in a field?
:: :name: field body There's a newline between "field" and "body". So let me anticipate the next question: "How does someone specify *only* \n in a field?" Can't. Not without some directive/substitution trickery, anyhow. Hmm. Maybe this? :: :name: \ I don't know what the parser as written would do with it.
<grins, ducks, runs>
You cheeky devil. -- David Goodger goodger@users.sourceforge.net Open-source projects: - Python Docstring Processing System: http://docstring.sourceforge.net - reStructuredText: http://structuredtext.sourceforge.net - The Go Tools Project: http://gotools.sourceforge.net
participants (2)
-
David Goodger -
Garth Kidd