History

Add Bootstrap 3 documentation

Thibaut Courouble committed 10 years ago

Commit 28b41491 parent 0bc34ed16 files · +234 −-3Browse files

Unified · Split

16 files
  1. assets/images/docs.png +0 −0
  2. assets/images/docs@2x.png +0 −0
  3. assets/javascripts/news.json +3 −0
  4. assets/javascripts/templates/pages/about_tmpl.coffee +5 −0
  5. assets/javascripts/views/pages/simple.coffee +1 −0
  6. assets/stylesheets/application-dark.css.scss +1 −0
  7. assets/stylesheets/application.css.scss +1 −0
  8. assets/stylesheets/global/_icons.scss +1 −0
  9. assets/stylesheets/pages/_bootstrap.scss +62 −0
  10. assets/stylesheets/pages/_simple.scss +1 −1
  11. lib/docs/filters/bootstrap/clean_html_v3.rb +64 −0
  12. lib/docs/filters/bootstrap/entries_v3.rb +65 −0
  13. lib/docs/scrapers/bootstrap.rb +33 −0
  14. public/icons/docs/bootstrap/16.png +0 −0
  15. public/icons/docs/bootstrap/16@2x.png +0 −0
  16. public/icons/docs/bootstrap/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+3−0
@@ -1,5 +1,8 @@
11 [
22 [
3+ "2016-07-31",
4+ "New documentation: <a href=\"/bootstrap/\">Bootstrap</a>"
5+ ], [
36 "2016-07-24",
47 "New documentations: <a href=\"/julia/\">Julia</a>, <a href=\"/crystal/\">Crystal</a> and <a href=\"/redux/\">Redux</a>"
58 ], [
assets/javascripts/templates/pages/about_tmpl.coffee+5−0
@@ -105,6 +105,11 @@ credits = [ · 104 unmodified lines
105105 '2010-2016 Jeremy Ashkenas, DocumentCloud',
106106 'MIT',
107107 'https://raw.githubusercontent.com/jashkenas/backbone/master/LICENSE'
108+ ], [
109+ 'Bootstrap',
110+ '2011-2016 Twitter, Inc.',
111+ 'CC BY',
112+ 'https://creativecommons.org/licenses/by/3.0/'
108113 ], [
109114 'Bower',
110115 '2016 Bower contributors',
assets/javascripts/views/pages/simple.coffee+1−0
@@ -8,6 +8,7 @@ class app.views.SimplePage extends app.views.BasePage · 7 unmodified lines
88
99 app.views.AngularPage =
1010 app.views.AngularjsPage =
11+app.views.Bsv3Page =
1112 app.views.CakephpPage =
1213 app.views.ChaiPage =
1314 app.views.CrystalPage =
assets/stylesheets/application-dark.css.scss+1−0
@@ -34,6 +34,7 @@ · 33 unmodified lines
3434 'pages/angular',
3535 'pages/angularjs',
3636 'pages/apache',
37+ 'pages/bootstrap',
3738 'pages/bower',
3839 'pages/c',
3940 'pages/cakephp',
assets/stylesheets/application.css.scss+1−0
@@ -34,6 +34,7 @@ · 33 unmodified lines
3434 'pages/angular',
3535 'pages/angularjs',
3636 'pages/apache',
37+ 'pages/bootstrap',
3738 'pages/bower',
3839 'pages/c',
3940 'pages/cakephp',
assets/stylesheets/global/_icons.scss+1−0
@@ -133,6 +133,7 @@ · 132 unmodified lines
133133 ._icon-crystal:before { background-position: -6rem -8rem; @extend %darkIconFix !optional; }
134134 ._icon-julia:before { background-position: -7rem -8rem; @extend %darkIconFix !optional; }
135135 ._icon-redux:before { background-position: -8rem -8rem; @extend %darkIconFix !optional; }
136+._icon-bootstrap:before { background-position: -9rem -8rem; }
136137 ._icon-react_native:before { background-position: 0 -9rem; }
137138 ._icon-phalcon:before { background-position: -1rem -9rem; }
138139 ._icon-matplotlib:before { background-position: -2rem -9rem; }
assets/stylesheets/pages/_bootstrap.scss+62−0
@@ -0,0 +1,62 @@
1+._bsv3 {
2+ @extend %simple;
3+
4+ h4 > code, h5 > code { @extend %label; }
5+
6+ h2 > small {
7+ color: $textColorLight;
8+ float: right;
9+ }
10+
11+ .bs-callout { @extend %note; }
12+ .bs-callout-info { @extend %note-blue; }
13+ .bs-callout-danger { @extend %note-red; }
14+ .bs-callout > h4, .bs-callout > h5 { margin-top: .25rem; }
15+
16+ .text-danger { @extend %label, %label-red; }
17+
18+ .bs-example {
19+ padding: .375rem .625rem;
20+ line-height: 1.5;
21+ @extend %heading-box;
22+ }
23+
24+ div.bs-example {
25+ border-bottom-left-radius: 0;
26+ border-bottom-right-radius: 0;
27+
28+ + pre {
29+ border-top-left-radius: 0;
30+ border-top-right-radius: 0;
31+ border-top: 0;
32+ margin-top: 0;
33+ }
34+ }
35+
36+ a.thumbnail {
37+ display: block;
38+ padding: .25em;
39+ @extend %box;
40+
41+ &:after { content: none; }
42+ + h4 { margin: .75em 0 .5em; }
43+ > img { display: block; }
44+ }
45+
46+ .col { margin-bottom: 1.5em; }
47+
48+ @media (min-width: 800px) {
49+ .row {
50+ display: flex;
51+ flex-wrap: wrap;
52+ }
53+
54+ .col {
55+ flex: 0 1 auto;
56+ padding: 0 1em;
57+ width: 33.33%;
58+ -moz-box-sizing: border-box;
59+ box-sizing: border-box;
60+ }
61+ }
62+}
assets/stylesheets/pages/_simple.scss+1−1
@@ -12,7 +12,7 @@ · 11 unmodified lines
1212 h1, h2, h3 { margin-left: 0; }
1313 }
1414
15− p > code, li > code { @extend %label; }
15+ p > code, li > code, td > code { @extend %label; }
1616 blockquote { @extend %note; }
1717 blockquote > h4, blockquote > h5 { margin-top: .25rem; }
1818 }
lib/docs/filters/bootstrap/clean_html_v3.rb+64−0
@@ -0,0 +1,64 @@
1+module Docs
2+ class Bootstrap
3+ class CleanHtmlV3Filter < Filter
4+ def call
5+ at_css('div[role=main]').child.before(at_css('#content .container').inner_html)
6+ @doc = at_css('div[role=main]')
7+
8+ css('h1, h2, h3, h4, h5').each do |node|
9+ node.name = node.name.sub(/\d/) { |i| i.to_i + 1 }
10+ end
11+ at_css('h2').name = 'h1'
12+
13+ css('hr', '.zero-clipboard', '.modal', '.panel-group').remove
14+
15+ css('.bs-docs-section', '.table-responsive').each do |node|
16+ node.before(node.children).remove
17+ end
18+
19+ css('> .show-grid', '.bs-example', '.bs-glyphicons', '.responsive-utilities-test').each do |node|
20+ if node.previous_element['class'].try(:include?, 'bs-example')
21+ node.remove
22+ else
23+ node.content = ''
24+ node.name = 'p'
25+ node['class'] = 'bs-example'
26+ node.remove_attribute('data-example-id')
27+ prev = node.previous_element
28+ prev = prev.previous_element until prev['id']
29+ node.inner_html = %(<a href="#{current_url}/##{prev['id']}">Open example on getbootstrap.com</a>)
30+ end
31+ end
32+
33+ css('.bs-example + figure').each do |node|
34+ node.previous_element.name = 'div'
35+ end
36+
37+ css('div[class*="col-"]').each do |node|
38+ node['class'] = 'col'
39+ end
40+
41+ css('.__cf_email__').each do |node|
42+ node.replace(decode_cloudflare_email(node['data-cfemail']))
43+ end
44+
45+ css('figure.highlight').each do |node|
46+ code = node.at_css('code')
47+ node['data-language'] = code['data-lang']
48+ node.content = code.content
49+ node.name = 'pre'
50+ end
51+
52+ css('table, tr, td, th, pre').each do |node|
53+ node.remove_attribute('class')
54+ end
55+
56+ css('thead td:empty').each do |node|
57+ node.name = 'th'
58+ end
59+
60+ doc
61+ end
62+ end
63+ end
64+end
lib/docs/filters/bootstrap/entries_v3.rb+65−0
@@ -0,0 +1,65 @@
1+module Docs
2+ class Bootstrap
3+ class EntriesV3Filter < Docs::EntriesFilter
4+ def get_name
5+ at_css('h1').content
6+ end
7+
8+ def get_type
9+ name
10+ end
11+
12+ def additional_entries
13+ return [] if root_page?
14+ entries = []
15+
16+ css('.bs-docs-sidenav > li').each do |node|
17+ link = node.at_css('a')
18+ name = link.content
19+ next if IGNORE_ENTRIES.include?(name)
20+
21+ id = link['href'].remove('#')
22+ entries << [name, id]
23+ next if name =~ /Sass|Less|Glyphicons/
24+
25+ node.css('> ul > li > a').each do |link|
26+ n = link.content
27+ next if n.start_with?('Ex: ') || n.start_with?('Default ') || n =~ /example/i || IGNORE_ENTRIES.include?(n)
28+ id = link['href'].remove('#')
29+ n.downcase!
30+ n.prepend "#{name}: "
31+ entries << [n, id]
32+ end
33+ end
34+
35+ %w(modals dropdowns scrollspy tabs tooltips popovers alerts buttons collapse carousel affix).each do |dom_id|
36+ css("##{dom_id}-options + p + div tbody td:first-child").each do |node|
37+ name = node.content.strip
38+ id = node.parent['id'] = "#{dom_id}-#{name.parameterize}-option"
39+ name.prepend "#{dom_id.singularize.titleize}: "
40+ name << ' (option)'
41+ entries << [name, id]
42+ end
43+
44+ css("##{dom_id}-methods ~ h4 code").each do |node|
45+ next unless name = node.content[/\('(\w+)'\)/, 1]
46+ id = node.parent['id'] = "#{dom_id}-#{name.parameterize}-method"
47+ name.prepend "#{dom_id.singularize.titleize}: "
48+ name << ' (method)'
49+ entries << [name, id]
50+ end
51+ end
52+
53+ entries
54+ end
55+
56+ IGNORE_ENTRIES = %w(
57+ Overview
58+ Introduction
59+ Usage
60+ Methods
61+ Options
62+ )
63+ end
64+ end
65+end
lib/docs/scrapers/bootstrap.rb+33−0
@@ -0,0 +1,33 @@
1+module Docs
2+ class Bootstrap < UrlScraper
3+ options[:attribution] = <<-HTML
4+ &copy; 2011&ndash;2016 Twitter, Inc.<br>
5+ Code licensed under the MIT License.<br>
6+ Documentation licensed under the Creative Commons Attribution License v3.0.
7+ HTML
8+
9+ version '3' do
10+ self.type = 'bsv3'
11+ self.release = '3.3.7'
12+ self.base_url = 'https://getbootstrap.com/'
13+ self.root_path = 'getting-started'
14+ self.links = {
15+ home: 'https://getbootstrap.com/',
16+ code: 'https://github.com/twbs/bootstrap'
17+ }
18+
19+ html_filters.push 'bootstrap/entries_v3', 'bootstrap/clean_html_v3'
20+
21+ options[:trailing_slash] = false
22+ options[:only] = %w(getting-started css components javascript)
23+ end
24+
25+ private
26+
27+ def handle_response(response)
28+ response.effective_url.scheme = 'https'
29+ response.effective_url.path = response.effective_url.path.remove(/\/\z/)
30+ super
31+ end
32+ end
33+end
public/icons/docs/bootstrap/16.png+0−0

Binary file not shown.

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

Binary file not shown.

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