mirror of https://github.com/freeCodeCamp/devdocs
parent
46f6db4a90
commit
63715a31f9
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 52 KiB |
@ -0,0 +1,4 @@
|
||||
#= require views/pages/base
|
||||
#= require views/pages/underscore
|
||||
|
||||
app.views.SinonPage = app.views.UnderscorePage
|
@ -0,0 +1,9 @@
|
||||
._sinon {
|
||||
padding-left: 1rem;
|
||||
|
||||
> h1, > h2, > h3 { margin-left: -1rem; }
|
||||
> h2 { @extend %block-heading; }
|
||||
> h3 { @extend %block-label, %label-blue; }
|
||||
|
||||
dt > code { @extend %label; }
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
module Docs
|
||||
class Sinon
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
css('> p:first-child', 'a.api', 'ul.nav').remove
|
||||
|
||||
css('.section', 'h2 code', 'h3 code').each do |node|
|
||||
node.before(node.children).remove
|
||||
end
|
||||
|
||||
# Remove code highlighting
|
||||
css('pre').each do |node|
|
||||
node.content = node.content
|
||||
end
|
||||
|
||||
doc
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,47 @@
|
||||
module Docs
|
||||
class Sinon
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
def additional_entries
|
||||
entries = []
|
||||
type = config = nil
|
||||
|
||||
css('*').each do |node|
|
||||
if node.name == 'h2'
|
||||
config = false
|
||||
type = node.content.strip
|
||||
type.remove! 'Test '
|
||||
type.remove! 'Sinon.JS '
|
||||
type = type[0].upcase + type.from(1)
|
||||
|
||||
id = type.parameterize
|
||||
node['id'] = id
|
||||
|
||||
entries << [type, id, 'Sections']
|
||||
elsif node.name == 'h3' && node.content.include?('sinon.config')
|
||||
config = true
|
||||
elsif node.name == 'dl'
|
||||
node.css('dt > code').each do |code|
|
||||
name = code.content.strip
|
||||
name.sub! %r{\(.*\);?}, '()'
|
||||
name.sub! %r{\Aserver.(\w+)\s=.*\z}, 'server.\1'
|
||||
name.remove! '`'
|
||||
name.remove! %r{\A.+?\=\s+}
|
||||
name.remove! %r{\A\w+?\s}
|
||||
name.prepend 'sinon.config.' if config
|
||||
|
||||
next if name =~ /\s/
|
||||
next if entries.any? { |entry| entry[0].casecmp(name) == 0 }
|
||||
|
||||
id = name.parameterize
|
||||
code.parent['id'] = id
|
||||
|
||||
entries << [name, id, type]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
entries
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,19 @@
|
||||
module Docs
|
||||
class Sinon < UrlScraper
|
||||
self.name = 'Sinon'
|
||||
self.type = 'sinon'
|
||||
self.version = '1.10.2'
|
||||
self.base_url = 'http://sinonjs.org/docs/'
|
||||
|
||||
html_filters.push 'sinon/clean_html', 'sinon/entries', 'title'
|
||||
|
||||
options[:title] = 'Sinon.JS'
|
||||
options[:container] = '.docs'
|
||||
options[:skip_links] = true
|
||||
|
||||
options[:attribution] = <<-HTML
|
||||
© 2010–2014 Christian Johansen<br>
|
||||
Licensed under the BSD License.
|
||||
HTML
|
||||
end
|
||||
end
|
After Width: | Height: | Size: 218 B |
After Width: | Height: | Size: 442 B |
@ -0,0 +1 @@
|
||||
https://github.com/Kapeli/Dash-X-Platform-Resources/blob/master/docset_icons/sinon%402x.png
|
Loading…
Reference in new issue