Update Angular documentation (2.0.0)

pull/496/head
Thibaut Courouble 9 years ago
parent 50176de413
commit 555f434f32

@ -48,7 +48,10 @@
} }
%pre-heading { %pre-heading {
margin: 0;
padding: .375rem .625rem; padding: .375rem .625rem;
font-size: inherit;
font-weight: normal;
line-height: 1.5; line-height: 1.5;
border-bottom-left-radius: 0; border-bottom-left-radius: 0;
border-bottom-right-radius: 0; border-bottom-right-radius: 0;

@ -11,6 +11,7 @@
h2 { @extend %block-heading; } h2 { @extend %block-heading; }
> h3 { @extend %block-label, %label-blue; } > h3 { @extend %block-label, %label-blue; }
.code-example > h4, .pre-title { @extend %pre-heading; }
p > code, .status-badge { @extend %label; } p > code, .status-badge { @extend %label; }

@ -3,7 +3,13 @@ module Docs
class CleanHtmlFilter < Filter class CleanHtmlFilter < Filter
def call def call
container = at_css('article.docs-content') container = at_css('article.docs-content')
container.child.before(at_css('header.hero h1')).before(css('header.hero .badges')).before(css('header.hero + .banner')) badges = css('header.hero .badge, header.hero .hero-subtitle').map do |node|
node.name = 'span'
node['class'] = 'status-badge'
node.to_html
end.join(' ')
badges = %(<div class="badges">#{badges}</div>)
container.child.before(at_css('header.hero h1')).before(badges).before(css('header.hero + .banner'))
@doc = container @doc = container
css('pre.no-bg-with-indent').each do |node| css('pre.no-bg-with-indent').each do |node|
@ -17,7 +23,7 @@ module Docs
css('button.verbose', 'button.verbose + .l-verbose-section', 'a[id=top]', 'a[href="#top"]').remove css('button.verbose', 'button.verbose + .l-verbose-section', 'a[id=top]', 'a[href="#top"]').remove
css('.c10', '.showcase', '.showcase-content', '.l-main-section', 'div.div', 'div[flex]', 'code-tabs', 'md-card', 'md-card-content', 'div:not([class])', 'footer', '.card-row', '.card-row-container', 'figure', 'blockquote', 'exported', 'defined', 'div.ng-scope').each do |node| css('.c10', '.showcase', '.showcase-content', '.l-main-section', 'div.div', 'div[flex]', 'code-tabs', 'md-card', 'md-card-content', 'div:not([class])', 'footer', '.card-row', '.card-row-container', 'figure', 'blockquote', 'exported', 'defined', 'div.ng-scope', '.code-example header').each do |node|
node.before(node.children).remove node.before(node.children).remove
end end
@ -60,11 +66,7 @@ module Docs
end end
css('pre[name]').each do |node| css('pre[name]').each do |node|
case node['data-language'] node.before(%(<div class="pre-title">#{node['name']}</div>))
when 'html' then node.content = "<!-- #{node['name']} -->\n\n" + node.content
when 'css' then node.content = "/* #{node['name']} */\n\n" + node.content
else node.content = "// #{node['name']}\n\n" + node.content
end
end end
css('a.is-button > h3').each do |node| css('a.is-button > h3').each do |node|

@ -18,7 +18,7 @@ module Docs
end end
end end
name << '()' if at_css('.status-badge').try(:content) == 'Function' name << '()' if at_css('.hero-subtitle').try(:content) == 'Function'
name name
end end
@ -30,7 +30,7 @@ module Docs
elsif slug == 'glossary' elsif slug == 'glossary'
'Guide' 'Guide'
else else
type = at_css('.is-nav-title-selected').content.strip type = at_css('.nav-title.is-selected').content.strip
type.remove! ' Reference' type.remove! ' Reference'
type << ": #{mod}" if mod type << ": #{mod}" if mod
type type

@ -42,8 +42,8 @@ module Docs
end end
version '2.0 TypeScript' do version '2.0 TypeScript' do
self.release = '2.0.0rc6' self.release = '2.0.0'
self.base_url = "https://angular.io/docs/ts/latest/" self.base_url = 'https://angular.io/docs/ts/latest/'
end end
private private
@ -53,6 +53,9 @@ module Docs
string.gsub! '</code-example', '</pre' string.gsub! '</code-example', '</pre'
string.gsub! '<code-pane', '<pre' string.gsub! '<code-pane', '<pre'
string.gsub! '</code-pane', '</pre' string.gsub! '</code-pane', '</pre'
string.gsub! '<live-example></live-example>', 'live example'
string.gsub! '<live-example', '<span'
string.gsub! '</live-example', '</span'
super string super string
end end
end end

Loading…
Cancel
Save