52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
# File 'lib/rundoc/code_section.rb', line 52
def render
result = []
env = {}
env[:commands] = []
env[:fence_start] = "#{fence}#{lang}"
env[:fence_end] = "#{fence}#{AUTOGEN_WARNING}"
env[:before] = []
env[:after] = []
env[:context] = @context
@stack.each do |s|
unless s.respond_to?(:call)
result << s
next
end
code_command = s
code_output = code_command.call(env) || ""
code_line = code_command.to_md(env) || ""
env[:commands] << {object: code_command, output: code_output, command: code_line}
tmp_result = []
tmp_result << code_line if code_command.render_command?
tmp_result << code_output if code_command.render_result?
result << tmp_result unless code_command.hidden?
PARTIAL_RESULT.replace(result)
PARTIAL_ENV.replace(env)
end
return "" if hidden?
self.class.to_doc(result: result, env: env)
end
|