diff --git a/assets/stylesheets/pages/_elixir.scss b/assets/stylesheets/pages/_elixir.scss index 4c38e936..240bbd83 100644 --- a/assets/stylesheets/pages/_elixir.scss +++ b/assets/stylesheets/pages/_elixir.scss @@ -4,4 +4,9 @@ .type-detail { margin-bottom: 2em; } .type-detail pre { margin-left: -1rem; } ._mobile & .type-detail pre { margin-left: 0; } + + a.source { + float: right; + font-size: .9em; + } } diff --git a/lib/docs/filters/elixir/clean_html.rb b/lib/docs/filters/elixir/clean_html.rb index 47cec84c..e357f3df 100644 --- a/lib/docs/filters/elixir/clean_html.rb +++ b/lib/docs/filters/elixir/clean_html.rb @@ -25,7 +25,7 @@ module Docs end def api - css('.hover-link', '.view-source', 'footer').remove + css('.hover-link', 'footer', ':not(.detail-header) > .view-source').remove css('.summary').each do |node| node.name = 'dl' @@ -51,7 +51,11 @@ module Docs detail.css('.detail-header').each do |node| node.name = 'h3' node['id'] = id + + source_href = node.at_css('.view-source').attr('href') + node.content = node.at_css('.signature').inner_text + node << %(Source) end detail.css('.docstring h2').each do |node| diff --git a/lib/docs/filters/elixir/entries.rb b/lib/docs/filters/elixir/entries.rb index 24fd9415..91caa237 100644 --- a/lib/docs/filters/elixir/entries.rb +++ b/lib/docs/filters/elixir/entries.rb @@ -45,7 +45,8 @@ module Docs css('.detail-header').map do |node| id = node['id'] - name = node.content.strip + # ignore text of children, i.e. source link + name = node.children.select(&:text?).map(&:content).join.strip name.remove! %r{\(.*\)} name.remove! 'left '