mirror of
https://github.com/freeCodeCamp/devdocs
synced 2024-11-16 19:48:10 +01:00
Adding Official Url for url scrapped documentations
This commit is contained in:
parent
dfdd4f373e
commit
0dc8cfd5d3
3 changed files with 34 additions and 1 deletions
|
@ -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
|
||||
//
|
||||
|
|
|
@ -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)
|
||||
|
|
15
lib/docs/filters/core/official_url.rb
Normal file
15
lib/docs/filters/core/official_url.rb
Normal 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
|
Loading…
Reference in a new issue