History

Add Yarn documentation

Thibaut Courouble committed 9 years ago

Commit a0cfe451 parent fd1516813 files · +108 −-2Browse files

Unified · Split

13 files
  1. assets/images/docs.png +0 −0
  2. assets/images/docs@2x.png +0 −0
  3. assets/javascripts/news.json +1 −1
  4. assets/javascripts/templates/pages/about_tmpl.coffee +5 −0
  5. assets/javascripts/views/pages/simple.coffee +1 −0
  6. assets/stylesheets/global/_icons.scss +1 −0
  7. assets/stylesheets/pages/_simple.scss +2 −1
  8. lib/docs/filters/yarn/clean_html.rb +56 −0
  9. lib/docs/filters/yarn/entries.rb +21 −0
  10. lib/docs/scrapers/yarn.rb +24 −0
  11. public/icons/docs/yarn/16.png +0 −0
  12. public/icons/docs/yarn/16@2x.png +0 −0
  13. public/icons/docs/yarn/SOURCE +1 −0
assets/images/docs.png+0−0

Binary file not shown.

assets/images/docs@2x.png+0−0

Binary file not shown.

assets/javascripts/news.json+1−1
@@ -1,7 +1,7 @@
11 [
22 [
33 "2016-11-20",
4− "New documentation: <a href=\"/immutable/\">Immutable.js</a>"
4+ "New documentations: <a href=\"/yarn/\">Yarn</a> and <a href=\"/immutable/\">Immutable.js</a>"
55 ], [
66 "2016-10-10",
77 "New documentations: <a href=\"/scikit_learn/\">scikit-learn</a> and <a href=\"/statsmodels/\">Statsmodels</a>"
assets/javascripts/templates/pages/about_tmpl.coffee+5−0
@@ -574,6 +574,11 @@ credits = [ · 573 unmodified lines
574574 '2012-2016 Tobias Koppers',
575575 'MIT',
576576 'https://raw.githubusercontent.com/webpack/webpack/master/LICENSE'
577+ ], [
578+ 'Yarn',
579+ '2016 Yarn Contributors',
580+ 'BSD',
581+ 'https://raw.githubusercontent.com/yarnpkg/yarn/master/LICENSE'
577582 ], [
578583 'Yii',
579584 '2008-2016 by Yii Software LLC',
assets/javascripts/views/pages/simple.coffee+1−0
@@ -60,5 +60,6 @@ app.views.UnderscorePage = · 59 unmodified lines
6060 app.views.VagrantPage =
6161 app.views.VuePage =
6262 app.views.WebpackPage =
63+app.views.YarnPage =
6364 app.views.YiiPage =
6465 app.views.SimplePage
assets/stylesheets/global/_icons.scss+1−0
@@ -72,6 +72,7 @@ · 71 unmodified lines
7272 ._icon-angularjs:before { background-position: -9rem -1rem; }
7373 ._icon-coffeescript:before { background-position: 0 -2rem; @extend %darkIconFix !optional; }
7474 ._icon-ember:before { background-position: -1rem -2rem; }
75+._icon-yarn:before { background-position: -2rem -2rem; }
7576 ._icon-immutable:before { background-position: -3rem -2rem; @extend %darkIconFix !optional; }
7677 ._icon-jqueryui:before { background-position: -4rem -2rem; }
7778 ._icon-jquerymobile:before { background-position: -5rem -2rem; }
assets/stylesheets/pages/_simple.scss+2−1
@@ -36,6 +36,7 @@ · 35 unmodified lines
3636 ._redux,
3737 ._sinon,
3838 ._typescript,
39−._webpack {
39+._webpack,
40+._yarn {
4041 @extend %simple;
4142 }
lib/docs/filters/yarn/clean_html.rb+56−0
@@ -0,0 +1,56 @@
1+module Docs
2+ class Yarn
3+ class CleanHtmlFilter < Filter
4+ def call
5+ root_page? ? root : other
6+ doc
7+ end
8+
9+ def root
10+ @doc = at_css('.hero + .container')
11+
12+ at_css('.row').remove
13+ css('> .container', 'hr').remove
14+
15+ css('.row', '.col-lg-4', '.card-block').each do |node|
16+ node.before(node.children).remove
17+ end
18+
19+ css('a.card').each do |node|
20+ node.at_css('.float-right').replace %(<br><a href="#{node['href']}">Read more</a>)
21+ node.before(node.children).remove
22+ end
23+ end
24+
25+ def other
26+ @doc = at_css('.guide')
27+
28+ css('a.toc', '.nav-tabs', '#select-platform', '.guide-controls + .list-group', '.guide-controls').remove
29+
30+ css('.guide-content', '.tabs', '.tab-content').each do |node|
31+ node.before(node.children).remove
32+ end
33+
34+ unless at_css('h2')
35+ css('h3', 'h4', 'h5').each do |node|
36+ node.name = node.name.sub(/\d/) { |i| i.to_i - 1 }
37+ end
38+ end
39+
40+ unless at_css('h3')
41+ css('h4', 'h5').each do |node|
42+ node.name = node.name.sub(/\d/) { |i| i.to_i - 1 }
43+ end
44+ end
45+
46+ css('div.highlighter-rouge').each do |node|
47+ node['data-language'] = node['class'][/language-(\w+)/, 1] if node['class']
48+ node.content = node.content.strip
49+ node.name = 'pre'
50+ end
51+
52+ css('.highlighter-rouge').remove_attr('class')
53+ end
54+ end
55+ end
56+end
lib/docs/filters/yarn/entries.rb+21−0
@@ -0,0 +1,21 @@
1+module Docs
2+ class Yarn
3+ class EntriesFilter < Docs::EntriesFilter
4+ def get_name
5+ name = at_css('h1').content
6+
7+ unless type == 'CLI'
8+ name.prepend "#{css('.guide-nav a').to_a.index(at_css('.guide-nav a.active')) + 1}. "
9+ end
10+
11+ name
12+ end
13+
14+ def get_type
15+ type = at_css('.guide-nav a').content.strip
16+ type.remove! ' Introduction'
17+ type
18+ end
19+ end
20+ end
21+end
lib/docs/scrapers/yarn.rb+24−0
@@ -0,0 +1,24 @@
1+module Docs
2+ class Yarn < UrlScraper
3+ self.type = 'yarn'
4+ self.release = '0.17.6'
5+ self.base_url = 'https://yarnpkg.com/en/docs/'
6+ self.links = {
7+ home: 'https://yarnpkg.com/',
8+ code: 'https://github.com/yarnpkg/yarn'
9+ }
10+
11+ html_filters.push 'yarn/entries', 'yarn/clean_html', 'title'
12+
13+ options[:root_title] = 'Yarn'
14+ options[:trailing_slash] = false
15+
16+ options[:skip] = %w(nightly)
17+ options[:skip_patterns] = [/\Aorg\//]
18+
19+ options[:attribution] = <<-HTML
20+ &copy; 2016 Yarn Contributors<br>
21+ Licensed under the BSD License.
22+ HTML
23+ end
24+end
public/icons/docs/yarn/16.png+0−0

Binary file not shown.

public/icons/docs/yarn/16@2x.png+0−0

Binary file not shown.

public/icons/docs/yarn/SOURCE+1−0
@@ -0,0 +1 @@
1+https://raw.githubusercontent.com/yarnpkg/website/master/favicon.ico