On Sun, Dec 18, 2011 at 06:56, Antonio Valentino
<antonio.valent...@tiscali.it> wrote:
> Not sure to understand correctly your purpose.
> Currently many (not all) of the keyword entries in the .qhp also have an
> "id" (I'm using the sphinx documentation for testing).
>
> Do you want to have different ids or you just need to add missing ones?

The <keyword> tags in Qt's .qhp files may contain an "id" attribute,
"name" attribute, or both. Anything with a "name" will be included in
the index when viewing the document. Anything with "id" may be called
internally by the program to display a specific section of the
document.

If I understand the qthelp builder correctly, its behavior is to turn
all sphinx index entries into .qhp keyword tags with a "name"
attribute. If the index entry looks like "indexEntry (location)", then
the resulting keyword tag will also have id=location. So this allows
the program to display a specific section of the document IF that
section also has an entry in the index. (please correct me if this is
incorrect)

My patch creates keyword tags from reference labels instead of index
entries. It sets the id attribute to the reference label name and does
not include a name attribute (so the keyword does not show up in the
index). This enables the program to display locations in the document
without requiring that they have a corresponding index entry.

It seems to me somewhat unnatural to create keyword IDs from the
"indexEntry (location)" format, but perhaps there is already a
precedent for this elsewhere? I find it much more natural in my
program to request document locations based on their reference label
rather than their index entry (but this is just my preference).

> Please note that the decision of add ng an id or not is currently made
> in the keyword_item( method
>
> https://bitbucket.org/birkenfeld/sphinx/src/65e4c29a24e4/sphinx/builders/qthelp.py#cl-253
>
> using the _idpattern regexp
>
> https://bitbucket.org/birkenfeld/sphinx/src/65e4c29a24e4/sphinx/builders/qthelp.py#cl-25
>

I saw that, but adding my functionality through the keword_item method
would have required more substantial reorganization of the existing
code (since the path build_keywords -> keyword_item is written
specifically for processing index entries, not reference labels). I
opted instead for a more minimal modification.

> In any case (both in the current implementation and with your patch) not
> all labels around in the doc are collected as keywords in qtdocs.

I think correcting this may be out of my reach at present--my
understanding of the Sphinx internals is quite poor. I may revisit the
issue later if it causes me trouble.


Cheers,
Luke

-- 
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.

Reply via email to