From 4d70a5dda48fdc2d05643a18ffa86b0b6aa6f79d Mon Sep 17 00:00:00 2001 From: Masanori Kado Date: Mon, 24 Feb 2020 16:35:30 +0900 Subject: [PATCH] Pass a setting of config to tocparser when using review-index --- lib/review/tocparser.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/review/tocparser.rb b/lib/review/tocparser.rb index a18e35554..d84729769 100644 --- a/lib/review/tocparser.rb +++ b/lib/review/tocparser.rb @@ -31,6 +31,7 @@ def self.chapter_node(chap) def parse(f, chap) roots = [] # list of chapters node_stack = [] + @chap = chap filename = chap.path while line = f.gets case line @@ -107,6 +108,9 @@ def compile_label(line) b = ReVIEW::TEXTBuilder.new dummy_book = ReVIEW::Book::Base.load dummy_chapter = ReVIEW::Book::Chapter.new(dummy_book, 1, '-', nil, StringIO.new) + if @chap + dummy_chapter = @chap + end dummy_loc = Location.new('', StringIO.new) b.bind(ReVIEW::Compiler.new(b), dummy_chapter, dummy_loc) b.compile_inline(line)