Allow Python scraper to keep empty spans with ids

pull/2082/head
Tim Lim 1 year ago
parent 94bf820267
commit b46cb9598d

@ -36,9 +36,11 @@ module Docs
node.replace(pre) node.replace(pre)
end end
css('span[id]:empty').each do |node| unless context[:sphinx_keep_empty_ids]
(node.next_element || node.previous_element)['id'] ||= node['id'] if node.next_element || node.previous_element css('span[id]:empty').each do |node|
node.remove (node.next_element || node.previous_element)['id'] ||= node['id'] if node.next_element || node.previous_element
node.remove
end
end end
css('.section').each do |node| css('.section').each do |node|

@ -7,6 +7,12 @@ module Docs
code: 'https://github.com/python/cpython' code: 'https://github.com/python/cpython'
} }
# bypass the clean_text filter as it removes empty span with ids
options[:clean_text] = false
# bypass sphinx modifying empty ids
options[:sphinx_keep_empty_ids] = true
options[:skip_patterns] = [/whatsnew/] options[:skip_patterns] = [/whatsnew/]
options[:skip] = %w( options[:skip] = %w(
library/2to3.html library/2to3.html

Loading…
Cancel
Save