Yes. That did the trick. I have cleaned up the code and have put a new version here:
http://pastebin.com/f71ba7373 It works quite well. And I think it is nearly finished. There are still some open issues 1) Backlinks don't work in the PDF version. 2) The todolist page does not get rebuilt if somewhere in the document new todos appear or a re removed. 3) The CSS needs to be adopted with a default layout of the todo admonitions. What do you think? Regards, Daniel On Nov 9, 1:48 pm, Georg Brandl <[EMAIL PROTECTED]> wrote: > [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 sphinx-dev@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---