Adding Official Url for url scrapped documentations

This commit is contained in:
Thu Trang Pham 2015-02-27 16:22:38 -05:00
parent dfdd4f373e
commit 0dc8cfd5d3
3 changed files with 34 additions and 1 deletions

View file

@ -22,6 +22,24 @@
}
}
//
// Official Website box
//
._official {
clear: both;
margin: 2rem 0 1.5rem;
font-size: .75rem;
color: $textColorLight;
text-align: center;
-webkit-font-smoothing: subpixel-antialiased;
& + & { margin-top: 1.5rem; }
& + & > ._attribution-link { display: none; }
}
._official-link { @extend %external-link; }
//
// Attribution box
//

View file

@ -34,7 +34,7 @@ module Docs
self.text_filters = FilterStack.new
html_filters.push 'container', 'clean_html', 'normalize_urls', 'internal_urls', 'normalize_paths'
text_filters.push 'inner_html', 'clean_text', 'attribution'
text_filters.push 'official_url', 'inner_html', 'clean_text', 'attribution'
def build_page(path)
response = request_one url_for(path)

View file

@ -0,0 +1,15 @@
module Docs
class OfficialUrlFilter < Filter
def call
official_url_html << html if base_url
end
def official_url_html
<<-HTML.strip_heredoc
<div class="_official">
Official Documentation: <a href="#{base_url}" class="_official-link">#{base_url}</a>
</div>
HTML
end
end
end