Class: Rabbit::Parser::RD::Ext::InlineVerbatim
Constant Summary
collapse
- Inline =
Parser::Ext::Inline
CharacterReference::TABLE
Instance Method Summary
collapse
-
#apply_inline_markup(visitor, text) ⇒ Object
-
#apply_inline_verbatim(visitor, text) ⇒ Object
-
#default_ext_inline_verbatim(label, source, content, visitor) ⇒ Object
-
#ext_inline_verb_del(label, source, content, visitor) ⇒ Object
-
#ext_inline_verb_lang(label, source, content, visitor) ⇒ Object
-
#ext_inline_verb_note(label, source, content, visitor) ⇒ Object
-
#ext_inline_verb_quote(label, source, content, visitor) ⇒ Object
def ext_inline_verb_img(label, content, visitor) img(label, content, visitor) end.
-
#ext_inline_verb_sub(label, source, content, visitor) ⇒ Object
-
#ext_inline_verb_sup(label, source, content, visitor) ⇒ Object
-
#ext_inline_verb_tag(label, source, content, visitor) ⇒ Object
-
#ext_inline_verb_wait(label, source, content, visitor) ⇒ Object
Methods included from Utils
arg_list, collect_classes_under_module, collect_modules_under_module, collect_under_module, combination, compute_bottom_y, compute_left_x, compute_right_x, compute_top_y, corresponding_class_under_module, corresponding_module_under_module, corresponding_objects, ensure_time, events_pending_available?, extract_four_way, find_path_in_load_path, init_by_constants_as_default_value, move_to, move_to_bottom_left, move_to_bottom_right, move_to_top_left, move_to_top_right, parse_four_way, process_pending_events, process_pending_events_proc, quartz?, require_files_under_directory_in_load_path, require_safe, split_number_to_minute_and_second, stringify_hash_key, support_console_input?, support_console_output?, syntax_highlighting_debug?, time, to_class_name, unescape_title, windows?
#ext_inline_verb_character_entity_reference, #ext_inline_verb_numeric_character_reference, included
Methods included from Image
#img, #make_image_from_file
Methods included from Ext::Image
make_image, make_image_from_file
Methods inherited from Base
add_extension, #apply, extensions, #extensions, inherited, method_added
Instance Method Details
permalink
#apply_inline_markup(visitor, text) ⇒ Object
[View source]
26
27
28
29
|
# File 'lib/rabbit/parser/rd/ext/inline-verbatim.rb', line 26
def apply_inline_markup(visitor, text)
tree = ::RD::RDTree.new("=begin\n#{text}\n=end\n")
TextContainer.new(tree.root.children[0].accept(visitor).elements)
end
|
permalink
#apply_inline_verbatim(visitor, text) ⇒ Object
[View source]
22
23
24
|
# File 'lib/rabbit/parser/rd/ext/inline-verbatim.rb', line 22
def apply_inline_verbatim(visitor, text)
visitor.apply_to_Verb(::RD::Verb.new(text))
end
|
permalink
#default_ext_inline_verbatim(label, source, content, visitor) ⇒ Object
[View source]
18
19
20
|
# File 'lib/rabbit/parser/rd/ext/inline-verbatim.rb', line 18
def default_ext_inline_verbatim(label, source, content, visitor)
Text.new(source)
end
|
permalink
#ext_inline_verb_del(label, source, content, visitor) ⇒ Object
[View source]
41
42
43
44
45
|
# File 'lib/rabbit/parser/rd/ext/inline-verbatim.rb', line 41
def ext_inline_verb_del(label, source, content, visitor)
label = label.to_s
return nil unless /^del:(.*)$/ =~ label
DeletedText.new(apply_inline_markup(visitor, $1))
end
|
permalink
#ext_inline_verb_lang(label, source, content, visitor) ⇒ Object
[View source]
68
69
70
71
72
|
# File 'lib/rabbit/parser/rd/ext/inline-verbatim.rb', line 68
def ext_inline_verb_lang(label, source, content, visitor)
label = label.to_s
return nil unless /^lang:([a-z]{2,2}):(.*)$/ =~ label
Inline.lang($1, apply_inline_markup(visitor, $2))
end
|
permalink
#ext_inline_verb_note(label, source, content, visitor) ⇒ Object
[View source]
61
62
63
64
65
66
|
# File 'lib/rabbit/parser/rd/ext/inline-verbatim.rb', line 61
def ext_inline_verb_note(label, source, content, visitor)
label = label.to_s
return nil unless /^note:(.*)$/ =~ label
target = apply_inline_markup(visitor, $1)
Inline.note(target)
end
|
permalink
#ext_inline_verb_quote(label, source, content, visitor) ⇒ Object
def ext_inline_verb_img(label, content, visitor)
img(label, content, visitor)
end
[View source]
35
36
37
38
39
|
# File 'lib/rabbit/parser/rd/ext/inline-verbatim.rb', line 35
def ext_inline_verb_quote(label, source, content, visitor)
label = label.to_s
return nil unless /^quote:(.*)$/ =~ label
default_ext_inline_verb($1, visitor.apply_to_String($1), $1, visitor)
end
|
permalink
#ext_inline_verb_sub(label, source, content, visitor) ⇒ Object
[View source]
47
48
49
50
51
52
|
# File 'lib/rabbit/parser/rd/ext/inline-verbatim.rb', line 47
def ext_inline_verb_sub(label, source, content, visitor)
label = label.to_s
return nil unless /^sub:(.*)$/ =~ label
sub_text = apply_inline_markup(visitor, $1)
Inline.sub(sub_text)
end
|
permalink
#ext_inline_verb_sup(label, source, content, visitor) ⇒ Object
[View source]
54
55
56
57
58
59
|
# File 'lib/rabbit/parser/rd/ext/inline-verbatim.rb', line 54
def ext_inline_verb_sup(label, source, content, visitor)
label = label.to_s
return nil unless /^sup:(.*)$/ =~ label
sup_text = apply_inline_markup(visitor, $1)
Inline.sup(sup_text)
end
|
permalink
#ext_inline_verb_tag(label, source, content, visitor) ⇒ Object
[View source]
80
81
82
83
84
85
86
87
88
89
90
|
# File 'lib/rabbit/parser/rd/ext/inline-verbatim.rb', line 80
def ext_inline_verb_tag(label, source, content, visitor)
label = label.to_s
return nil unless /^tag:(.+?)(?::(.+))?$/ =~ label
name = $1
content = $2
if content
CustomTag.new(name, apply_inline_markup(visitor, content))
else
CustomTag.new(name)
end
end
|
permalink
#ext_inline_verb_wait(label, source, content, visitor) ⇒ Object
[View source]
74
75
76
77
78
|
# File 'lib/rabbit/parser/rd/ext/inline-verbatim.rb', line 74
def ext_inline_verb_wait(label, source, content, visitor)
label = label.to_s
return nil unless /^wait$/ =~ label
WaitTag.new
end
|