Class: JekyllSupport::HRefTag
- Inherits:
-
JekyllTag
- Object
- JekyllTag
- JekyllSupport::HRefTag
- Includes:
- Comparable, HashArray, JekyllHrefVersion
- Defined in:
- lib/href_tag.rb,
lib/href_match.rb,
lib/href_private.rb,
lib/href_summary.rb,
lib/href_page_title.rb
Overview
Implements href Jekyll tag
Constant Summary
Constants included from JekyllHrefVersion
Instance Attribute Summary collapse
-
#follow ⇒ Object
readonly
Returns the value of attribute follow.
-
#helper ⇒ Object
readonly
Returns the value of attribute helper.
-
#line_number ⇒ Object
readonly
Returns the value of attribute line_number.
-
#link ⇒ Object
Returns the value of attribute link.
-
#link_save ⇒ Object
readonly
Returns the value of attribute link_save.
-
#match ⇒ Object
readonly
Returns the value of attribute match.
-
#page ⇒ Object
readonly
Returns the value of attribute page.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#site ⇒ Object
readonly
Returns the value of attribute site.
-
#summary ⇒ Object
readonly
Returns the value of attribute summary.
-
#summary_exclude ⇒ Object
readonly
Returns the value of attribute summary_exclude.
-
#summary_href ⇒ Object
readonly
Returns the value of attribute summary_href.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#render_impl ⇒ String
Method prescribed by the Jekyll plugin lifecycle.
- #to_s ⇒ Object
Methods included from HashArray
#add_global_link_for_page, add_global_link_for_page, add_link_for_page, #add_local_link_for_page, add_local_link_for_page, #reset, reset
Instance Attribute Details
#follow ⇒ Object (readonly)
Returns the value of attribute follow.
21 22 23 |
# File 'lib/href_tag.rb', line 21 def follow @follow end |
#helper ⇒ Object (readonly)
Returns the value of attribute helper.
21 22 23 |
# File 'lib/href_tag.rb', line 21 def helper @helper end |
#line_number ⇒ Object (readonly)
Returns the value of attribute line_number.
21 22 23 |
# File 'lib/href_tag.rb', line 21 def line_number @line_number end |
#link ⇒ Object
Returns the value of attribute link.
23 24 25 |
# File 'lib/href_tag.rb', line 23 def link @link end |
#link_save ⇒ Object (readonly)
Returns the value of attribute link_save.
21 22 23 |
# File 'lib/href_tag.rb', line 21 def link_save @link_save end |
#match ⇒ Object (readonly)
Returns the value of attribute match.
21 22 23 |
# File 'lib/href_tag.rb', line 21 def match @match end |
#page ⇒ Object (readonly)
Returns the value of attribute page.
21 22 23 |
# File 'lib/href_tag.rb', line 21 def page @page end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
21 22 23 |
# File 'lib/href_tag.rb', line 21 def path @path end |
#site ⇒ Object (readonly)
Returns the value of attribute site.
21 22 23 |
# File 'lib/href_tag.rb', line 21 def site @site end |
#summary ⇒ Object (readonly)
Returns the value of attribute summary.
21 22 23 |
# File 'lib/href_tag.rb', line 21 def summary @summary end |
#summary_exclude ⇒ Object (readonly)
Returns the value of attribute summary_exclude.
21 22 23 |
# File 'lib/href_tag.rb', line 21 def summary_exclude @summary_exclude end |
#summary_href ⇒ Object (readonly)
Returns the value of attribute summary_href.
21 22 23 |
# File 'lib/href_tag.rb', line 21 def summary_href @summary_href end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
21 22 23 |
# File 'lib/href_tag.rb', line 21 def target @target end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
21 22 23 |
# File 'lib/href_tag.rb', line 21 def text @text end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
21 22 23 |
# File 'lib/href_tag.rb', line 21 def url @url end |
Instance Method Details
#<=>(other) ⇒ Object
29 30 31 32 33 |
# File 'lib/href_tag.rb', line 29 def <=>(other) return nil unless other.is_a?(self.class) [follow, match, path, target, text] <=> [other.follow, other.match, other.path, other.target, other.text] end |
#render_impl ⇒ String
Method prescribed by the Jekyll plugin lifecycle.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/href_tag.rb', line 38 def render_impl globals_initial linkk, error_msg = compute_linkk return error_msg unless linkk linkk.delete_prefix './' # normalize relative links @url = linkk if @url @link_save = linkk @helper_save = @helper.clone globals_update(@helper.argv, linkk) # Sets @link and @text, might clear @follow and @target handle_match(linkk) if @match # Sets @text if not set by now raise HrefError, '@link_type was not set' if @link_type == LinkType::UNKNOWN save_summary klass = " class='#{@klass}'" if @klass style = " style='#{@style}'" if @style "<a href='#{@link}'#{klass}#{style}#{@target}#{@follow}>#{@text}</a>" rescue HRefError => e # jekyll_plugin_support handles StandardError @logger.error { e. } exit 1 if @die_on_demo_tag_error e. end |
#to_s ⇒ Object
63 64 65 |
# File 'lib/href_tag.rb', line 63 def to_s "On line #{line_number} of #{path}: #{follow} #{match} #{target} #{link} => '#{text}'" end |