This implements #763 just for Elixir without solving the general issue. The style used is similar to the one of the Go docs.
Unified · Split
| @@ -4,4 +4,9 @@ · 3 unmodified lines | ||
| 4 | 4 | .type-detail { margin-bottom: 2em; } |
| 5 | 5 | .type-detail pre { margin-left: -1rem; } |
| 6 | 6 | ._mobile & .type-detail pre { margin-left: 0; } |
| 7 | + | |
| 8 | + a.source { | |
| 9 | + float: right; | |
| 10 | + font-size: .9em; | |
| 11 | + } | |
| 7 | 12 | } |
| @@ -25,7 +25,7 @@ module Docs · 24 unmodified lines | ||
| 25 | 25 | end |
| 26 | 26 | |
| 27 | 27 | def api |
| 28 | − css('.hover-link', '.view-source', 'footer').remove | |
| 28 | + css('.hover-link', 'footer', ':not(.detail-header) > .view-source').remove | |
| 29 | 29 | |
| 30 | 30 | css('.summary').each do |node| |
| 31 | 31 | node.name = 'dl' |
| @@ -51,7 +51,11 @@ module Docs · 19 unmodified lines | ||
| 51 | 51 | detail.css('.detail-header').each do |node| |
| 52 | 52 | node.name = 'h3' |
| 53 | 53 | node['id'] = id |
| 54 | + | |
| 55 | + source_href = node.at_css('.view-source').attr('href') | |
| 56 | + | |
| 54 | 57 | node.content = node.at_css('.signature').inner_text |
| 58 | + node << %(<a href="#{source_href}" class="source">Source</a>) | |
| 55 | 59 | end |
| 56 | 60 | |
| 57 | 61 | detail.css('.docstring h2').each do |node| |
| @@ -45,7 +45,8 @@ module Docs · 44 unmodified lines | ||
| 45 | 45 | |
| 46 | 46 | css('.detail-header').map do |node| |
| 47 | 47 | id = node['id'] |
| 48 | − name = node.content.strip | |
| 48 | + # ignore text of children, i.e. source link | |
| 49 | + name = node.children.select(&:text?).map(&:content).join.strip | |
| 49 | 50 | |
| 50 | 51 | name.remove! %r{\(.*\)} |
| 51 | 52 | name.remove! 'left ' |