lib/review/img_math.rb in review-5.6.0 vs lib/review/img_math.rb in review-5.7.0

- old
+ new

@@ -1,5 +1,12 @@ +# +# Copyright (c) 2021-2023 Masayoshi Takahashi, Kenshi Muto +# +# This program is free software. +# You can distribute/modify this program under the terms of +# the GNU LGPL, Lesser General Public License version 2.1. +# require 'fileutils' require 'shellwords' require 'review/loggable' module ReVIEW @@ -27,11 +34,11 @@ def make_math_image(str, key, fontsize = 12) # Re:VIEW 2 compatibility img_path = File.join(@math_dir, "_gen_#{key}.#{@config['imgmath_options']['format']}") - Dir.mkdir(@math_dir) unless Dir.exist?(@math_dir) + FileUtils.mkdir_p(@math_dir) fontsize2 = (fontsize * 1.2).round.to_i texsrc = <<-EOB \\documentclass[12pt]{article} \\usepackage[utf8]{inputenc} \\usepackage{amsmath} @@ -61,10 +68,10 @@ end def make_math_images return if @math_maps.empty? - Dir.mkdir(@math_dir) unless Dir.exist?(@math_dir) + FileUtils.mkdir_p(@math_dir) fontsize = @config['imgmath_options']['fontsize'].to_f lineheight = @config['imgmath_options']['lineheight'].to_f texsrc = default_imgmath_preamble if @config['imgmath_options']['preamble_file'] && File.readable?(@config['imgmath_options']['preamble_file'])