Class: Jekyll::Documents::DocLinkTag
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Jekyll::Documents::DocLinkTag
- Includes:
- Filters::URLFilters
- Defined in:
- lib/jekyll/documents/tags/doc_link.rb
Constant Summary collapse
- SIZE_UNITS =
%w[B KB MB GB].freeze
Instance Method Summary collapse
-
#initialize(tag_name, markup, tokens) ⇒ DocLinkTag
constructor
A new instance of DocLinkTag.
- #render(context) ⇒ Object
Constructor Details
#initialize(tag_name, markup, tokens) ⇒ DocLinkTag
Returns a new instance of DocLinkTag.
12 13 14 15 |
# File 'lib/jekyll/documents/tags/doc_link.rb', line 12 def initialize(tag_name, markup, tokens) super @query, @options = parse_markup(markup) end |
Instance Method Details
#render(context) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/jekyll/documents/tags/doc_link.rb', line 17 def render(context) docs = documents_from(context) return "" if docs.empty? match = find_document(docs, @query) return "" unless match @context = context url = relative_url(match.url) text = @options["text"] || match.data["title"] build_link(match, url, text) end |