[devdocsgjs/main: 1332/1867] Fix small issues with HAProxy scraper




commit a86391bf291f9c7716e88bd0553d1770d67d67af
Author: Phil Scherer <pnscher evoforge org>
Date:   Fri Dec 4 07:33:12 2020 +0000

    Fix small issues with HAProxy scraper

 lib/docs/filters/haproxy/clean_html.rb | 6 +++++-
 lib/docs/filters/haproxy/entries.rb    | 2 +-
 lib/docs/scrapers/haproxy.rb           | 1 +
 3 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/lib/docs/filters/haproxy/clean_html.rb b/lib/docs/filters/haproxy/clean_html.rb
index 5df47477..78f8e818 100755
--- a/lib/docs/filters/haproxy/clean_html.rb
+++ b/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
diff --git a/lib/docs/filters/haproxy/entries.rb b/lib/docs/filters/haproxy/entries.rb
index 167340fd..8a8d90ca 100755
--- a/lib/docs/filters/haproxy/entries.rb
+++ b/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
diff --git a/lib/docs/scrapers/haproxy.rb b/lib/docs/scrapers/haproxy.rb
index 0a3aa752..bc536d36 100644
--- a/lib/docs/scrapers/haproxy.rb
+++ b/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)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]