Skip to content

Commit

Permalink
Store partial results in memory
Browse files Browse the repository at this point in the history
  • Loading branch information
schneems committed Nov 20, 2024
1 parent d5c291c commit f611aca
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/rundoc/code_section.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ def initialize(options = {})
AUTOGEN_WARNING = "\n<!-- STOP. This document is autogenerated. Do not manually modify. See the top of the doc for more details. -->"
attr_accessor :original, :fence, :lang, :code, :commands, :keyword

PARTIAL_RESULT = []
PARTIAL_ENV = {}

def initialize(match, keyword:, context:)
@original = match.to_s
@commands = []
Expand All @@ -40,6 +43,8 @@ def initialize(match, keyword:, context:)
@lang = match[:lang]
@code = match[:contents]
parse_code_command
PARTIAL_RESULT.clear
PARTIAL_ENV.clear
end

def render
Expand Down Expand Up @@ -69,6 +74,9 @@ def render
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?
Expand Down

0 comments on commit f611aca

Please sign in to comment.