[EMAIL PROTECTED] schrieb:
> Thanks for the resolve_references() in environment.py hint. I followed
> that
> code and inserted my own references. Unfortunately the docutils/
> writers/html4css1/__init__.py
> chokes on that. The assertion below fails:
>
> def visit_reference(self, node):
> atts = {'class': 'reference'}
> if node.has_key('refuri'):
> atts['href'] = node['refuri']
> if ( self.settings.cloak_email_addresses
> and atts['href'].startswith('mailto:')):
> atts['href'] = self.cloak_mailto(atts['href'])
> self.in_mailto = 1
> atts['class'] += ' external'
> else:
> assert node.has_key('refid'), \
> 'References must have "refuri" or "refid"
> attribute.'
> atts['href'] = '#' + node['refid']
> atts['class'] += ' internal'
> if not isinstance(node.parent, nodes.TextElement):
> ---> assert len(node) == 1 and isinstance(node[0],
> nodes.image) <--- This one fails
> atts['class'] += ' image-reference'
> self.body.append(self.starttag(node, 'a', '', **atts))
>
> I tried to set the parent node of the reference node manually, but
> somehow it gets replaced.
> If I use the debugger an print node at that position I get:
>
> p node.parent
> <section "todo list":
> <title...><paragraph...><todoNode...><reference...><todo ...>
>
> Here is how I construct the reference in the process_todolist
> callback:
>
> r = []
> for (docname, todoNode, target) in env.all_todos:
>
> newnode = nodes.reference('', '')
> innernode = nodes.emphasis("Dummy", "Dummy")
> newnode['refdocname'] = docname
> newnode['refuri'] = "../not/yet/correct/TBD#soon"
> newnode.append(innernode)
> r += [newnode, todoNode.deepcopy()]
> node.replace_self(r)
>
> I basically copied that from environment.py . Did I miss something
> there? Any ideas?
I'm not sure right now, but I'd try putting the new reference into a
paragraph node of its own.
Georg
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sphinx-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sphinx-dev?hl=en
-~----------~----~----~----~------~----~------~--~---