Add Bootstrap 3 documentation

This commit is contained in:
Thibaut Courouble 2016-07-30 18:10:05 -04:00
parent 0bc34ed011
commit 28b4149c6b
16 changed files with 238 additions and 1 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 121 KiB

View file

@ -1,5 +1,8 @@
[
[
"2016-07-31",
"New documentation: <a href=\"/bootstrap/\">Bootstrap</a>"
], [
"2016-07-24",
"New documentations: <a href=\"/julia/\">Julia</a>, <a href=\"/crystal/\">Crystal</a> and <a href=\"/redux/\">Redux</a>"
], [

View file

@ -105,6 +105,11 @@ credits = [
'2010-2016 Jeremy Ashkenas, DocumentCloud',
'MIT',
'https://raw.githubusercontent.com/jashkenas/backbone/master/LICENSE'
], [
'Bootstrap',
'2011-2016 Twitter, Inc.',
'CC BY',
'https://creativecommons.org/licenses/by/3.0/'
], [
'Bower',
'2016 Bower contributors',

View file

@ -8,6 +8,7 @@ class app.views.SimplePage extends app.views.BasePage
app.views.AngularPage =
app.views.AngularjsPage =
app.views.Bsv3Page =
app.views.CakephpPage =
app.views.ChaiPage =
app.views.CrystalPage =

View file

@ -34,6 +34,7 @@
'pages/angular',
'pages/angularjs',
'pages/apache',
'pages/bootstrap',
'pages/bower',
'pages/c',
'pages/cakephp',

View file

@ -34,6 +34,7 @@
'pages/angular',
'pages/angularjs',
'pages/apache',
'pages/bootstrap',
'pages/bower',
'pages/c',
'pages/cakephp',

View file

@ -133,6 +133,7 @@
._icon-crystal:before { background-position: -6rem -8rem; @extend %darkIconFix !optional; }
._icon-julia:before { background-position: -7rem -8rem; @extend %darkIconFix !optional; }
._icon-redux:before { background-position: -8rem -8rem; @extend %darkIconFix !optional; }
._icon-bootstrap:before { background-position: -9rem -8rem; }
._icon-react_native:before { background-position: 0 -9rem; }
._icon-phalcon:before { background-position: -1rem -9rem; }
._icon-matplotlib:before { background-position: -2rem -9rem; }

View file

@ -0,0 +1,62 @@
._bsv3 {
@extend %simple;
h4 > code, h5 > code { @extend %label; }
h2 > small {
color: $textColorLight;
float: right;
}
.bs-callout { @extend %note; }
.bs-callout-info { @extend %note-blue; }
.bs-callout-danger { @extend %note-red; }
.bs-callout > h4, .bs-callout > h5 { margin-top: .25rem; }
.text-danger { @extend %label, %label-red; }
.bs-example {
padding: .375rem .625rem;
line-height: 1.5;
@extend %heading-box;
}
div.bs-example {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
+ pre {
border-top-left-radius: 0;
border-top-right-radius: 0;
border-top: 0;
margin-top: 0;
}
}
a.thumbnail {
display: block;
padding: .25em;
@extend %box;
&:after { content: none; }
+ h4 { margin: .75em 0 .5em; }
> img { display: block; }
}
.col { margin-bottom: 1.5em; }
@media (min-width: 800px) {
.row {
display: flex;
flex-wrap: wrap;
}
.col {
flex: 0 1 auto;
padding: 0 1em;
width: 33.33%;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
}
}

View file

@ -12,7 +12,7 @@
h1, h2, h3 { margin-left: 0; }
}
p > code, li > code { @extend %label; }
p > code, li > code, td > code { @extend %label; }
blockquote { @extend %note; }
blockquote > h4, blockquote > h5 { margin-top: .25rem; }
}

View file

@ -0,0 +1,64 @@
module Docs
class Bootstrap
class CleanHtmlV3Filter < Filter
def call
at_css('div[role=main]').child.before(at_css('#content .container').inner_html)
@doc = at_css('div[role=main]')
css('h1, h2, h3, h4, h5').each do |node|
node.name = node.name.sub(/\d/) { |i| i.to_i + 1 }
end
at_css('h2').name = 'h1'
css('hr', '.zero-clipboard', '.modal', '.panel-group').remove
css('.bs-docs-section', '.table-responsive').each do |node|
node.before(node.children).remove
end
css('> .show-grid', '.bs-example', '.bs-glyphicons', '.responsive-utilities-test').each do |node|
if node.previous_element['class'].try(:include?, 'bs-example')
node.remove
else
node.content = ''
node.name = 'p'
node['class'] = 'bs-example'
node.remove_attribute('data-example-id')
prev = node.previous_element
prev = prev.previous_element until prev['id']
node.inner_html = %(<a href="#{current_url}/##{prev['id']}">Open example on getbootstrap.com</a>)
end
end
css('.bs-example + figure').each do |node|
node.previous_element.name = 'div'
end
css('div[class*="col-"]').each do |node|
node['class'] = 'col'
end
css('.__cf_email__').each do |node|
node.replace(decode_cloudflare_email(node['data-cfemail']))
end
css('figure.highlight').each do |node|
code = node.at_css('code')
node['data-language'] = code['data-lang']
node.content = code.content
node.name = 'pre'
end
css('table, tr, td, th, pre').each do |node|
node.remove_attribute('class')
end
css('thead td:empty').each do |node|
node.name = 'th'
end
doc
end
end
end
end

View file

@ -0,0 +1,65 @@
module Docs
class Bootstrap
class EntriesV3Filter < Docs::EntriesFilter
def get_name
at_css('h1').content
end
def get_type
name
end
def additional_entries
return [] if root_page?
entries = []
css('.bs-docs-sidenav > li').each do |node|
link = node.at_css('a')
name = link.content
next if IGNORE_ENTRIES.include?(name)
id = link['href'].remove('#')
entries << [name, id]
next if name =~ /Sass|Less|Glyphicons/
node.css('> ul > li > a').each do |link|
n = link.content
next if n.start_with?('Ex: ') || n.start_with?('Default ') || n =~ /example/i || IGNORE_ENTRIES.include?(n)
id = link['href'].remove('#')
n.downcase!
n.prepend "#{name}: "
entries << [n, id]
end
end
%w(modals dropdowns scrollspy tabs tooltips popovers alerts buttons collapse carousel affix).each do |dom_id|
css("##{dom_id}-options + p + div tbody td:first-child").each do |node|
name = node.content.strip
id = node.parent['id'] = "#{dom_id}-#{name.parameterize}-option"
name.prepend "#{dom_id.singularize.titleize}: "
name << ' (option)'
entries << [name, id]
end
css("##{dom_id}-methods ~ h4 code").each do |node|
next unless name = node.content[/\('(\w+)'\)/, 1]
id = node.parent['id'] = "#{dom_id}-#{name.parameterize}-method"
name.prepend "#{dom_id.singularize.titleize}: "
name << ' (method)'
entries << [name, id]
end
end
entries
end
IGNORE_ENTRIES = %w(
Overview
Introduction
Usage
Methods
Options
)
end
end
end

View file

@ -0,0 +1,33 @@
module Docs
class Bootstrap < UrlScraper
options[:attribution] = <<-HTML
&copy; 2011&ndash;2016 Twitter, Inc.<br>
Code licensed under the MIT License.<br>
Documentation licensed under the Creative Commons Attribution License v3.0.
HTML
version '3' do
self.type = 'bsv3'
self.release = '3.3.7'
self.base_url = 'https://getbootstrap.com/'
self.root_path = 'getting-started'
self.links = {
home: 'https://getbootstrap.com/',
code: 'https://github.com/twbs/bootstrap'
}
html_filters.push 'bootstrap/entries_v3', 'bootstrap/clean_html_v3'
options[:trailing_slash] = false
options[:only] = %w(getting-started css components javascript)
end
private
def handle_response(response)
response.effective_url.scheme = 'https'
response.effective_url.path = response.effective_url.path.remove(/\/\z/)
super
end
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 539 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 940 B

View file

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