diff --git a/lib/review/builder.rb b/lib/review/builder.rb index d03ba6a38..c9844b45a 100644 --- a/lib/review/builder.rb +++ b/lib/review/builder.rb @@ -404,7 +404,12 @@ def inline_w(s) end def inline_wb(s) - inline_b(unescape(inline_w(s))) + translated = @dictionary[s] + if translated + inline_b(translated) + else + inline_b("[missing word: #{s}]") + end end def raw(str) @@ -504,13 +509,13 @@ def graph(lines, id, command, caption = '') file = "#{id}.#{image_ext}" file_path = File.join(dir, file) - line = self.unescape(lines.join("\n")) + content = lines.join("\n") + "\n" tf = Tempfile.new('review_graph') - tf.puts line + tf.puts content tf.close begin - file_path = send("graph_#{command}".to_sym, id, file_path, line, tf.path) + file_path = send("graph_#{command}".to_sym, id, file_path, content, tf.path) ensure tf.unlink end @@ -634,9 +639,5 @@ def detab(str, num = nil) def escape(str) str end - - def unescape(str) - str - end end end # module ReVIEW diff --git a/lib/review/compiler.rb b/lib/review/compiler.rb index e1d7c9371..7cd425029 100644 --- a/lib/review/compiler.rb +++ b/lib/review/compiler.rb @@ -422,7 +422,7 @@ def compile_paragraph(f) def read_command(f) line = f.gets name = line.slice(/[a-z]+/).to_sym - ignore_inline = (name == :embed) || (name == :texequation) + ignore_inline = %i[embed texequation graph].include?(name) args = parse_args(line.sub(%r{\A//[a-z]+}, '').rstrip.chomp('{'), name) @strategy.doc_status[name] = true lines = block_open?(line) ? read_block(f, ignore_inline) : nil