History

Improve GitHub scraper

Thibaut Courouble committed 9 years ago

Commit 85fffdc1 parent 80cc88c4 files · +10 −10Browse files

Showing the changes to lib/docs (2 of 4 files). Show all

Unified · Split

2 files
  1. lib/docs/filters/github/clean_html.rb +5 −1
  2. lib/docs/filters/nginx_lua_module/clean_html.rb +4 −0
lib/docs/filters/github/clean_html.rb+5−1
@@ -8,11 +8,15 @@ module Docs · 7 unmodified lines
88 end
99
1010 css('.highlight > pre').each do |node|
11− node['class'] = node.parent['class']
11+ node['data-language'] = node.parent['class'][/highlight-source-(\w+)/, 1]
1212 node.content = node.content.strip_heredoc.gsub(' ', ' ')
1313 node.parent.replace(node)
1414 end
1515
16+ css('pre > code').each do |node|
17+ node.before(node.children).remove
18+ end
19+
1620 doc
1721 end
1822 end
lib/docs/filters/nginx_lua_module/clean_html.rb+4−0
@@ -8,6 +8,10 @@ module Docs · 7 unmodified lines
88 node.name = node.name.sub(/\d/) { |i| i.to_i + 1 }
99 end
1010
11+ css('a > img').each do |node|
12+ node.parent.before(node.parent.children).remove
13+ end
14+
1115 doc
1216 end
1317 end

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t