diff --git a/assets/images/docs-2.png b/assets/images/docs-2.png index d89c62d8..827661fd 100644 Binary files a/assets/images/docs-2.png and b/assets/images/docs-2.png differ diff --git a/assets/images/docs-2@2x.png b/assets/images/docs-2@2x.png index b24abf3d..edc4fa03 100644 Binary files a/assets/images/docs-2@2x.png and b/assets/images/docs-2@2x.png differ diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json index 2fc087ef..ea2659cb 100644 --- a/assets/javascripts/news.json +++ b/assets/javascripts/news.json @@ -1,5 +1,8 @@ [ [ + "2017-06-04", + "New documentation: Pug" + ], [ "2017-05-14", "New documentations: Jest, Jasmine and Liquid" ], [ diff --git a/assets/stylesheets/application-dark.css.scss b/assets/stylesheets/application-dark.css.scss index f1ec234e..cc7a44c6 100644 --- a/assets/stylesheets/application-dark.css.scss +++ b/assets/stylesheets/application-dark.css.scss @@ -76,6 +76,7 @@ 'pages/php', 'pages/phpunit', 'pages/postgres', + 'pages/pug', 'pages/ramda', 'pages/rdoc', 'pages/react', diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index f24534ac..409a62ba 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -76,6 +76,7 @@ 'pages/php', 'pages/phpunit', 'pages/postgres', + 'pages/pug', 'pages/ramda', 'pages/rdoc', 'pages/react', diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss index 7f8d8f7f..ff754bc8 100644 --- a/assets/stylesheets/global/_icons.scss +++ b/assets/stylesheets/global/_icons.scss @@ -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; } diff --git a/assets/stylesheets/pages/_pug.scss b/assets/stylesheets/pages/_pug.scss new file mode 100644 index 00000000..820c9211 --- /dev/null +++ b/assets/stylesheets/pages/_pug.scss @@ -0,0 +1,9 @@ +._pug { + @extend %simple; + + .alert { @extend %note; } + .alert-danger { @extend %note-orange; } + .alert h6 { margin-top: .25rem; } + + h4 > code { @extend %label; } +} diff --git a/lib/docs/filters/pug/clean_html.rb b/lib/docs/filters/pug/clean_html.rb new file mode 100644 index 00000000..3f0807be --- /dev/null +++ b/lib/docs/filters/pug/clean_html.rb @@ -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 diff --git a/lib/docs/filters/pug/entries.rb b/lib/docs/filters/pug/entries.rb new file mode 100644 index 00000000..dac34ff3 --- /dev/null +++ b/lib/docs/filters/pug/entries.rb @@ -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 diff --git a/lib/docs/scrapers/pug.rb b/lib/docs/scrapers/pug.rb new file mode 100644 index 00000000..e7a3a21c --- /dev/null +++ b/lib/docs/scrapers/pug.rb @@ -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
+ Licensed under the MIT license. + HTML + + private + + def parse(response) # Hook here because Nokogori removes whitespace from textareas + response.body.gsub! %r{]*>([\W\w]+?)}, '
\1
' + super + end + end +end diff --git a/public/icons/docs/pug/16.png b/public/icons/docs/pug/16.png new file mode 100644 index 00000000..2a73c068 Binary files /dev/null and b/public/icons/docs/pug/16.png differ diff --git a/public/icons/docs/pug/16@2x.png b/public/icons/docs/pug/16@2x.png new file mode 100644 index 00000000..f3912a4b Binary files /dev/null and b/public/icons/docs/pug/16@2x.png differ diff --git a/public/icons/docs/pug/SOURCE b/public/icons/docs/pug/SOURCE new file mode 100644 index 00000000..3187ba06 --- /dev/null +++ b/public/icons/docs/pug/SOURCE @@ -0,0 +1 @@ +https://github.com/pugjs/pug-www/blob/master/htdocs/images/logo.svg