diff --git a/assets/images/icons.png b/assets/images/icons.png index 763464be..6ae6b697 100644 Binary files a/assets/images/icons.png and b/assets/images/icons.png differ diff --git a/assets/images/icons@2x.png b/assets/images/icons@2x.png index 504b8f2c..17f5bd0e 100644 Binary files a/assets/images/icons@2x.png and b/assets/images/icons@2x.png differ diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 69e350b4..2479f574 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -108,7 +108,7 @@ credits = [ 'Apache', 'https://raw.githubusercontent.com/apache/cordova-docs/master/LICENSE' ], [ - 'CSS
DOM
HTML
JavaScript
XPath', + 'CSS
DOM
HTML
JavaScript
SVG
XPath', '2005-2014 Mozilla Developer Network and individual contributors', 'CC BY-SA', 'http://creativecommons.org/licenses/by-sa/2.5/' diff --git a/assets/javascripts/templates/pages/news_tmpl.coffee b/assets/javascripts/templates/pages/news_tmpl.coffee index 9d53ec8b..3368fd0f 100644 --- a/assets/javascripts/templates/pages/news_tmpl.coffee +++ b/assets/javascripts/templates/pages/news_tmpl.coffee @@ -33,7 +33,10 @@ newsItem = (date, news) -> result app.news = [ - [ 1413590400000, # October 18, 2014 + [ 1413676800000, # October 19, 2014 + """ New SVG documentation """, + ], [ + 1413590400000, # October 18, 2014 """ New nginx documentation """, ], [ 1413158400000, # October 13, 2014 diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss index e4639061..4cf1a85a 100644 --- a/assets/stylesheets/global/_icons.scss +++ b/assets/stylesheets/global/_icons.scss @@ -4,7 +4,7 @@ width: 1rem; height: 1rem; background-image: image-url('icons.png'); - background-size: 5rem 11rem; + background-size: 5rem 12rem; } @media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) { @@ -66,3 +66,4 @@ ._icon-django:before { background-position: -2rem -10rem; } ._icon-xpath:before { background-position: -3rem -10rem; } ._icon-nginx:before { background-position: -4rem -10rem; } +._icon-svg:before { background-position: 0 -11rem; } diff --git a/lib/docs/filters/svg/clean_html.rb b/lib/docs/filters/svg/clean_html.rb new file mode 100644 index 00000000..4494e875 --- /dev/null +++ b/lib/docs/filters/svg/clean_html.rb @@ -0,0 +1,32 @@ +module Docs + class Svg + class CleanHtmlFilter < Filter + def call + root_page? ? root : other + doc + end + + def root + doc.inner_html = doc.at_css('#Documentation + dl').to_html + end + + def other + css('.prevnext').remove + + if at_css('p').content.include?("\u{00AB}") + at_css('p').remove + end + + if slug == 'Attribute' || slug == 'Element' + at_css('h2').name = 'h1' + end + + css('#SVG_Attributes + div[style]').each do |node| + node.remove_attribute('style') + node['class'] = 'index' + css('h3').each { |n| n.name = 'span' } + end + end + end + end +end diff --git a/lib/docs/filters/svg/entries.rb b/lib/docs/filters/svg/entries.rb new file mode 100644 index 00000000..64311a22 --- /dev/null +++ b/lib/docs/filters/svg/entries.rb @@ -0,0 +1,47 @@ +module Docs + class Svg + class EntriesFilter < Docs::EntriesFilter + def get_name + name = super + name.remove!('Element.').try(:downcase!) + name.remove!('Attribute.').try(:downcase!) + name.remove!('Tutorial.') + name.gsub!('_', '') + + if name.in?(%w(Element Attribute Content\ type)) + "#{name}s" + else + name + end + end + + def get_type + if slug.start_with?('Element') + 'Elements' + elsif slug.start_with?('Attribute') + 'Attributes' + elsif slug.start_with?('Tutorial') + 'Tutorial' + elsif slug == 'Content_type' + 'Content types' + else + 'Miscellaneous' + end + end + + def additional_entries + return [] unless slug == 'Content_type' + entries = [] + + css('h2[id]').each do |node| + dl = node.next_element + next unless dl.name == 'dl' + name = dl.at_css('dt').content.remove(/[<>]/) + entries << [name, node['id']] + end + + entries + end + end + end +end diff --git a/lib/docs/scrapers/mdn/svg.rb b/lib/docs/scrapers/mdn/svg.rb new file mode 100644 index 00000000..41209418 --- /dev/null +++ b/lib/docs/scrapers/mdn/svg.rb @@ -0,0 +1,33 @@ +module Docs + class Svg < Mdn + self.name = 'SVG' + self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/SVG' + + html_filters.push 'svg/clean_html', 'svg/entries', 'title' + + options[:root_title] = 'SVG' + + options[:title] = ->(filter) do + if filter.slug.starts_with?('Element/') + "<#{filter.default_title}>" + elsif filter.slug != 'Attribute' && filter.slug != 'Element' + filter.default_title + else + false + end + end + + options[:skip] = %w( + /Compatibility_sources + /FAQ + /SVG_animation_with_SMIL + /SVG_as_an_Image) + + options[:fix_urls] = ->(url) do + url.sub! 'https://developer.mozilla.org/en-US/Web/SVG', Svg.base_url + url.sub! 'https://developer.mozilla.org/en-US/docs/SVG', Svg.base_url + url.sub! 'https://developer.mozilla.org/en/SVG', Svg.base_url + url + end + end +end diff --git a/public/icons/docs/svg/16.png b/public/icons/docs/svg/16.png new file mode 100644 index 00000000..ce95b5f9 Binary files /dev/null and b/public/icons/docs/svg/16.png differ diff --git a/public/icons/docs/svg/16@2x.png b/public/icons/docs/svg/16@2x.png new file mode 100644 index 00000000..5065659a Binary files /dev/null and b/public/icons/docs/svg/16@2x.png differ diff --git a/public/icons/docs/svg/SOURCE b/public/icons/docs/svg/SOURCE new file mode 100644 index 00000000..f7af68fd --- /dev/null +++ b/public/icons/docs/svg/SOURCE @@ -0,0 +1 @@ +http://www.w3.org/2009/08/svg-logos.html