mirror of https://github.com/freeCodeCamp/devdocs
parent
9f642fd0ad
commit
dc4ccd9d6c
@ -1,6 +0,0 @@
|
||||
#= require views/pages/base
|
||||
|
||||
class app.views.D3Page extends app.views.BasePage
|
||||
prepare: ->
|
||||
@highlightCode @findAll('.highlight > pre'), 'javascript'
|
||||
return
|
@ -1,6 +1,14 @@
|
||||
._d3 {
|
||||
> h2 { @extend %block-heading; }
|
||||
> h3, > h4 { font-size: 1rem; }
|
||||
> h3 { @extend %block-label; }
|
||||
> h4 { font-size: 1rem; }
|
||||
> h6 { @extend %block-label, %label-blue; }
|
||||
|
||||
> h6 > .source {
|
||||
float: right;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
code { @extend %label; }
|
||||
blockquote { @extend %note, %note-blue; }
|
||||
}
|
||||
|
@ -1,21 +1,20 @@
|
||||
module Docs
|
||||
class D3
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
class EntriesV3Filter < Docs::EntriesFilter
|
||||
def get_name
|
||||
at_css('h1').content
|
||||
File.basename(slug, '.md').gsub('-', ' ')
|
||||
end
|
||||
|
||||
def get_type
|
||||
name
|
||||
at_css('h6[id]') ? name : 'D3'
|
||||
end
|
||||
|
||||
def additional_entries
|
||||
css('h6[id]').inject [] do |entries, node|
|
||||
css('h6[id]').each_with_object [] do |node, entries|
|
||||
name = node.content.strip
|
||||
name.remove! %r{\(.*\z}
|
||||
name.sub! %r{\(.*\z}, '()'
|
||||
name.sub! %r{\A(svg:\w+)\s+.+}, '\1'
|
||||
entries << [name, node['id']] unless name == entries.last.try(:first)
|
||||
entries
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,33 @@
|
||||
module Docs
|
||||
class D3
|
||||
class EntriesV4Filter < Docs::EntriesFilter
|
||||
def get_name
|
||||
name = at_css('h1').content
|
||||
name.remove! 'd3-'
|
||||
name
|
||||
end
|
||||
|
||||
def get_type
|
||||
return 'D3' unless at_css('h6[id]')
|
||||
type = name.titleize
|
||||
type.sub! 'Hsv', 'HSV'
|
||||
type.sub! 'Dsv', 'DSV'
|
||||
type
|
||||
end
|
||||
|
||||
def additional_entries
|
||||
css('h6[id]').each_with_object [] do |node, entries|
|
||||
name = node.content.strip
|
||||
name.remove! 'Source'
|
||||
name.remove! '<>'
|
||||
name.gsub! %r{\(.+?\)\)?}, '()'
|
||||
name.sub! %r{\A(svg:\w+)\s+.+}, '\1'
|
||||
name.split(/\s+/).each do |n|
|
||||
next if n.blank?
|
||||
entries << [n, node['id']] unless n == entries.last.try(:first)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in new issue