[Enhancement] Filter dupes in TOC editor

Bug #1735799 reported by John Matushek
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Fix Released
Undecided
Unassigned

Bug Description

In the TOC editor, I frequently use the feature to generate TOC entries from XPath. For example, I might use the regular expression ^(contents|prolog|chapter|section|epilog) in the "value" field of the HTML tag prompt. However, this frequently finds duplicate entries. I presume that's because of nesting of the HTML, so the TOC editor gets multiple hits. Normally I just allow it to generate, then delete the duplicates, which can be very tedious. It would be much easier if the system would detect duplicates and filter them for me. I don't care if it's an option or a permanent feature of the XPath editor.

Revision history for this message
Kovid Goyal (kovid) wrote : Re: calibre bug 1735799

How are you defining a "duplicate"? Something with the same text? At the
same level? If you have multiple tag types with the same text in them, simply
specify a single tag type for the XPath expression.

Revision history for this message
John Matushek (johnmatushek) wrote :

Yes, I'm defining duplicate as an entry with the same text at the same level. (I rarely try to find multiple levels using the TOC editor.)

I guess I could use the tag type, but that involves opening the full book editor. In most cases, I simply use the TOC editor stand-alone, so there's no way to see the underlying HTML tags. Also, the conversion to HTML may not be consistent, so this technique might not always work.

I think the dupe-finding logic could be quite simple. I would not want to search for dupes across the entire document. It would be sufficient to eliminate all entries that are exactly the same as the prior entry.

Revision history for this message
Kovid Goyal (kovid) wrote : Fixed in master

Fixed in branch master. The fix will be in the next release. calibre is usually released every alternate Friday.

 status fixreleased

Changed in calibre:
status: New → Fix Released
Revision history for this message
Ben L (marvinnn) wrote :

Can you please make this an optional feature? I have frequently used the Generate ToC from XPath on books that have the same tag/string at the start of each chapter. I thought I was crazy today when it no longer worked the way it did last month until I read the changelog.

Revision history for this message
Kovid Goyal (kovid) wrote :

Sure shouldn't be hard to add an option. Can you open a separate ticket for it so I dont forget.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.