Add Elixir documentation

pull/292/head
Eddy Shure 9 years ago committed by Thibaut
parent a796be9202
commit 1ff92971a5

@ -0,0 +1,6 @@
#= require views/pages/base
class app.views.ElixirPage extends app.views.BasePage
prepare: ->
@highlightCode @findAll('pre.elixir'), 'elixir'
return

@ -38,6 +38,7 @@
'pages/coffeescript',
'pages/d3',
'pages/drupal',
'pages/elixir',
'pages/ember',
'pages/express',
'pages/git',

@ -38,6 +38,7 @@
'pages/coffeescript',
'pages/d3',
'pages/drupal',
'pages/elixir',
'pages/ember',
'pages/express',
'pages/git',

@ -0,0 +1,4 @@
._elixir {
@extend %simple;
h3 { @extend %block-label; }
}

@ -0,0 +1,50 @@
module Docs
class Elixir
class CleanHtmlFilter < Filter
def call
# Strip h1 content
css('h1').each do |node|
node.content = node.content.strip
end
# Make subtitles smaller
css('h2').each do |node|
node.name = 'h4'
end
# Remove footer
at_css('footer').remove
# Remove behaviour after module name
css('h1').each do |node|
if !(node.has_attribute?('id'))
node.content = node.content.split(" ")[0]
end
end
# Remove links from summary headings
css('.summary > h4 > a').each do |node|
node.delete('href')
end
# Add elixir class to each pre for syntax highlighting
css('pre').each do |node|
node['class'] = "elixir"
end
# Rewrite .detail -> .method-detail
css('.detail').each do |node|
node['class'] = "method-detail"
end
# Change .detail-header to h3
css('.detail-header .signature').each do |node|
node.name = 'h3'
end
doc
end
end
end
end

@ -0,0 +1,35 @@
module Docs
class Elixir
class EntriesFilter < Docs::EntriesFilter
def get_name
at_css('h1').content.gsub('behaviour', ' ').strip
end
def get_type
return nil if (slug.split("#")[1] == "functions")
slug.split("#")[1]
end
def additional_entries
return [] if root_page?
entries = []
# Add itself (moduledoc) to entries
klass = at_css('h1').content.strip.split(" ")[0]
entries << [klass, klass, name]
# Add functions
css('.summary-functions .summary-signature a').each do |node|
entries << [(name + node['href']), node['href'][1..-1], name]
end
return entries
end
def include_default_entry?
!initial_page?
end
end
end
end

@ -0,0 +1,36 @@
module Docs
class Elixir < UrlScraper
self.name = 'Elixir'
self.type = 'elixir'
self.version = '1.1.1'
self.base_url = 'http://elixir-lang.org/docs/stable/elixir/'
self.root_path = 'extra-api-reference.html'
self.links = {
home: 'https://elixir-lang.org/',
code: 'https://github.com/elixir-lang/elixir'
}
html_filters.push 'elixir/clean_html', 'elixir/entries', 'title'
# Skip exceptions
options[:skip_patterns] = [/Error/]
# Skip protocols
options[:skip] = %w(
Collectable.html
Enumerable.html
Inspect.html
List.Chars.html
String.Chars.html
)
options[:follow_links] = ->(filter) { filter.root_page? }
options[:container] = "#content"
options[:title] = false
options[:root_title] = 'Elixir'
options[:attribution] = <<-HTML
&copy; 2012 Plataformatec<br>
Licensed under the Apache License, Version 2.0
HTML
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

@ -0,0 +1,2 @@
http://elixir-lang.org/docs/stable/elixir/assets/logo.png
with permission from José Valim (https://twitter.com/josevalim/status/657125748659126272)
Loading…
Cancel
Save