Add Pug documentation

pull/574/merge
Thibaut Courouble 8 years ago
parent 2fbacc5d60
commit f0125e55ae

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 27 KiB

@ -1,5 +1,8 @@
[
[
"2017-06-04",
"New documentation: <a href=\"/pug/\">Pug</a>"
], [
"2017-05-14",
"New documentations: <a href=\"/jest/\">Jest</a>, <a href=\"/jasmine/\">Jasmine</a> and <a href=\"/liquid/\">Liquid</a>"
], [

@ -76,6 +76,7 @@
'pages/php',
'pages/phpunit',
'pages/postgres',
'pages/pug',
'pages/ramda',
'pages/rdoc',
'pages/react',

@ -76,6 +76,7 @@
'pages/php',
'pages/phpunit',
'pages/postgres',
'pages/pug',
'pages/ramda',
'pages/rdoc',
'pages/react',

@ -172,3 +172,4 @@
._icon-angular:before { background-position: -8rem -1rem; @extend %doc-icon-2; }
._icon-love:before { background-position: -9rem -1rem; @extend %doc-icon-2; }
._icon-jasmine:before { background-position: 0 -2rem; @extend %doc-icon-2; }
._icon-pug:before { background-position: -1rem -2rem; @extend %doc-icon-2; }

@ -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
&copy; 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

@ -0,0 +1 @@
https://github.com/pugjs/pug-www/blob/master/htdocs/images/logo.svg
Loading…
Cancel
Save