diff --git a/src/calibre/ebooks/lrf/__init__.py b/src/calibre/ebooks/lrf/__init__.py index 03d59d825d..2f0e868341 100644 --- a/src/calibre/ebooks/lrf/__init__.py +++ b/src/calibre/ebooks/lrf/__init__.py @@ -163,7 +163,7 @@ def option_parser(usage, gui_mode=False): help=_('''The regular expression used to detect chapter titles.''' ''' It is searched for in heading tags (h1-h6). Defaults to %default''')) chapter.add_option('--chapter-attr', default='$,,$', - help=_('Detect a chapter beginning at an element having the specified attribute. The format for this option is tagname regexp,attribute name,attribute value regexp. For example to match all heading tags that have the attribute class="chapter" you would use "h\d,class,chapter". Default is %default''')) + help=_('Detect a chapter beginning at an element having the specified attribute. The format for this option is tagname regexp,attribute name,attribute value regexp. For example to match all heading tags that have the attribute class="chapter" you would use "h\d,class,chapter". You can set the attrivute to "none" to match only on tag names. So for example, to match all

tags, you would use "h2,none,". Default is %default''')) chapter.add_option('--page-break-before-tag', dest='page_break', default='h[12]', help=_('''If html2lrf does not find any page breaks in the ''' '''html file and cannot detect chapter headings, it will ''' diff --git a/src/calibre/ebooks/lrf/html/convert_from.py b/src/calibre/ebooks/lrf/html/convert_from.py index 9ffb9e6398..29701e1042 100644 --- a/src/calibre/ebooks/lrf/html/convert_from.py +++ b/src/calibre/ebooks/lrf/html/convert_from.py @@ -1446,10 +1446,11 @@ class HTMLConverter(object, LoggingInterface): pass if not self.disable_chapter_detection and \ (self.chapter_attr[0].match(tagname) and \ - tag.has_key(self.chapter_attr[1]) and \ - self.chapter_attr[2].match(tag[self.chapter_attr[1]])): + (self.chapter_attr[1].pattern.lower() == 'none' or \ + (tag.has_key(self.chapter_attr[1]) and \ + self.chapter_attr[2].match(tag[self.chapter_attr[1]])))): self.log_debug('Detected chapter %s', tagname) - self.end_page() + self.end_page() self.page_break_found = True if self.options.add_chapters_to_toc: