Skip to content

Commit f948577

Browse files
committed
Add Pony filters/scraper
1 parent b2608bb commit f948577

File tree

4 files changed

+45
-0
lines changed

4 files changed

+45
-0
lines changed

lib/docs/filters/pony/clean_html.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module Docs
2+
class Pony
3+
class CleanHtmlFilter < Filter
4+
def call
5+
css('.headerlink').remove
6+
doc
7+
end
8+
end
9+
end
10+
end

lib/docs/filters/pony/container.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module Docs
2+
class Pony
3+
class ContainerFilter < Filter
4+
def call
5+
css('article')
6+
end
7+
end
8+
end
9+
end

lib/docs/filters/pony/entries.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module Docs
2+
class Pony
3+
class EntriesFilter < Docs::EntriesFilter
4+
def get_name
5+
binding.pry
6+
context[:html_title].sub(/ - .*/, '')
7+
end
8+
9+
def get_type
10+
subpath.split('-')[0][1..-1]
11+
end
12+
end
13+
end
14+
end

lib/docs/scrapers/pony.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module Docs
2+
class Pony < UrlScraper
3+
self.type = 'pony'
4+
self.release = '0.25.0'
5+
self.base_url = 'http://localhost:2015'
6+
#self.base_url = 'https://stdlib.ponylang.io/'
7+
8+
html_filters.push 'pony/container', 'pony/entries', 'pony/clean_html'
9+
options[:attribution] = "Me"
10+
options[:follow_links] = ->(filter) { filter.subpath !~ /src/ }
11+
end
12+
end

0 commit comments

Comments
 (0)