Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 119 KiB After Width: | Height: | Size: 120 KiB |
@ -1,54 +1,53 @@
|
||||
._angular {
|
||||
h2 { @extend %block-heading; }
|
||||
padding-left: 1rem;
|
||||
|
||||
//
|
||||
// Index
|
||||
//
|
||||
h1, h2, > h3, .banner, .badges { margin-left: -1rem; }
|
||||
|
||||
.nav-index-section {
|
||||
margin: 1.5em 0 1em -2em;
|
||||
list-style: none;
|
||||
font-weight: bold;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
._mobile & {
|
||||
padding-left: 0;
|
||||
|
||||
//
|
||||
// Other
|
||||
//
|
||||
h1, h2, > h3, .banner, .badges { margin-left: 0; }
|
||||
}
|
||||
|
||||
h3, h4 { font-size: 1rem; }
|
||||
h2 { @extend %block-heading; }
|
||||
> h3 { @extend %block-label, %label-blue; }
|
||||
|
||||
.alert { @extend %note; }
|
||||
.alert-success { @extend %note-green; }
|
||||
.alert-error { @extend %note-red; }
|
||||
p > code, .status-badge { @extend %label; }
|
||||
|
||||
p > code, li > code, td > code { @extend %label; }
|
||||
.l-sub-section, .alert, .banner { @extend %note; }
|
||||
.banner { @extend %note-green; }
|
||||
.alert.is-important { @extend %note-red; }
|
||||
.alert.is-helpful { @extend %note-blue; }
|
||||
|
||||
.view-source, .improve-docs {
|
||||
position: relative;
|
||||
float: right;
|
||||
line-height: 1.7rem;
|
||||
padding-left: 1em;
|
||||
font-size: .875rem;
|
||||
background: $contentBackground;
|
||||
td > h3, .l-sub-section > h3, .l-sub-section > h4, .alert > h3, .alert > h4 {
|
||||
margin-top: .25rem;
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
.defs {
|
||||
padding-left: 1rem;
|
||||
list-style: none;
|
||||
img {
|
||||
display: block;
|
||||
margin: 1em auto;
|
||||
|
||||
> li > h3:first-child {
|
||||
margin: 0 0 1em -1rem;
|
||||
@extend %block-label, %label-blue;
|
||||
&[align="left"] {
|
||||
float: left;
|
||||
margin: 0 1em 0 0;
|
||||
}
|
||||
|
||||
> li + li { margin-top: 2em; }
|
||||
|
||||
h4 {
|
||||
margin: 1em 0 .5em;
|
||||
font-size: 1em;
|
||||
&[align="right"] {
|
||||
float: right;
|
||||
margin: 0 0 0 1em;
|
||||
}
|
||||
}
|
||||
|
||||
.location-badge {
|
||||
text-align: right;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.filetree {
|
||||
white-space: normal;
|
||||
@extend %pre;
|
||||
|
||||
ul { list-style-type: disc; }
|
||||
.children { padding-left: 1em; }
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,54 @@
|
||||
._angularjs {
|
||||
h2 { @extend %block-heading; }
|
||||
|
||||
//
|
||||
// Index
|
||||
//
|
||||
|
||||
.nav-index-section {
|
||||
margin: 1.5em 0 1em -2em;
|
||||
list-style: none;
|
||||
font-weight: bold;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
//
|
||||
// Other
|
||||
//
|
||||
|
||||
h3, h4 { font-size: 1rem; }
|
||||
|
||||
.alert { @extend %note; }
|
||||
.alert-success { @extend %note-green; }
|
||||
.alert-error { @extend %note-red; }
|
||||
|
||||
p > code, li > code, td > code { @extend %label; }
|
||||
|
||||
.view-source, .improve-docs {
|
||||
position: relative;
|
||||
float: right;
|
||||
line-height: 1.7rem;
|
||||
padding-left: 1em;
|
||||
font-size: .875rem;
|
||||
background: $contentBackground;
|
||||
}
|
||||
|
||||
.defs {
|
||||
padding-left: 1rem;
|
||||
list-style: none;
|
||||
|
||||
> li > h3:first-child {
|
||||
margin: 0 0 1em -1rem;
|
||||
@extend %block-label, %label-blue;
|
||||
}
|
||||
|
||||
> li + li { margin-top: 2em; }
|
||||
|
||||
h4 {
|
||||
margin: 1em 0 .5em;
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
ul { list-style-type: disc; }
|
||||
}
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
module Docs
|
||||
class Angularjs
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
root_page? ? root : other
|
||||
|
||||
# Remove ng-* attributes
|
||||
css('*').each do |node|
|
||||
node.attributes.each_key do |attribute|
|
||||
node.remove_attribute(attribute) if attribute.start_with? 'ng-'
|
||||
end
|
||||
end
|
||||
|
||||
doc
|
||||
end
|
||||
|
||||
def root
|
||||
css('.nav-index-group').each do |node|
|
||||
if heading = node.at_css('.nav-index-group-heading')
|
||||
heading.name = 'h2'
|
||||
end
|
||||
node.parent.before(node.children)
|
||||
end
|
||||
|
||||
css('.nav-index-section').each do |node|
|
||||
node.content = node.content
|
||||
end
|
||||
|
||||
css('.toc-close', '.naked-list').remove
|
||||
end
|
||||
|
||||
def other
|
||||
css('#example', '.example', '#description_source', '#description_demo', '[id$="example"]', 'hr').remove
|
||||
|
||||
css('header').each do |node|
|
||||
node.before(node.children).remove
|
||||
end
|
||||
|
||||
if h1 = at_css('h1')
|
||||
h1.prepend_child(css('.view-source', '.improve-docs'))
|
||||
end
|
||||
|
||||
# Remove root-level <div>
|
||||
while div = at_css('h1 + div')
|
||||
div.before(div.children)
|
||||
div.remove
|
||||
end
|
||||
|
||||
css('.api-profile-header-structure > li').each do |node|
|
||||
node.inner_html = node.inner_html.remove('- ')
|
||||
end
|
||||
|
||||
css('h1').each_with_index do |node, i|
|
||||
next if i == 0
|
||||
node.name = 'h2'
|
||||
end
|
||||
|
||||
# Remove examples
|
||||
css('.runnable-example').each do |node|
|
||||
node.parent.remove
|
||||
end
|
||||
|
||||
# Remove dead links (e.g. ngRepeat)
|
||||
css('a.type-hint').each do |node|
|
||||
node.name = 'code'
|
||||
node.remove_attribute 'href'
|
||||
end
|
||||
|
||||
css('pre > code').each do |node|
|
||||
node['class'] ||= ''
|
||||
lang = if node['class'].include?('lang-html') || node.content =~ /\A</
|
||||
'html'
|
||||
elsif node['class'].include?('lang-css')
|
||||
'css'
|
||||
elsif node['class'].include?('lang-js') || node['class'].include?('lang-javascript')
|
||||
'javascript'
|
||||
end
|
||||
node.parent['data-language'] = lang if lang
|
||||
|
||||
node.before(node.children).remove
|
||||
end
|
||||
|
||||
# Remove some <code> elements
|
||||
css('h1 > code', 'h2 > code', 'h3 > code', 'h4 > code', 'h6 > code').each do |node|
|
||||
node.before(node.content).remove
|
||||
end
|
||||
|
||||
css('ul.methods', 'ul.properties', 'ul.events').add_class('defs').each do |node|
|
||||
node.css('> li > h3').each do |h3|
|
||||
next if h3.content.present?
|
||||
h3.content = h3.next_element.content
|
||||
h3.next_element.remove
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -1,5 +1,5 @@
|
||||
module Docs
|
||||
class Angular
|
||||
class Angularjs
|
||||
class CleanUrlsFilter < Filter
|
||||
def call
|
||||
html.gsub! %r{angularjs\.org/([\d\.]+)/docs/partials/(\w+)/}, 'angularjs.org/\1/docs/\2/'
|
@ -0,0 +1,53 @@
|
||||
module Docs
|
||||
class Angularjs
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
def get_name
|
||||
if slug.start_with?('api')
|
||||
name = URI.unescape(slug).split('/').last
|
||||
name.remove! %r{\Ang\.}
|
||||
name << " (#{subtype})" if subtype == 'directive' || subtype == 'filter'
|
||||
name.prepend("#{type}.") unless type.starts_with?('ng ') || name == type
|
||||
name
|
||||
elsif slug.start_with?('guide')
|
||||
name = URI.decode(at_css('.improve-docs')['href'][/message=docs\(guide%2F(.+?)\)/, 1])
|
||||
name.prepend 'Guide: '
|
||||
name
|
||||
end
|
||||
end
|
||||
|
||||
def get_type
|
||||
if slug.start_with?('api')
|
||||
type = slug.split('/').drop(1).first
|
||||
type << " #{subtype}s" if type == 'ng' && subtype
|
||||
type
|
||||
elsif slug.start_with?('guide')
|
||||
'Guide'
|
||||
end
|
||||
end
|
||||
|
||||
def subtype
|
||||
return @subtype if defined? @subtype
|
||||
node = at_css '.api-profile-header-structure'
|
||||
data = node.content.match %r{(\w+?) in module} if node
|
||||
@subtype = data && data[1]
|
||||
end
|
||||
|
||||
def additional_entries
|
||||
return [] unless slug.start_with?('api')
|
||||
entries = []
|
||||
|
||||
css('ul.defs').each do |list|
|
||||
list.css('> li[id]').each do |node|
|
||||
next unless heading = node.at_css('h3')
|
||||
name = heading.content.strip
|
||||
name.sub! %r{\(.*\);}, '()'
|
||||
name.prepend "#{self.name.split.first}."
|
||||
entries << [name, node['id']]
|
||||
end
|
||||
end
|
||||
|
||||
entries
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -1,68 +1,59 @@
|
||||
module Docs
|
||||
class Angular < UrlScraper
|
||||
self.name = 'Angular.js'
|
||||
self.slug = 'angular'
|
||||
self.type = 'angular'
|
||||
self.root_path = 'api.html'
|
||||
self.initial_paths = %w(guide.html)
|
||||
|
||||
html_filters.push 'angular/clean_html', 'angular/entries', 'title'
|
||||
text_filters.push 'angular/clean_urls'
|
||||
|
||||
options[:title] = false
|
||||
options[:root_title] = 'Angular.js'
|
||||
|
||||
options[:decode_and_clean_paths] = true
|
||||
options[:fix_urls_before_parse] = ->(str) do
|
||||
str.gsub!('[', '%5B')
|
||||
str.gsub!(']', '%5D')
|
||||
str
|
||||
end
|
||||
|
||||
options[:fix_urls] = ->(url) do
|
||||
%w(api guide).each do |str|
|
||||
url.sub! "/partials/#{str}/#{str}/", "/partials/#{str}/"
|
||||
url.sub! %r{/#{str}/img/}, "/img/"
|
||||
url.sub! %r{/#{str}/(.+?)/#{str}/}, "/#{str}/"
|
||||
url.sub! %r{/partials/#{str}/(.+?)(?<!\.html)(?:\z|(#.*))}, "/partials/#{str}/\\1.html\\2"
|
||||
url.sub! %r{/partials/.+/#{str}/}, "/partials/#{str}/"
|
||||
end
|
||||
self.root_path = 'api/'
|
||||
self.links = {
|
||||
home: 'https://angular.io/',
|
||||
code: 'https://github.com/angular/angular'
|
||||
}
|
||||
|
||||
html_filters.push 'angular/entries', 'angular/clean_html'
|
||||
|
||||
options[:skip_patterns] = [/deprecated/]
|
||||
options[:skip] = %w(
|
||||
index.html
|
||||
styleguide.html
|
||||
quickstart.html
|
||||
guide/cheatsheet.html
|
||||
guide/style-guide.html)
|
||||
|
||||
options[:replace_paths] = {
|
||||
'testing/index.html' => 'guide/testing.html',
|
||||
'glossary.html' => 'guide/glossary.html',
|
||||
'tutorial' => 'tutorial/'
|
||||
}
|
||||
|
||||
options[:fix_urls] = -> (url) do
|
||||
url.sub! %r{\A(https://angular\.io/docs/.+/)index\.html\z}, '\1'
|
||||
url.sub! %r{\A(https://angular\.io/docs/.+/index)/\z}, '\1'
|
||||
url
|
||||
end
|
||||
|
||||
options[:only_patterns] = [%r{\Aapi/}, %r{\Aguide/}]
|
||||
options[:skip] = %w(api/ng.html)
|
||||
|
||||
options[:attribution] = <<-HTML
|
||||
© 2010–2016 Google, Inc.<br>
|
||||
Licensed under the Creative Commons Attribution License 4.0.
|
||||
HTML
|
||||
|
||||
stub '' do
|
||||
stub 'api/' do
|
||||
capybara = load_capybara_selenium
|
||||
capybara.app_host = 'https://code.angularjs.org'
|
||||
capybara.visit("/#{self.class.release}/docs/api")
|
||||
capybara.execute_script("return document.querySelector('.side-navigation').innerHTML")
|
||||
end
|
||||
|
||||
version '1.5' do
|
||||
self.release = '1.5.6'
|
||||
self.base_url = "https://code.angularjs.org/#{release}/docs/partials/"
|
||||
capybara.app_host = 'https://angular.io'
|
||||
capybara.visit('/docs/ts/latest/api/')
|
||||
capybara.execute_script('return document.body.innerHTML')
|
||||
end
|
||||
|
||||
version '1.4' do
|
||||
self.release = '1.4.11'
|
||||
self.base_url = "https://code.angularjs.org/#{release}/docs/partials/"
|
||||
version '2.0 TypeScript' do
|
||||
self.release = '2.0.0rc1'
|
||||
self.base_url = "https://angular.io/docs/ts/latest/"
|
||||
end
|
||||
|
||||
version '1.3' do
|
||||
self.release = '1.3.20'
|
||||
self.base_url = "https://code.angularjs.org/#{release}/docs/partials/"
|
||||
end
|
||||
private
|
||||
|
||||
version '1.2' do
|
||||
self.release = '1.2.29'
|
||||
self.base_url = "https://code.angularjs.org/#{release}/docs/partials/"
|
||||
def parse(string)
|
||||
string.gsub! '<code-example', '<pre'
|
||||
string.gsub! '</code-example', '</pre'
|
||||
string.gsub! '<code-pane', '<pre'
|
||||
string.gsub! '</code-pane', '</pre'
|
||||
super string
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -0,0 +1,68 @@
|
||||
module Docs
|
||||
class Angularjs < UrlScraper
|
||||
self.name = 'Angular.js'
|
||||
self.slug = 'angularjs'
|
||||
self.type = 'angularjs'
|
||||
self.root_path = 'api.html'
|
||||
self.initial_paths = %w(guide.html)
|
||||
|
||||
html_filters.push 'angularjs/clean_html', 'angularjs/entries', 'title'
|
||||
text_filters.push 'angularjs/clean_urls'
|
||||
|
||||
options[:title] = false
|
||||
options[:root_title] = 'Angular.js'
|
||||
|
||||
options[:decode_and_clean_paths] = true
|
||||
options[:fix_urls_before_parse] = ->(str) do
|
||||
str.gsub!('[', '%5B')
|
||||
str.gsub!(']', '%5D')
|
||||
str
|
||||
end
|
||||
|
||||
options[:fix_urls] = ->(url) do
|
||||
%w(api guide).each do |str|
|
||||
url.sub! "/partials/#{str}/#{str}/", "/partials/#{str}/"
|
||||
url.sub! %r{/#{str}/img/}, "/img/"
|
||||
url.sub! %r{/#{str}/(.+?)/#{str}/}, "/#{str}/"
|
||||
url.sub! %r{/partials/#{str}/(.+?)(?<!\.html)(?:\z|(#.*))}, "/partials/#{str}/\\1.html\\2"
|
||||
url.sub! %r{/partials/.+/#{str}/}, "/partials/#{str}/"
|
||||
end
|
||||
url
|
||||
end
|
||||
|
||||
options[:only_patterns] = [%r{\Aapi/}, %r{\Aguide/}]
|
||||
options[:skip] = %w(api/ng.html)
|
||||
|
||||
options[:attribution] = <<-HTML
|
||||
© 2010–2016 Google, Inc.<br>
|
||||
Licensed under the Creative Commons Attribution License 4.0.
|
||||
HTML
|
||||
|
||||
stub '' do
|
||||
capybara = load_capybara_selenium
|
||||
capybara.app_host = 'https://code.angularjs.org'
|
||||
capybara.visit("/#{self.class.release}/docs/api")
|
||||
capybara.execute_script("return document.querySelector('.side-navigation').innerHTML")
|
||||
end
|
||||
|
||||
version '1.5' do
|
||||
self.release = '1.5.6'
|
||||
self.base_url = "https://code.angularjs.org/#{release}/docs/partials/"
|
||||
end
|
||||
|
||||
version '1.4' do
|
||||
self.release = '1.4.11'
|
||||
self.base_url = "https://code.angularjs.org/#{release}/docs/partials/"
|
||||
end
|
||||
|
||||
version '1.3' do
|
||||
self.release = '1.3.20'
|
||||
self.base_url = "https://code.angularjs.org/#{release}/docs/partials/"
|
||||
end
|
||||
|
||||
version '1.2' do
|
||||
self.release = '1.2.29'
|
||||
self.base_url = "https://code.angularjs.org/#{release}/docs/partials/"
|
||||
end
|
||||
end
|
||||
end
|
Before Width: | Height: | Size: 791 B After Width: | Height: | Size: 727 B |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.3 KiB |
@ -1 +1 @@
|
||||
https://github.com/angular/angular.js/tree/master/images/logo/AngularJS-Shield.exports
|
||||
https://angular.io/presskit.html
|
||||
|
After Width: | Height: | Size: 791 B |
After Width: | Height: | Size: 1.8 KiB |
@ -0,0 +1 @@
|
||||
https://github.com/angular/angular.js/tree/master/images/logo/AngularJS-Shield.exports
|