Browse Source

cordova: do not clean  

Do not use core/clean_html filter.
Simon Legner 1 year ago
parent
commit
63dd3dce70

+ 11 - 0
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

+ 0 - 1
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

+ 1 - 1
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