Browse Source

Fix small issues with HAProxy scraper

Phil Scherer 5 years ago
parent
commit
a86391bf29

+ 5 - 1
lib/docs/filters/haproxy/clean_html.rb

@@ -2,7 +2,7 @@ module Docs
   class Haproxy
     class CleanHtmlFilter < Filter
       def call
-        css('br', 'hr' '.text-right', '.dropdown-menu', 'table.summary').remove
+        css('br, hr, .text-right, .dropdown-menu, table.summary').remove
         css('.alert-success > img[src$="check.png"]').remove
         css('.alert-error > img[src$="cross.png"]').remove
 
@@ -29,6 +29,10 @@ module Docs
           node['id'] = node.at_css('.anchor')['name']
         end
 
+        css('.keyword > b').each do |node|
+          node.content = node.content
+        end
+
         css('.dropdown').each do |node|
           node.content = node.content
         end

+ 1 - 1
lib/docs/filters/haproxy/entries.rb

@@ -33,7 +33,7 @@ module Docs
           elsif node.name == 'div'
             node.css('.keyword').each do |n|
               name = n.at_css('b').content
-              id = n.at_css('a.anchor')['name']
+              id = n['id']
               entries << [name, URI.escape(id), REPLACE_TYPE[type] || type]
             end
           end

+ 1 - 0
lib/docs/scrapers/haproxy.rb

@@ -1,5 +1,6 @@
 module Docs
   class Haproxy < UrlScraper
+    self.name = 'HAProxy'
     self.type = 'haproxy'
     self.root_path = 'intro.html'
     self.initial_paths = %w(intro.html configuration.html management.html)