[rfc-i] sourcecode preparation

Paul Kyzivat pkyzivat at alum.mit.edu
Sat Feb 13 10:47:22 PST 2016

On 2/12/16 3:48 PM, Joe Hildebrand (jhildebr) wrote:
> Say my input XML3RFCv3 doc has this:
> <sourcecode src="foo/bar.py"/>
> Is it reasonable that the preptool might output this?
> <sourcecode name="bar.py" type="python">
> code here
> </sourcecode>
> If so, we would need to following two preptool rules:
> - If a <sourcecode> element contains a src attribute, but not a name attribute, copy the basename of the src attribute into the name attribute
> - If a <sourcecode> element contains a src attribute, but not a type attribute, and the preptool can tell what the type attribute should be from the filename in the src attribute, the tool MAY insert the correct type attribute.

This seems like a reasonable heuristic, with some caveats:

- ensure that the derived name doesn't conflict with any sourcecode name 
attribute elsewhere in the file. If there is a conflict, modify the 
derived filename, or omit it.

- it would be nice to verify that the inlined source indeed seems to by 
python code before committing to attach that type to it. (But this might 
be difficult to achieve in practice, since it might just be a fragment 
of code.)


More information about the rfc-interest mailing list