Sorry, I guess I should have inspected the patch before sending it. New
patch attached.

Luke

On Sat, Dec 17, 2011 at 04:29, Antonio Valentino <
antonio.valent...@tiscali.it> wrote:

> Hi Luke,
>
> Il 14/12/2011 23:41, Luke Campagnola ha scritto:
> > Howdy,
> > I've attached a patch to the qthelp builder that causes new <keyword>
> tags
> > to be generated in the .qhp output for all of the reference labels in the
> > document. These tags have id attributes but no name attributes so they do
> > not show up in the keyword index. This allows programs using qthelp to
> open
> > specific sections of the help document by their reference label.
> >
> > For example, a label like
> >     .. _my_label:
> > in the .rst source can be accessed via Qt with
> >     helpEngine.linksForIdentifier("my_label")
> >
> > I have no idea if I have done this 'correctly' but it seems to work on my
> > end.
> >
> >
> > Luke
> >
>
> I would like to give a try to your patch but I need a little bit of
> context in order to apply it correctly.
>
> Can you please generate the patch using "hg diff" or "diff -u"?
>
> best regards
>
> --
> Antonio Valentino
>
> --
> 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
> sphinx-dev+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/sphinx-dev?hl=en.
>
>

-- 
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 
sphinx-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.

--- qthelp.py.orig	2011-12-14 16:06:04.000000000 -0500
+++ qthelp.py	2011-12-14 17:38:00.000000000 -0500
@@ -139,6 +139,17 @@
         for (key, group) in index:
             for title, (refs, subitems) in group:
                 keywords.extend(self.build_keywords(title, refs, subitems))
+                
+        # ID keywords from xref labels
+        for domainname, domain in self.env.domains.iteritems():
+            for name, dispname, type, docname, anchor, prio in domain.get_objects():
+                if anchor == "":
+                    continue
+                uri = self.get_target_uri(docname) + '#' + anchor
+                item = ' '*12 + '<keyword id="%s" ref="%s"/>' % (name, uri)
+                item.encode('ascii', 'xmlcharrefreplace')
+                keywords.append(item)
+                
         keywords = '\n'.join(keywords)
 
         # files

Reply via email to