Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #493 from kmuto/converter
use ReVIEW::Converter instead of system("review-compile ...")
- Loading branch information
Showing
5 changed files
with
74 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# encoding: utf-8 | ||
# | ||
# This program is free software. | ||
# You can distribute or modify this program under the terms of | ||
# the GNU LGPL, Lesser General Public License version 2.1. | ||
# | ||
|
||
module ReVIEW | ||
class Converter | ||
attr_accessor :target | ||
|
||
def initialize(book, builder) | ||
@book = book | ||
@compiler = ReVIEW::Compiler.new(builder) | ||
end | ||
|
||
def convert(file, output_path) | ||
chap_name = File.basename(file, '.*') | ||
chap = @book.chapter(chap_name) | ||
result = @compiler.compile(chap) | ||
File.open(output_path, 'w') do |f| | ||
f.puts result | ||
end | ||
end | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters