mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Ignore <a> tags if link-levels is negative.
This commit is contained in:
parent
7126b6ca81
commit
0cf1163000
@ -586,7 +586,7 @@ class HTMLConverter(object):
|
|||||||
|
|
||||||
if tagname in ["title", "script", "meta", 'del', 'frameset']:
|
if tagname in ["title", "script", "meta", 'del', 'frameset']:
|
||||||
pass
|
pass
|
||||||
elif tagname == 'a':
|
elif tagname == 'a' and self.max_link_levels >= 0:
|
||||||
if tag.has_key('name'):
|
if tag.has_key('name'):
|
||||||
self.current_para.append_to(self.current_block)
|
self.current_para.append_to(self.current_block)
|
||||||
self.current_block.append_to(self.current_page)
|
self.current_block.append_to(self.current_page)
|
||||||
@ -832,7 +832,8 @@ def main():
|
|||||||
parser.add_option('--link-levels', action='store', type='int', default=sys.maxint, \
|
parser.add_option('--link-levels', action='store', type='int', default=sys.maxint, \
|
||||||
dest='link_levels',
|
dest='link_levels',
|
||||||
help='''The maximum number of levels to recursively process
|
help='''The maximum number of levels to recursively process
|
||||||
links. A value of 0 means thats links are not processed.''')
|
links. A value of 0 means thats links are not followed.
|
||||||
|
A negative value means that <a> tags are ignored.''')
|
||||||
options, args = parser.parse_args()
|
options, args = parser.parse_args()
|
||||||
if len(args) != 1:
|
if len(args) != 1:
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user