From daded63b6a9ea84c5188204c4fd75d3c106f5794 Mon Sep 17 00:00:00 2001 From: JbIPS Date: Thu, 11 Feb 2016 15:49:33 +0100 Subject: [PATCH] Add Haxe documentation --- assets/javascripts/views/pages/haxe.coffee | 30 +++++++++++++++++++++ assets/stylesheets/application.css.scss | 1 + assets/stylesheets/pages/_haxe.scss | 29 ++++++++++++++++++++ lib/docs/filters/haxe/clean_html.rb | 10 +++++++ lib/docs/filters/haxe/entries.rb | 27 +++++++++++++++++++ lib/docs/scrapers/haxe.rb | 23 ++++++++++++++++ public/icons/docs/haxe/16.png | Bin 0 -> 533 bytes public/icons/docs/haxe/16@2x.png | Bin 0 -> 1631 bytes 8 files changed, 120 insertions(+) create mode 100644 assets/javascripts/views/pages/haxe.coffee create mode 100644 assets/stylesheets/pages/_haxe.scss create mode 100644 lib/docs/filters/haxe/clean_html.rb create mode 100644 lib/docs/filters/haxe/entries.rb create mode 100644 lib/docs/scrapers/haxe.rb create mode 100644 public/icons/docs/haxe/16.png create mode 100644 public/icons/docs/haxe/16@2x.png 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 8ed497ce..98993613 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -48,6 +48,7 @@ 'pages/github', '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 0000000000000000000000000000000000000000..8690d4bed0b763c06bcb6b2b53a70183d2d90d19 GIT binary patch literal 533 zcmV+w0_y#VP)t#jU0005BNkl1gh6h_aTUGLh? z64oHvh$1C56@?25IwW4iN}hm6NQ8I=N@^mdKnUc53PFLWhy{)mne`vG*Lde%3S!uV zjp6I&=bSsEJ0t#8+81w2i3dV!smN~vIZxMk4xS*@*u z7(W-P;=hAqdzDr$W;J{kA$3EVRw-a1sl%j4td;OORT5i)2t7xjdy=lESHV|FY$j9n z;hvL}V~Mr939ghBbkk>_j@|j-&}Y#`_=2QiD0&Fs0Q@9G^ML=2Ed=K0T?e3{9amSR zssDsEbLcn0Nzefh8-(}$$K<*8n%4j{ci7x*gaIs%-C@@j7C+*T}vwAbwWnY&f<%cMS!0sGoQ6yl5af>j0f(f z9l6vdQoB?nhETsIH9tu{+pLM^^_CcYD}w#x@$2$;K3Y7v-L@NgAlR<`kg?6go3rRA X56tqIQc81L00000NkvXXu0mjfrwQ{vErVxc6CBTED!#X{M@l0AGYJ_8>hOIEA^C5uFYgbgM#A(0&%h%v!7^ZwjF z-G{}y@6C8TGdQ88r>EPxT~+5)*QvTHzx(#z!9~?Q;i6nj_Jr^*Sl~J4kA&YLm3Q@K z`IJ+ZKb?Muhw&qN{T%s+q={#_srp)lr4i8j4-)bWAE)5sUEx%0ob?^nmmcp4z)HWt=le|p!BH3-2 zPBm+L=;>qXE`N(YO$ggEKtcfCB6wZl3xwa6{5kTU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