15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/commonmarker/node/inspect.rb', line 15
def pretty_print(printer)
printer.group(PP_INDENT_SIZE, "#<#{self.class}(#{type}):", ">") do
printer.breakable
attrs = [
:source_position,
:string_content,
:url,
:title,
:header_level,
:list_type,
:list_start,
:list_tight,
:fence_info,
].filter_map do |name|
[name, __send__(name)]
rescue StandardError
nil
end.compact
printer.seplist(attrs) do |name, value|
printer.text("#{name}=")
printer.pp(value)
end
if first_child
printer.breakable
printer.group(PP_INDENT_SIZE) do
children = []
node = first_child
while node
children << node
node = node.next_sibling
end
printer.text("children=")
printer.pp(children)
end
end
end
end
|