devdocs/lib/docs/scrapers/pug.rb

37 lines
841 B
Ruby
Raw Normal View History

2017-06-04 21:39:28 +02:00
module Docs
class Pug < UrlScraper
self.type = 'pug'
self.base_url = 'https://pugjs.org/'
self.root_path = 'api/getting-started.html'
2020-11-13 21:07:44 +01:00
self.release = '3.0.0'
2017-06-04 21:39:28 +02:00
self.links = {
home: 'https://pugjs.org/',
code: 'https://github.com/pugjs/pug'
}
html_filters.push 'pug/clean_html', 'pug/entries'
options[:container] = 'body > .container'
options[:attribution] = <<-HTML
&copy; Pug authors<br>
Licensed under the MIT license.
HTML
2020-11-13 21:07:44 +01:00
options[:skip_patterns] = [
/support/
]
2019-03-10 03:02:24 +01:00
def get_latest_version(opts)
get_npm_version('pug', opts)
end
2017-06-04 21:39:28 +02:00
private
def parse(response) # Hook here because Nokogori removes whitespace from textareas
response.body.gsub! %r{<textarea\ [^>]*>([\W\w]+?)</textarea>}, '<pre>\1</pre>'
super
end
end
end