History

Refactor GitHub scraper code

Thibaut Courouble committed 10 years ago

Commit c5caeff1 parent ac3aaea9 files · +13 −31Browse files

Unified · Split

9 files
  1. assets/javascripts/views/pages/github.coffee +4 −1
  2. assets/javascripts/views/pages/javascript.coffee +0 −1
  3. assets/stylesheets/application-dark.css.scss +1 −1
  4. assets/stylesheets/application.css.scss +1 −1
  5. assets/stylesheets/pages/_base.scss +0 −1
  6. assets/stylesheets/pages/_github.scss +5 −0
  7. assets/stylesheets/pages/_q.scss +0 −5
  8. lib/docs/filters/q/clean_html.rb +0 −18
  9. lib/docs/scrapers/q.rb +2 −3
assets/javascripts/views/pages/github.coffee+4−1
@@ -1,6 +1,9 @@
1#= require views/pages/base1#= require views/pages/base
2 2
3class app.views.GithubPage extends app.views.BasePage3class app.views.GithubPage extends app.views.BasePage
4 LANGUAGE_RGX = /highlight-source-(\w+)/
5
4 prepare: ->6 prepare: ->
5 @highlightCode @findAll('pre.highlight-source-lua'), 'lua'7 for el in @findAll('pre.highlight')
8 @highlightCode(el, el.className.match(LANGUAGE_RGX)[1])
6 return9 return
assets/javascripts/views/pages/javascript.coffee+0−1
@@ -26,7 +26,6 @@ app.views.MomentPage = · 25 unmodified lines
26app.views.MongoosePage =26app.views.MongoosePage =
27app.views.NodePage =27app.views.NodePage =
28app.views.PhaserPage =28app.views.PhaserPage =
29app.views.QPage =
30app.views.RamdaPage =29app.views.RamdaPage =
31app.views.RethinkdbPage =30app.views.RethinkdbPage =
32app.views.SinonPage =31app.views.SinonPage =
assets/stylesheets/application-dark.css.scss+1−1
@@ -45,6 +45,7 @@ · 44 unmodified lines
45 'pages/erlang',45 'pages/erlang',
46 'pages/express',46 'pages/express',
47 'pages/git',47 'pages/git',
48 'pages/github',
48 'pages/go',49 'pages/go',
49 'pages/haskell',50 'pages/haskell',
50 'pages/jquery',51 'pages/jquery',
@@ -63,7 +64,6 @@ · 12 unmodified lines
63 'pages/php',64 'pages/php',
64 'pages/phpunit',65 'pages/phpunit',
65 'pages/postgres',66 'pages/postgres',
66 'pages/q',
67 'pages/ramda',67 'pages/ramda',
68 'pages/rdoc',68 'pages/rdoc',
69 'pages/react',69 'pages/react',
assets/stylesheets/application.css.scss+1−1
@@ -45,6 +45,7 @@ · 44 unmodified lines
45 'pages/erlang',45 'pages/erlang',
46 'pages/express',46 'pages/express',
47 'pages/git',47 'pages/git',
48 'pages/github',
48 'pages/go',49 'pages/go',
49 'pages/haskell',50 'pages/haskell',
50 'pages/jquery',51 'pages/jquery',
@@ -63,7 +64,6 @@ · 12 unmodified lines
63 'pages/php',64 'pages/php',
64 'pages/phpunit',65 'pages/phpunit',
65 'pages/postgres',66 'pages/postgres',
66 'pages/q',
67 'pages/ramda',67 'pages/ramda',
68 'pages/rdoc',68 'pages/rdoc',
69 'pages/react',69 'pages/react',
assets/stylesheets/pages/_base.scss+0−1
@@ -17,7 +17,6 @@ · 16 unmodified lines
17}17}
18 18
19._cordova,19._cordova,
20._github,
21._grunt,20._grunt,
22._less,21._less,
23._lodash,22._lodash,
assets/stylesheets/pages/_github.scss+5−0
@@ -0,0 +1,5 @@
1._github {
2 @extend %simple;
3
4 h4 { @extend %block-label; }
5}
assets/stylesheets/pages/_q.scss+0−5
@@ -1,5 +0,0 @@
1._q {
2 > h2, > h3 { @extend %block-heading; }
3 > h4 { @extend %block-label, %label-blue; }
4 code { @extend %label; }
5}
lib/docs/filters/q/clean_html.rb+0−18
@@ -1,18 +0,0 @@
1module Docs
2 class Q
3 class CleanHtmlFilter < Filter
4 def call
5 css('.anchor').each do |node|
6 node.parent['id'] = node['href'].remove('#')
7 node.remove
8 end
9
10 css('.highlight > pre').each do |node|
11 node.content = node.content.gsub(' ', ' ')
12 end
13
14 doc
15 end
16 end
17 end
18end
lib/docs/scrapers/q.rb+2−3
@@ -1,7 +1,6 @@
1module Docs1module Docs
2 class Q < UrlScraper2 class Q < Github
3 self.name = 'Q'3 self.name = 'Q'
4 self.type = 'q'
5 self.release = '1.4.1'4 self.release = '1.4.1'
6 self.base_url = 'https://github.com/kriskowal/q/wiki/'5 self.base_url = 'https://github.com/kriskowal/q/wiki/'
7 self.root_path = 'API-Reference'6 self.root_path = 'API-Reference'
@@ -10,7 +9,7 @@ module Docs · 2 unmodified lines
10 code: 'https://github.com/kriskowal/q'9 code: 'https://github.com/kriskowal/q'
11 }10 }
12 11
13 html_filters.push 'q/clean_html', 'q/entries', 'title'12 html_filters.push 'q/entries', 'title'
14 13
15 options[:container] = '.markdown-body'14 options[:container] = '.markdown-body'
16 options[:title] = 'Q'15 options[:title] = 'Q'