[ruby/rdoc] Use Tempfile
https://github.com/ruby/rdoc/commit/0b9dde5ab4
This commit is contained in:
parent
d752cf7601
commit
c87b3ee671
Notes:
git
2022-11-30 17:36:40 +00:00
@ -18,8 +18,6 @@ class BlockParser < Racc::Parser
|
|||||||
|
|
||||||
# :stopdoc:
|
# :stopdoc:
|
||||||
|
|
||||||
TMPFILE = ["rdtmp", $$, 0]
|
|
||||||
|
|
||||||
MARK_TO_LEVEL = {
|
MARK_TO_LEVEL = {
|
||||||
'=' => 1,
|
'=' => 1,
|
||||||
'==' => 2,
|
'==' => 2,
|
||||||
@ -148,11 +146,10 @@ def next_token # :nodoc:
|
|||||||
if @tree.filter[@in_part].mode == :rd # if output is RD formatted
|
if @tree.filter[@in_part].mode == :rd # if output is RD formatted
|
||||||
subtree = parse_subtree(part_out.to_a)
|
subtree = parse_subtree(part_out.to_a)
|
||||||
else # if output is target formatted
|
else # if output is target formatted
|
||||||
basename = TMPFILE.join('.')
|
basename = Tempfile.create(["rdtmp", ".#{@in_part}"], @tree.tmp_dir) do |tmpfile|
|
||||||
TMPFILE[-1] += 1
|
|
||||||
tmpfile = open(@tree.tmp_dir + "/" + basename + ".#{@in_part}", "w")
|
|
||||||
tmpfile.print(part_out)
|
tmpfile.print(part_out)
|
||||||
tmpfile.close
|
File.basename(tmpfile.path)
|
||||||
|
end
|
||||||
subtree = parse_subtree(["=begin\n", "<<< #{basename}\n", "=end\n"])
|
subtree = parse_subtree(["=begin\n", "<<< #{basename}\n", "=end\n"])
|
||||||
end
|
end
|
||||||
@in_part = nil
|
@in_part = nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user