Skip to content

Commit 555f434

Browse files
committed
Update Angular documentation (2.0.0)
1 parent 50176de commit 555f434

5 files changed

Lines changed: 20 additions & 11 deletions

File tree

assets/stylesheets/global/_classes.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@
4848
}
4949

5050
%pre-heading {
51+
margin: 0;
5152
padding: .375rem .625rem;
53+
font-size: inherit;
54+
font-weight: normal;
5255
line-height: 1.5;
5356
border-bottom-left-radius: 0;
5457
border-bottom-right-radius: 0;

assets/stylesheets/pages/_angular.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
h2 { @extend %block-heading; }
1313
> h3 { @extend %block-label, %label-blue; }
14+
.code-example > h4, .pre-title { @extend %pre-heading; }
1415

1516
p > code, .status-badge { @extend %label; }
1617

lib/docs/filters/angular/clean_html.rb

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@ class Angular
33
class CleanHtmlFilter < Filter
44
def call
55
container = at_css('article.docs-content')
6-
container.child.before(at_css('header.hero h1')).before(css('header.hero .badges')).before(css('header.hero + .banner'))
6+
badges = css('header.hero .badge, header.hero .hero-subtitle').map do |node|
7+
node.name = 'span'
8+
node['class'] = 'status-badge'
9+
node.to_html
10+
end.join(' ')
11+
badges = %(<div class="badges">#{badges}</div>)
12+
container.child.before(at_css('header.hero h1')).before(badges).before(css('header.hero + .banner'))
713
@doc = container
814

915
css('pre.no-bg-with-indent').each do |node|
@@ -17,7 +23,7 @@ def call
1723

1824
css('button.verbose', 'button.verbose + .l-verbose-section', 'a[id=top]', 'a[href="#top"]').remove
1925

20-
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|
26+
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|
2127
node.before(node.children).remove
2228
end
2329

@@ -60,11 +66,7 @@ def call
6066
end
6167

6268
css('pre[name]').each do |node|
63-
case node['data-language']
64-
when 'html' then node.content = "<!-- #{node['name']} -->\n\n" + node.content
65-
when 'css' then node.content = "/* #{node['name']} */\n\n" + node.content
66-
else node.content = "// #{node['name']}\n\n" + node.content
67-
end
69+
node.before(%(<div class="pre-title">#{node['name']}</div>))
6870
end
6971

7072
css('a.is-button > h3').each do |node|

lib/docs/filters/angular/entries.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def get_name
1818
end
1919
end
2020

21-
name << '()' if at_css('.status-badge').try(:content) == 'Function'
21+
name << '()' if at_css('.hero-subtitle').try(:content) == 'Function'
2222
name
2323
end
2424

@@ -30,7 +30,7 @@ def get_type
3030
elsif slug == 'glossary'
3131
'Guide'
3232
else
33-
type = at_css('.is-nav-title-selected').content.strip
33+
type = at_css('.nav-title.is-selected').content.strip
3434
type.remove! ' Reference'
3535
type << ": #{mod}" if mod
3636
type

lib/docs/scrapers/angular.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ class Angular < UrlScraper
4242
end
4343

4444
version '2.0 TypeScript' do
45-
self.release = '2.0.0rc6'
46-
self.base_url = "https://angular.io/docs/ts/latest/"
45+
self.release = '2.0.0'
46+
self.base_url = 'https://angular.io/docs/ts/latest/'
4747
end
4848

4949
private
@@ -53,6 +53,9 @@ def parse(string)
5353
string.gsub! '</code-example', '</pre'
5454
string.gsub! '<code-pane', '<pre'
5555
string.gsub! '</code-pane', '</pre'
56+
string.gsub! '<live-example></live-example>', 'live example'
57+
string.gsub! '<live-example', '<span'
58+
string.gsub! '</live-example', '</span'
5659
super string
5760
end
5861
end

0 commit comments

Comments
 (0)