Class: Marker::InternalLink
- Inherits:
-
ParseNode
- Object
- Treetop::Runtime::SyntaxNode
- ParseNode
- Marker::InternalLink
- Defined in:
- lib/marker/links.rb
Instance Method Summary collapse
-
#a ⇒ Object
:nodoc:.
-
#l ⇒ Object
:nodoc:.
- #label(format, options = {}) ⇒ Object
- #path(options = {}) ⇒ Object
-
#t ⇒ Object
– defaults ++.
- #target ⇒ Object
- #to_html(options = {}) ⇒ Object
- #to_s(options = {}) ⇒ Object
Methods inherited from Treetop::Runtime::SyntaxNode
Instance Method Details
#a ⇒ Object
:nodoc:
64 65 66 |
# File 'lib/marker/links.rb', line 64 def a #:nodoc: nil end |
#l ⇒ Object
:nodoc:
68 69 70 |
# File 'lib/marker/links.rb', line 68 def l #:nodoc: nil end |
#label(format, options = {}) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/marker/links.rb', line 32 def label( format, = {} ) if l case format when :html l.to_html() else l.to_s() end else if a # an arg delimiter was present, but without a label # sanitize: remove trailing parenthetical remarks target.gsub(/\s*\([^)]*\)$/, '') else target end end end |
#path(options = {}) ⇒ Object
26 27 28 29 30 |
# File 'lib/marker/links.rb', line 26 def path( = {} ) p = [:link_base] || '' p.chomp! '/' p += '/' + target end |
#t ⇒ Object
– defaults ++
60 61 62 |
# File 'lib/marker/links.rb', line 60 def t #:nodoc: nil end |
#target ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/marker/links.rb', line 51 def target if t t.text_value else '' end end |
#to_html(options = {}) ⇒ Object
11 12 13 |
# File 'lib/marker/links.rb', line 11 def to_html( = {} ) "<a href='#{path()}'>#{label(:html, )}</a>" end |
#to_s(options = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/marker/links.rb', line 15 def to_s( = {} ) f = [:footnotes] if f l = label(:text, ) n = f.add( path(), l ) "#{l} [#{n}]" else "#{label(:text, )} [#{path}]" end end |