diff --git a/assets/images/docs.png b/assets/images/docs.png index 443d6ae3..47f4b548 100644 Binary files a/assets/images/docs.png and b/assets/images/docs.png differ diff --git a/assets/images/docs@2x.png b/assets/images/docs@2x.png index fe55770b..399f5bef 100644 Binary files a/assets/images/docs@2x.png and b/assets/images/docs@2x.png differ diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json index daa5dbc2..ce6d7725 100644 --- a/assets/javascripts/news.json +++ b/assets/javascripts/news.json @@ -1,7 +1,7 @@ [ [ "2016-11-20", - "New documentation: Immutable.js" + "New documentations: Yarn and Immutable.js" ], [ "2016-10-10", "New documentations: scikit-learn and Statsmodels" diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 8d4ee90a..2290145c 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -574,6 +574,11 @@ credits = [ '2012-2016 Tobias Koppers', 'MIT', 'https://raw.githubusercontent.com/webpack/webpack/master/LICENSE' + ], [ + 'Yarn', + '2016 Yarn Contributors', + 'BSD', + 'https://raw.githubusercontent.com/yarnpkg/yarn/master/LICENSE' ], [ 'Yii', '2008-2016 by Yii Software LLC', diff --git a/assets/javascripts/views/pages/simple.coffee b/assets/javascripts/views/pages/simple.coffee index 9627c658..bf8a097b 100644 --- a/assets/javascripts/views/pages/simple.coffee +++ b/assets/javascripts/views/pages/simple.coffee @@ -60,5 +60,6 @@ app.views.UnderscorePage = app.views.VagrantPage = app.views.VuePage = app.views.WebpackPage = +app.views.YarnPage = app.views.YiiPage = app.views.SimplePage diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss index e193f036..fb876f5e 100644 --- a/assets/stylesheets/global/_icons.scss +++ b/assets/stylesheets/global/_icons.scss @@ -72,6 +72,7 @@ ._icon-angularjs:before { background-position: -9rem -1rem; } ._icon-coffeescript:before { background-position: 0 -2rem; @extend %darkIconFix !optional; } ._icon-ember:before { background-position: -1rem -2rem; } +._icon-yarn:before { background-position: -2rem -2rem; } ._icon-immutable:before { background-position: -3rem -2rem; @extend %darkIconFix !optional; } ._icon-jqueryui:before { background-position: -4rem -2rem; } ._icon-jquerymobile:before { background-position: -5rem -2rem; } diff --git a/assets/stylesheets/pages/_simple.scss b/assets/stylesheets/pages/_simple.scss index 1d15a1a4..f86fe1e4 100644 --- a/assets/stylesheets/pages/_simple.scss +++ b/assets/stylesheets/pages/_simple.scss @@ -36,6 +36,7 @@ ._redux, ._sinon, ._typescript, -._webpack { +._webpack, +._yarn { @extend %simple; } diff --git a/lib/docs/filters/yarn/clean_html.rb b/lib/docs/filters/yarn/clean_html.rb new file mode 100644 index 00000000..6aceb70a --- /dev/null +++ b/lib/docs/filters/yarn/clean_html.rb @@ -0,0 +1,56 @@ +module Docs + class Yarn + class CleanHtmlFilter < Filter + def call + root_page? ? root : other + doc + end + + def root + @doc = at_css('.hero + .container') + + at_css('.row').remove + css('> .container', 'hr').remove + + css('.row', '.col-lg-4', '.card-block').each do |node| + node.before(node.children).remove + end + + css('a.card').each do |node| + node.at_css('.float-right').replace %(
Read more) + node.before(node.children).remove + end + end + + def other + @doc = at_css('.guide') + + css('a.toc', '.nav-tabs', '#select-platform', '.guide-controls + .list-group', '.guide-controls').remove + + css('.guide-content', '.tabs', '.tab-content').each do |node| + node.before(node.children).remove + end + + unless at_css('h2') + css('h3', 'h4', 'h5').each do |node| + node.name = node.name.sub(/\d/) { |i| i.to_i - 1 } + end + end + + unless at_css('h3') + css('h4', 'h5').each do |node| + node.name = node.name.sub(/\d/) { |i| i.to_i - 1 } + end + end + + css('div.highlighter-rouge').each do |node| + node['data-language'] = node['class'][/language-(\w+)/, 1] if node['class'] + node.content = node.content.strip + node.name = 'pre' + end + + css('.highlighter-rouge').remove_attr('class') + end + end + end +end diff --git a/lib/docs/filters/yarn/entries.rb b/lib/docs/filters/yarn/entries.rb new file mode 100644 index 00000000..809bb1a6 --- /dev/null +++ b/lib/docs/filters/yarn/entries.rb @@ -0,0 +1,21 @@ +module Docs + class Yarn + class EntriesFilter < Docs::EntriesFilter + def get_name + name = at_css('h1').content + + unless type == 'CLI' + name.prepend "#{css('.guide-nav a').to_a.index(at_css('.guide-nav a.active')) + 1}. " + end + + name + end + + def get_type + type = at_css('.guide-nav a').content.strip + type.remove! ' Introduction' + type + end + end + end +end diff --git a/lib/docs/scrapers/yarn.rb b/lib/docs/scrapers/yarn.rb new file mode 100644 index 00000000..6f726abf --- /dev/null +++ b/lib/docs/scrapers/yarn.rb @@ -0,0 +1,24 @@ +module Docs + class Yarn < UrlScraper + self.type = 'yarn' + self.release = '0.17.6' + self.base_url = 'https://yarnpkg.com/en/docs/' + self.links = { + home: 'https://yarnpkg.com/', + code: 'https://github.com/yarnpkg/yarn' + } + + html_filters.push 'yarn/entries', 'yarn/clean_html', 'title' + + options[:root_title] = 'Yarn' + options[:trailing_slash] = false + + options[:skip] = %w(nightly) + options[:skip_patterns] = [/\Aorg\//] + + options[:attribution] = <<-HTML + © 2016 Yarn Contributors
+ Licensed under the BSD License. + HTML + end +end diff --git a/public/icons/docs/yarn/16.png b/public/icons/docs/yarn/16.png new file mode 100644 index 00000000..f34c007b Binary files /dev/null and b/public/icons/docs/yarn/16.png differ diff --git a/public/icons/docs/yarn/16@2x.png b/public/icons/docs/yarn/16@2x.png new file mode 100644 index 00000000..9782016d Binary files /dev/null and b/public/icons/docs/yarn/16@2x.png differ diff --git a/public/icons/docs/yarn/SOURCE b/public/icons/docs/yarn/SOURCE new file mode 100644 index 00000000..05dc98ef --- /dev/null +++ b/public/icons/docs/yarn/SOURCE @@ -0,0 +1 @@ +https://raw.githubusercontent.com/yarnpkg/website/master/favicon.ico