Hey,

I recently wanted to modify the child_text_separator for a parameterlist
I was generating.  The language I'm trying to generate the list for is a
lisp so it doesn't use comma separators instead it uses spaces.

Originally I set the separator attribute directly on each instance.

n = addnode.desc_parameterlist()
n.child_text_separator = " "

This works great but it only for the HTML builder.  After much messing
about in pdb I figured out that each of the other builders is causing a
deepcopy of the entire document, during this deepcopy all attributes
set on the instance are lost.  This is quite confusing behaviour.

In light of this the best solution I could come up with was to subclass
the desc_parameterlist but this wasn't really obvious to start with.

class desc_parameterlist(addnode.desc_parameterlist):
    child_text_separator = " "

The only other solution I could see would be to extend the monkeypatch
sphinx.util._new_copy to also copy this attribute.  But is there a
better place that these node customisations can be stored?  I see there
is an attribute dict on each node?  But I don't know enough about
docutils to be sure of it's purpose.  I'm happy to do some changes to
improve this situation if someone has a better idea about where these
should be stored on the nodes.

Cheers,
Russell

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sphinx-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to