mirror of https://github.com/freeCodeCamp/devdocs
parent
2fbacc5d60
commit
f0125e55ae
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 27 KiB |
@ -0,0 +1,9 @@
|
||||
._pug {
|
||||
@extend %simple;
|
||||
|
||||
.alert { @extend %note; }
|
||||
.alert-danger { @extend %note-orange; }
|
||||
.alert h6 { margin-top: .25rem; }
|
||||
|
||||
h4 > code { @extend %label; }
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
module Docs
|
||||
class Pug
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
@doc = at_css('.main')
|
||||
|
||||
at_css('h1').content = 'Pug Documentation' if root_page?
|
||||
|
||||
if slug == 'api/reference'
|
||||
at_css('.alert-info').remove
|
||||
end
|
||||
|
||||
css('.header-anchor').remove
|
||||
|
||||
css('.preview-wrapper').each do |node|
|
||||
node.css('pre').each do |n|
|
||||
node.before(n)
|
||||
end
|
||||
node.remove
|
||||
end
|
||||
|
||||
css('pre').each do |node|
|
||||
node.content = node.content
|
||||
end
|
||||
|
||||
doc
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,27 @@
|
||||
module Docs
|
||||
class Pug
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
def get_name
|
||||
at_css('h1').content
|
||||
end
|
||||
|
||||
def get_type
|
||||
if subpath.start_with?('language')
|
||||
'Language'
|
||||
elsif subpath.start_with?('api')
|
||||
'API'
|
||||
end
|
||||
end
|
||||
|
||||
def additional_entries
|
||||
return [] unless slug == 'api/reference'
|
||||
|
||||
css('h3').each_with_object [] do |node, entries|
|
||||
name = node.content
|
||||
name.sub! %r{\(.*\)}, '()'
|
||||
entries << [name, node['id']]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,28 @@
|
||||
module Docs
|
||||
class Pug < UrlScraper
|
||||
self.type = 'pug'
|
||||
self.base_url = 'https://pugjs.org/'
|
||||
self.root_path = 'api/getting-started.html'
|
||||
self.release = '2.0.0-rc.2'
|
||||
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
|
||||
© Pug authors<br>
|
||||
Licensed under the MIT license.
|
||||
HTML
|
||||
|
||||
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
|
After Width: | Height: | Size: 536 B |
After Width: | Height: | Size: 1.3 KiB |
@ -0,0 +1 @@
|
||||
https://github.com/pugjs/pug-www/blob/master/htdocs/images/logo.svg
|
Loading…
Reference in new issue