diff --git a/lib/docs/filters/cordova/clean_html_core.rb b/lib/docs/filters/cordova/clean_html_core.rb new file mode 100644 index 00000000..c8625486 --- /dev/null +++ b/lib/docs/filters/cordova/clean_html_core.rb @@ -0,0 +1,11 @@ +module Docs + class Cordova + class CleanHtmlCoreFilter < Filter + def call + css('script', 'style', 'link').remove + xpath('descendant::comment()').remove + doc + end + end + end +end diff --git a/lib/docs/filters/core/clean_html.rb b/lib/docs/filters/core/clean_html.rb index c8a7cfc1..f17333c0 100644 --- a/lib/docs/filters/core/clean_html.rb +++ b/lib/docs/filters/core/clean_html.rb @@ -8,7 +8,6 @@ module Docs xpath('./text()', './/text()[not(ancestor::pre) and not(ancestor::code) and not(ancestor::div[contains(concat(" ", normalize-space(@class), " "), " prism ")])]').each do |node| content = node.content next unless content.valid_encoding? - next if context[:clean_html_maintain_nbsp] && !content.index(" ").nil? content.gsub! %r{[[:space:]]+}, ' ' node.content = content end diff --git a/lib/docs/scrapers/cordova.rb b/lib/docs/scrapers/cordova.rb index 0ef04571..5cf0bf90 100644 --- a/lib/docs/scrapers/cordova.rb +++ b/lib/docs/scrapers/cordova.rb @@ -8,10 +8,10 @@ module Docs code: 'https://github.com/apache/cordova' } + html_filters.replace 'clean_html', 'cordova/clean_html_core' html_filters.push 'cordova/entries', 'cordova/clean_html' options[:container] = '.docs' - options[:clean_html_maintain_nbsp] = true options[:skip] = %w(index.html) options[:fix_urls] = ->(url) do