diff --git a/assets/javascripts/views/pages/haxe.coffee b/assets/javascripts/views/pages/haxe.coffee new file mode 100644 index 00000000..bed18e26 --- /dev/null +++ b/assets/javascripts/views/pages/haxe.coffee @@ -0,0 +1,30 @@ +#= require views/pages/base + +class app.views.HaxePage extends app.views.BasePage + @className: '_haxe' + + # We need to extract data from a header to have the name of the class reconize as the title of the page + prepare: -> + nodes = [] + # Extract all children of page-header + header = @findByClass('page-header') + if header + for child in header.children + nodes.push(child) + + # Ensure H1 is on top + nodes.sort (a,b) -> + if a.nodeName == 'h1' + return -1 + return 0 + + firstChild = header.parentNode.firstChild + # Add them to the parent of header + for node in nodes + header.parentNode.insertBefore( node, firstChild ) + + # Add an id to class fields for additional entries + for el in @findAllByClass('identifier') + el['id'] = el.textContent + + return diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index a0caa437..2645476e 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -46,6 +46,7 @@ 'pages/git', 'pages/go', 'pages/haskell', + 'pages/haxe', 'pages/jquery', 'pages/knockout', 'pages/laravel', diff --git a/assets/stylesheets/pages/_haxe.scss b/assets/stylesheets/pages/_haxe.scss new file mode 100644 index 00000000..c2c27f77 --- /dev/null +++ b/assets/stylesheets/pages/_haxe.scss @@ -0,0 +1,29 @@ +._haxe { + .page-header > .availability { @extend %note; } + + h3 { @extend %block-heading; } + h4 { @extend %label; } + .field > p:first-of-type { @extend %block-label, %label-blue; } + .field > p.availability { + color: #AB611A; + font-size: 90%; + } + .field code { + white-space: nowrap; + } + + .label { + display: inline-block; + padding: 2px 4px; + font-size: 11.844px; + font-weight: bold; + line-height: 14px; + color: #FFF; + text-shadow: 0px -1px 0px rgba(0, 0, 0, 0.25); + white-space: nowrap; + vertical-align: baseline; + background-color: #999; + border-radius: 3px; + margin-right: 5px; + } +} diff --git a/lib/docs/filters/haxe/clean_html.rb b/lib/docs/filters/haxe/clean_html.rb new file mode 100644 index 00000000..9aac2734 --- /dev/null +++ b/lib/docs/filters/haxe/clean_html.rb @@ -0,0 +1,10 @@ +module Docs + class Haxe + class CleanHtmlFilter < Filter + def call + css('.viewsource').remove + doc + end + end + end +end diff --git a/lib/docs/filters/haxe/entries.rb b/lib/docs/filters/haxe/entries.rb new file mode 100644 index 00000000..7f7736e7 --- /dev/null +++ b/lib/docs/filters/haxe/entries.rb @@ -0,0 +1,27 @@ +module Docs + class Haxe + class EntriesFilter < Docs::EntriesFilter + + def get_name + at_css('h1').text.split(' ')[1] + end + + def get_type + object, method = *slug.split('/') + method ? object : 'Std' + end + + def additional_entries + return [] if root_page? + + css('.field a > span').map do |node| + [name + '.' + node.content, node.content, nil] + end + end + + def include_default_entry? + true + end + end + end +end diff --git a/lib/docs/scrapers/haxe.rb b/lib/docs/scrapers/haxe.rb new file mode 100644 index 00000000..cc0df992 --- /dev/null +++ b/lib/docs/scrapers/haxe.rb @@ -0,0 +1,23 @@ +module Docs + class Haxe < UrlScraper + self.name = 'Haxe' + self.type = 'haxe' + self.release = '3.2.0' + self.base_url = 'http://api.haxe.org' + self.links = { + home: 'http://haxe.org', + code: 'https://github.com/HaxeFoundation/haxe' + } + + html_filters.push 'haxe/clean_html', 'haxe/entries' + + options[:container] = '.span9' + options[:title] = nil + options[:root_title] = 'Haxe' + + options[:attribution] = <<-HTML + © HaxeFoundation
+ Licensed under a MIT license. + HTML + end +end diff --git a/public/icons/docs/haxe/16.png b/public/icons/docs/haxe/16.png new file mode 100644 index 00000000..8690d4be Binary files /dev/null and b/public/icons/docs/haxe/16.png differ diff --git a/public/icons/docs/haxe/16@2x.png b/public/icons/docs/haxe/16@2x.png new file mode 100644 index 00000000..57756568 Binary files /dev/null and b/public/icons/docs/haxe/16@2x.png differ