mirror of https://github.com/freeCodeCamp/devdocs
parent
4b9256a731
commit
cf7f446738
@ -1,16 +0,0 @@
|
||||
module Docs
|
||||
class HomeUrlFilter < Filter
|
||||
def call
|
||||
html.prepend(home_url_html) if home_url
|
||||
html
|
||||
end
|
||||
|
||||
def home_url_html
|
||||
<<-HTML.strip_heredoc
|
||||
<div class="_official">
|
||||
Official Documentation: <a href="#{home_url}" class="_official-link">#{home_url}</a>
|
||||
</div>
|
||||
HTML
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,26 @@
|
||||
module Docs
|
||||
class LinksFilter < Filter
|
||||
def call
|
||||
html.prepend(links_html) if links
|
||||
html
|
||||
end
|
||||
|
||||
NAMES = {
|
||||
home: 'Homepage',
|
||||
code: 'Source code'
|
||||
}
|
||||
|
||||
def links_html
|
||||
links = self.links.map do |name, link|
|
||||
%(<li><a href="#{link}" class="_toc-link">#{NAMES[name]}</a></li>)
|
||||
end
|
||||
|
||||
<<-HTML.strip_heredoc
|
||||
<div class="_toc">
|
||||
<div class="_toc-title">Resources</div>
|
||||
<ul class="_toc-list">#{links.join}</ul>
|
||||
</div>
|
||||
HTML
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in new issue