Class: Marker::ExternalLink
- Inherits:
-
ParseNode
- Object
- Treetop::Runtime::SyntaxNode
- ParseNode
- Marker::ExternalLink
- Defined in:
- lib/marker/links.rb
Instance Method Summary collapse
-
#l ⇒ Object
:nodoc:.
- #label(format, options = {}) ⇒ Object
-
#t ⇒ Object
– defaults ++.
- #target ⇒ Object
- #to_html(options = {}) ⇒ Object
- #to_s(options = {}) ⇒ Object
Methods inherited from Treetop::Runtime::SyntaxNode
Instance Method Details
#l ⇒ Object
:nodoc:
133 134 135 |
# File 'lib/marker/links.rb', line 133 def l #:nodoc: nil end |
#label(format, options = {}) ⇒ Object
107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/marker/links.rb', line 107 def label( format, = {} ) if l case format when :html l.to_html() else l.to_s() end else '' end end |
#t ⇒ Object
– defaults ++
129 130 131 |
# File 'lib/marker/links.rb', line 129 def t #:nodoc: nil end |
#target ⇒ Object
120 121 122 123 124 125 126 |
# File 'lib/marker/links.rb', line 120 def target if t t.text_value else '' end end |
#to_html(options = {}) ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/marker/links.rb', line 74 def to_html( = {} ) if l "<a href='#{target}'>#{label(:html, )}</a>" else f = [:footnotes] if f n = f.add( target ) "<a href='#{target}'>[#{n}]</a>" else "<a href='#{target}'>#{target}</a>" end end end |
#to_s(options = {}) ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/marker/links.rb', line 88 def to_s( = {} ) f = [:footnotes] if l if f n = f.add( target, label(:text, ) ) "#{label(:text, )} [#{n}]" else "#{label(:text, )} [#{target}]" end else if f n = f.add( target ) "[#{n}]" else target end end end |