From 0dc8cfd5d349b08c95888d9a5ce2341508d2f0c3 Mon Sep 17 00:00:00 2001 From: Thu Trang Pham Date: Fri, 27 Feb 2015 16:22:38 -0500 Subject: [PATCH] Adding Official Url for url scrapped documentations --- assets/stylesheets/components/_page.scss | 18 ++++++++++++++++++ lib/docs/core/scraper.rb | 2 +- lib/docs/filters/core/official_url.rb | 15 +++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 lib/docs/filters/core/official_url.rb diff --git a/assets/stylesheets/components/_page.scss b/assets/stylesheets/components/_page.scss index 30935d85..f40a0022 100644 --- a/assets/stylesheets/components/_page.scss +++ b/assets/stylesheets/components/_page.scss @@ -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 // diff --git a/lib/docs/core/scraper.rb b/lib/docs/core/scraper.rb index 634ee857..93861575 100644 --- a/lib/docs/core/scraper.rb +++ b/lib/docs/core/scraper.rb @@ -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) diff --git a/lib/docs/filters/core/official_url.rb b/lib/docs/filters/core/official_url.rb new file mode 100644 index 00000000..9b3097ae --- /dev/null +++ b/lib/docs/filters/core/official_url.rb @@ -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 +
+ Official Documentation: #{base_url} +
+ HTML + end + end +end