diff --git a/assets/images/icons.png b/assets/images/icons.png
index d706a785..097c584c 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 64cb5cd9..9c727110 100644
Binary files a/assets/images/icons@2x.png and b/assets/images/icons@2x.png differ
diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json
index 52986d3c..a3d123ae 100644
--- a/assets/javascripts/news.json
+++ b/assets/javascripts/news.json
@@ -1,7 +1,7 @@
[
[
"2016-03-06",
- "New documentation: TensorFlow"
+ "New documentation: TensorFlow and Haxe"
], [
"2016-02-28",
"New documentations: CodeIgniter, nginx Lua Module and InfluxData"
diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee
index 94e2b725..6c31b62d 100644
--- a/assets/javascripts/templates/pages/about_tmpl.coffee
+++ b/assets/javascripts/templates/pages/about_tmpl.coffee
@@ -199,6 +199,11 @@ credits = [
'The University of Glasgow',
'BSD',
'https://www.haskell.org/ghc/license'
+ ], [
+ 'Haxe',
+ '2005-2016 Haxe Foundation',
+ 'MIT',
+ 'http://haxe.org/foundation/open-source.html'
], [
'InfluxData',
'2015 InfluxData, Inc.',
diff --git a/assets/javascripts/views/pages/haxe.coffee b/assets/javascripts/views/pages/haxe.coffee
deleted file mode 100644
index bed18e26..00000000
--- a/assets/javascripts/views/pages/haxe.coffee
+++ /dev/null
@@ -1,30 +0,0 @@
-#= 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 98993613..8ed497ce 100644
--- a/assets/stylesheets/application.css.scss
+++ b/assets/stylesheets/application.css.scss
@@ -48,7 +48,6 @@
'pages/github',
'pages/go',
'pages/haskell',
- 'pages/haxe',
'pages/jquery',
'pages/knockout',
'pages/laravel',
diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss
index c06d1acd..5fe32cbf 100644
--- a/assets/stylesheets/global/_icons.scss
+++ b/assets/stylesheets/global/_icons.scss
@@ -130,3 +130,4 @@
._icon-codeigniter:before { background-position: -4rem -10rem; @extend %darkIconFix !optional; }
._icon-influxdata:before { background-position: -5rem -10rem; @extend %darkIconFix !optional; }
._icon-tensorflow:before { background-position: -6rem -10rem; }
+._icon-haxe:before { background-position: -7rem -10rem; }
diff --git a/assets/stylesheets/pages/_base.scss b/assets/stylesheets/pages/_base.scss
index ae4656f0..2f5056c6 100644
--- a/assets/stylesheets/pages/_base.scss
+++ b/assets/stylesheets/pages/_base.scss
@@ -18,6 +18,7 @@
._cordova,
._grunt,
+._haxe,
._influxdata,
._less,
._lodash,
diff --git a/assets/stylesheets/pages/_haxe.scss b/assets/stylesheets/pages/_haxe.scss
deleted file mode 100644
index c2c27f77..00000000
--- a/assets/stylesheets/pages/_haxe.scss
+++ /dev/null
@@ -1,29 +0,0 @@
-._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/core/doc.rb b/lib/docs/core/doc.rb
index a4bda2a7..1df17a88 100644
--- a/lib/docs/core/doc.rb
+++ b/lib/docs/core/doc.rb
@@ -19,6 +19,7 @@ module Docs
klass.name = name
klass.slug = slug
klass.version = version
+ klass.release = release
klass.links = links
klass.class_exec(&block)
@versions ||= []
@@ -48,7 +49,15 @@ module Docs
def slug
slug = @slug || name.try(:downcase)
- version? ? "#{slug}~#{version.downcase.gsub('+', 'p').gsub(/[^a-z0-9\_\.]/, '_')}" : slug
+ version? ? "#{slug}~#{version_slug}" : slug
+ end
+
+ def version_slug
+ slug = version.downcase
+ slug.gsub! '+', 'p'
+ slug.gsub! '#', 's'
+ slug.gsub! %r{[^a-z0-9\_\.]}, '_'
+ slug
end
def path
diff --git a/lib/docs/filters/haxe/clean_html.rb b/lib/docs/filters/haxe/clean_html.rb
index 9aac2734..164ca795 100644
--- a/lib/docs/filters/haxe/clean_html.rb
+++ b/lib/docs/filters/haxe/clean_html.rb
@@ -3,6 +3,44 @@ module Docs
class CleanHtmlFilter < Filter
def call
css('.viewsource').remove
+
+ css('h4 + h1').each do |node|
+ node.after(node.previous_element)
+ end
+
+ css('.page-header h4', '.page-header > div').each do |node|
+ node.name = 'p'
+ end
+
+ css('.page-header', '.body', '.page-header small', '.doc', '.identifier', '.inline-content p', '.fields').each do |node|
+ node.before(node.children).remove
+ end
+
+ css('> h3').each do |node|
+ node.name = 'h2'
+ end
+
+ css('.field > p > code:first-child:last-child').each do |node|
+ node = node.parent
+ node.name = 'h3'
+ node.inner_html = node.inner_html.squish.gsub('<', ' <')
+ end
+
+ css('.field').each do |node|
+ link = node.at_css('a[name]')
+ node.at_css('h3:not(:empty)')['id'] = link['name']
+ link.before(link.children).remove
+ node.before(node.children).remove
+ end
+
+ css('a[name]').each do |node|
+ node.parent['id'] = node['name']
+ end
+
+ css('.inline-content').each do |node|
+ node.name = 'p'
+ end
+
doc
end
end
diff --git a/lib/docs/filters/haxe/entries.rb b/lib/docs/filters/haxe/entries.rb
index 7f7736e7..85b48978 100644
--- a/lib/docs/filters/haxe/entries.rb
+++ b/lib/docs/filters/haxe/entries.rb
@@ -1,26 +1,36 @@
module Docs
class Haxe
class EntriesFilter < Docs::EntriesFilter
-
def get_name
- at_css('h1').text.split(' ')[1]
+ name = slug.dup
+ name.gsub!('/', '.')
+ name.remove! "#{slug.split('/').first}\."
+ name
end
def get_type
- object, method = *slug.split('/')
- method ? object : 'Std'
+ path = *current_url.path.split('/')[1..-1]
+
+ return 'std' if path.length == 1
+
+ path = path.take_while { |str| str =~ /\A[a-z]/}
+ path[0..2].join('.')
end
def additional_entries
- return [] if root_page?
+ return [] if root_page? || self.name.start_with?('_') || self.name.include?('Error')
- css('.field a > span').map do |node|
- [name + '.' + node.content, node.content, nil]
+ css('h3[id]').each_with_object [] do |node, entries|
+ id = node['id']
+ next if id == 'new'
+ name = "#{self.name}.#{id}"
+ name << '()' if node.content.include?('(')
+ entries << [name, id]
end
end
def include_default_entry?
- true
+ subpath !~ /index\.html\z/
end
end
end
diff --git a/lib/docs/scrapers/haxe.rb b/lib/docs/scrapers/haxe.rb
index cc0df992..c318259c 100644
--- a/lib/docs/scrapers/haxe.rb
+++ b/lib/docs/scrapers/haxe.rb
@@ -2,22 +2,57 @@ 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'
- }
+ self.release = '3.2.1'
+ self.base_url = 'http://api.haxe.org/'
html_filters.push 'haxe/clean_html', 'haxe/entries'
options[:container] = '.span9'
- options[:title] = nil
- options[:root_title] = 'Haxe'
options[:attribution] = <<-HTML
- © HaxeFoundation
+ © 2005–2016 Haxe Foundation
Licensed under a MIT license.
HTML
- end
+
+ version do
+ self.links = {
+ home: 'http://haxe.org',
+ code: 'https://github.com/HaxeFoundation/haxe'
+ }
+
+ options[:skip_patterns] = [/\A(?:cpp|cs|flash|java|js|neko|php|python)/i]
+ end
+
+ version 'C++' do
+ self.base_url = 'http://api.haxe.org/cpp/'
+ end
+
+ version 'C#' do
+ self.base_url = 'http://api.haxe.org/cs/'
+ end
+
+ version 'Flash' do
+ self.base_url = 'http://api.haxe.org/flash/'
+ end
+
+ version 'Java' do
+ self.base_url = 'http://api.haxe.org/java/'
+ end
+
+ version 'JavaScript' do
+ self.base_url = 'http://api.haxe.org/js/'
+ end
+
+ version 'Neko' do
+ self.base_url = 'http://api.haxe.org/neko/'
+ end
+
+ version 'PHP' do
+ self.base_url = 'http://api.haxe.org/php/'
+ end
+
+ version 'Python' do
+ self.base_url = 'http://api.haxe.org/python/'
+ end
+ end
end
diff --git a/public/icons/docs/haxe/16.png b/public/icons/docs/haxe/16.png
index 8690d4be..7ebba50b 100644
Binary files a/public/icons/docs/haxe/16.png 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
index 57756568..972a478a 100644
Binary files a/public/icons/docs/haxe/16@2x.png and b/public/icons/docs/haxe/16@2x.png differ
diff --git a/public/icons/docs/haxe/SOURCE b/public/icons/docs/haxe/SOURCE
new file mode 100644
index 00000000..f1d19ae1
--- /dev/null
+++ b/public/icons/docs/haxe/SOURCE
@@ -0,0 +1 @@
+https://github.com/HaxeFoundation/haxe.org/tree/master/www/img