Class: Card::Content::Chunk::Link
Constant Summary
collapse
- CODE =
"L".freeze
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Reference
clean, insert_in_slices, map_referees, recreate_all, #referee, #referer, repair_all, unmap_referees
Instance Attribute Details
#link_text ⇒ Object
Returns the value of attribute link_text.
10
11
12
|
# File 'mod/content/lib/card/content/chunk/link.rb', line 10
def link_text
@link_text
end
|
Instance Method Details
#explicit_link? ⇒ Boolean
41
42
43
|
# File 'mod/content/lib/card/content/chunk/link.rb', line 41
def explicit_link?
@explicit_link
end
|
24
25
26
27
|
# File 'mod/content/lib/card/content/chunk/link.rb', line 24
def inspect
"<##{self.class}:e[#{@explicit_link}]n[#{@name}]l[#{@link_text}]" \
"p[#{@process_chunk}] txt:#{@text}>"
end
|
#link_target ⇒ Object
55
56
57
58
59
60
61
|
# File 'mod/content/lib/card/content/chunk/link.rb', line 55
def link_target
if @explicit_link
render_obj @explicit_link
elsif @name
referee_name
end
end
|
30
31
32
|
# File 'mod/content/lib/card/content/chunk/link.rb', line 30
def options
{ title: link_text || @name.to_name.fully_stripped }
end
|
#process_chunk ⇒ Object
20
21
22
|
# File 'mod/content/lib/card/content/chunk/link.rb', line 20
def process_chunk
@process_chunk ||= render_link
end
|
#reference_code ⇒ Object
16
17
18
|
# File 'mod/content/lib/card/content/chunk/link.rb', line 16
def reference_code
CODE
end
|
#render_link(view: :link, explicit_link_opts: {}) ⇒ Object
45
46
47
48
49
50
51
52
53
|
# File 'mod/content/lib/card/content/chunk/link.rb', line 45
def render_link view: :link, explicit_link_opts: {}
@link_text = render_obj @link_text
if @explicit_link
render_explicit_link explicit_link_opts
elsif @name
render_name_link view
end
end
|
#swap_name(old_name, new_name) ⇒ Object
34
35
36
37
38
39
|
# File 'mod/content/lib/card/content/chunk/link.rb', line 34
def swap_name old_name, new_name
replace_name_reference old_name, new_name
replace_link_text old_name, new_name
link_text_syntax = "|#{@link_text}" if @link_text.present?
@text = "[[#{referee_name}#{link_text_syntax}]]"
end
|