Finish Haxe documentation

pull/382/head
Thibaut Courouble 9 years ago
parent daded63b6a
commit fbbf9d5d09

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 104 KiB

@ -1,7 +1,7 @@
[
[
"2016-03-06",
"New documentation: <a href=\"/tensorflow/\">TensorFlow</a>"
"New documentation: <a href=\"/tensorflow/\">TensorFlow</a> and <a href=\"/haxe/\">Haxe</a>"
], [
"2016-02-28",
"New documentations: <a href=\"/codeigniter/\">CodeIgniter</a>, <a href=\"/nginx_lua_module/\">nginx Lua Module</a> and <a href=\"/influxdata/\">InfluxData</a>"

@ -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.',

@ -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

@ -48,7 +48,6 @@
'pages/github',
'pages/go',
'pages/haskell',
'pages/haxe',
'pages/jquery',
'pages/knockout',
'pages/laravel',

@ -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; }

@ -18,6 +18,7 @@
._cordova,
._grunt,
._haxe,
._influxdata,
._less,
._lodash,

@ -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;
}
}

@ -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

@ -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('</span><', '</span> <')
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

@ -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

@ -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
&copy; HaxeFoundation<br>
&copy; 2005&ndash;2016 Haxe Foundation<br>
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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 533 B

After

Width:  |  Height:  |  Size: 640 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

@ -0,0 +1 @@
https://github.com/HaxeFoundation/haxe.org/tree/master/www/img
Loading…
Cancel
Save