diff --git a/assets/images/icons.png b/assets/images/icons.png index 4622399c..d7340fa7 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 edf961c0..67730587 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 c2959755..62501ce6 100644 --- a/assets/javascripts/news.json +++ b/assets/javascripts/news.json @@ -1,5 +1,8 @@ [ [ + "2015-11-08", + "New documentation: Elixir" + ], [ "2015-10-18", "Added a \"Copy to clipboard\" button inside each code block." ], [ diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index bcf46dd8..062d4d0d 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -144,6 +144,11 @@ credits = [ '2015 Yehuda Katz, Tom Dale and Ember.js contributors', 'MIT', 'https://raw.github.com/emberjs/ember.js/master/LICENSE' + ], [ + 'Elixir', + '2012 Plataformatec', + 'Apache', + 'https://raw.githubusercontent.com/elixir-lang/elixir/master/LICENSE' ], [ 'Express', '2009-2015 TJ Holowaychuk', diff --git a/assets/javascripts/views/pages/elixir.coffee b/assets/javascripts/views/pages/elixir.coffee index f46e2517..8c6b4f99 100644 --- a/assets/javascripts/views/pages/elixir.coffee +++ b/assets/javascripts/views/pages/elixir.coffee @@ -2,5 +2,5 @@ class app.views.ElixirPage extends app.views.BasePage prepare: -> - @highlightCode @findAll('pre.elixir'), 'elixir' + @highlightCode @findAllByTag('pre'), 'elixir' return diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss index ef72511f..51431421 100644 --- a/assets/stylesheets/global/_icons.scss +++ b/assets/stylesheets/global/_icons.scss @@ -116,3 +116,4 @@ ._icon-phalcon:before { background-position: -1rem -9rem; } %icon-clipboard { background-position: -2rem -9rem; } %icon-clipboard-white { background-position: -3rem -9rem; } +._icon-elixir:before { background-position: -4rem -9rem; @extend %darkIconFix !optional; } diff --git a/assets/stylesheets/pages/_elixir.scss b/assets/stylesheets/pages/_elixir.scss index a05cb6c3..4c38e936 100644 --- a/assets/stylesheets/pages/_elixir.scss +++ b/assets/stylesheets/pages/_elixir.scss @@ -1,4 +1,7 @@ ._elixir { @extend %simple; - h3 { @extend %block-label; } + + .type-detail { margin-bottom: 2em; } + .type-detail pre { margin-left: -1rem; } + ._mobile & .type-detail pre { margin-left: 0; } } diff --git a/lib/docs/filters/elixir/clean_html.rb b/lib/docs/filters/elixir/clean_html.rb index 6031967b..7b0db95d 100644 --- a/lib/docs/filters/elixir/clean_html.rb +++ b/lib/docs/filters/elixir/clean_html.rb @@ -2,45 +2,32 @@ module Docs class Elixir class CleanHtmlFilter < Filter def call + at_css('footer', '.view-source').remove - # Strip h1 content - css('h1').each do |node| - node.content = node.content.strip - end - - # Make subtitles smaller - css('h2').each do |node| + css('section section.docstring 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') + css('h1 .hover-link', '.detail-link').each do |node| + node.parent['id'] = node['href'].remove('#') + node.remove end - # Add elixir class to each pre for syntax highlighting - css('pre').each do |node| - node['class'] = "elixir" + css('.details-list').each do |list| + type = list['id'].remove(/s\z/) + list.css('.detail-header').each do |node| + node.name = 'h3' + node['class'] += " #{type}" + end end - # Rewrite .detail -> .method-detail - css('.detail').each do |node| - node['class'] = "method-detail" - end + css('.summary h2').each { |node| node.parent.before(node) } + css('.summary').each { |node| node.name = 'dl' } + css('.summary-signature').each { |node| node.name = 'dt' } + css('.summary-synopsis').each { |node| node.name = 'dd' } - # Change .detail-header to h3 - css('.detail-header .signature').each do |node| - node.name = 'h3' + css('section', 'div:not(.type-detail)', 'h2 a').each do |node| + node.before(node.children).remove end doc diff --git a/lib/docs/filters/elixir/entries.rb b/lib/docs/filters/elixir/entries.rb index ee830983..aac7481e 100644 --- a/lib/docs/filters/elixir/entries.rb +++ b/lib/docs/filters/elixir/entries.rb @@ -2,33 +2,38 @@ module Docs class Elixir class EntriesFilter < Docs::EntriesFilter def get_name - at_css('h1').content.gsub('behaviour', ' ').strip + at_css('h1').content.split(' ').first.strip end def get_type - return nil if (slug.split("#")[1] == "functions") - slug.split("#")[1] + case at_css('h1 small').try(:content) + when 'exception' + 'Exceptions' + when 'protocol' + 'Protocols' + else + name.split('.').first + end end def additional_entries - return [] if root_page? - - entries = [] + return [] if type == 'Exceptions' - # Add itself (moduledoc) to entries - klass = at_css('h1').content.strip.split(" ")[0] - entries << [klass, klass, name] + css('.detail-header .signature').map do |node| + id = node.parent['id'] + name = node.content.strip + name.remove! %r{\(.*\)} + name.remove! 'left ' + name.remove! ' right' + name.sub! 'sigil_', '~' - # Add functions - css('.summary-functions .summary-signature a').each do |node| - entries << [(name + node['href']), node['href'][1..-1], name] - end + unless node.parent['class'].end_with?('macro') || self.name.start_with?('Kernel') + name.prepend "#{self.name}." + name << " (#{id.split('/').last})" + end - return entries - end - - def include_default_entry? - !initial_page? + [name, id] + end end end end diff --git a/lib/docs/scrapers/elixir.rb b/lib/docs/scrapers/elixir.rb index e427002f..d78d1388 100644 --- a/lib/docs/scrapers/elixir.rb +++ b/lib/docs/scrapers/elixir.rb @@ -3,34 +3,29 @@ module Docs 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.base_url = 'http://elixir-lang.org/docs/stable/' + self.root_path = 'elixir/extra-api-reference.html' + self.initial_paths = %w( + eex/EEx.html + ex_unit/ExUnit.html + iex/IEx.html + logger/Logger.html + mix/Mix.html + ) self.links = { - home: 'https://elixir-lang.org/', + home: 'http://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 © 2012 Plataformatec
- Licensed under the Apache License, Version 2.0 + Licensed under the Apache License, Version 2.0. HTML end end diff --git a/public/icons/docs/elixir/16.png b/public/icons/docs/elixir/16.png index eeef08a3..5a980afa 100644 Binary files a/public/icons/docs/elixir/16.png and b/public/icons/docs/elixir/16.png differ diff --git a/public/icons/docs/elixir/16@2x.png b/public/icons/docs/elixir/16@2x.png index ed3e8ae8..f808dc9b 100644 Binary files a/public/icons/docs/elixir/16@2x.png and b/public/icons/docs/elixir/16@2x.png differ