samples/sample-book/src/lib/tasks/review.rake in review-3.2.0 vs samples/sample-book/src/lib/tasks/review.rake in review-4.0.0
- old
+ new
@@ -1,6 +1,6 @@
-# Copyright (c) 2006-2018 Minero Aoki, Kenshi Muto, Masayoshi Takahashi, Masanori Kado.
+# Copyright (c) 2006-2019 Minero Aoki, Kenshi Muto, Masayoshi Takahashi, Masanori Kado.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@@ -27,19 +27,21 @@
CONFIG_FILE = ENV['REVIEW_CONFIG_FILE'] || 'config.yml'
CATALOG_FILE = ENV['REVIEW_CATALOG_FILE'] || 'catalog.yml'
WEBROOT = ENV['REVIEW_WEBROOT'] || 'webroot'
TEXTROOT = BOOK + '-text'
TOPROOT = BOOK + '-text'
+IDGXMLROOT = BOOK + '-idgxml'
+IDGXML_OPTIONS = ENV['REVIEW_IDGXML_OPTIONS'] || ''
def build(mode, chapter)
- sh "review-compile --target=#{mode} --footnotetext --stylesheet=style.css #{chapter} > tmp"
+ sh("review-compile --target=#{mode} --footnotetext --stylesheet=style.css #{chapter} > tmp")
mode_ext = { 'html' => 'html', 'latex' => 'tex', 'idgxml' => 'xml', 'top' => 'txt', 'plaintext' => 'txt' }
- FileUtils.mv 'tmp', chapter.gsub(/re\z/, mode_ext[mode])
+ FileUtils.mv('tmp', chapter.gsub(/re\z/, mode_ext[mode]))
end
def build_all(mode)
- sh "review-compile --target=#{mode} --footnotetext --stylesheet=style.css"
+ sh("review-compile --target=#{mode} --footnotetext --stylesheet=style.css")
end
task default: :html_all
desc 'build html (Usage: rake build re=target.re)'
@@ -80,34 +82,43 @@
desc 'generate (decorated) text file'
task text: TOPROOT do
sh "review-textmaker #{CONFIG_FILE}"
end
+desc 'generate IDGXML file'
+task idgxml: IDGXMLROOT do
+ sh "review-idgxmlmaker #{IDGXML_OPTIONS} #{CONFIG_FILE}"
+end
+
desc 'generate EPUB file'
task epub: BOOK_EPUB
IMAGES = FileList['images/**/*']
OTHERS = ENV['REVIEW_DEPS'] || []
SRC = FileList['./**/*.re', '*.rb'] + [CONFIG_FILE, CATALOG_FILE] + IMAGES + FileList[OTHERS]
SRC_EPUB = FileList['*.css']
SRC_PDF = FileList['layouts/*.erb', 'sty/**/*.sty']
file BOOK_PDF => SRC + SRC_PDF do
- FileUtils.rm_rf [BOOK_PDF, BOOK, BOOK + '-pdf']
+ FileUtils.rm_rf([BOOK_PDF, BOOK, BOOK + '-pdf'])
sh "review-pdfmaker #{CONFIG_FILE}"
end
file BOOK_EPUB => SRC + SRC_EPUB do
- FileUtils.rm_rf [BOOK_EPUB, BOOK, BOOK + '-epub']
+ FileUtils.rm_rf([BOOK_EPUB, BOOK, BOOK + '-epub'])
sh "review-epubmaker #{CONFIG_FILE}"
end
file WEBROOT => SRC do
- FileUtils.rm_rf [WEBROOT]
+ FileUtils.rm_rf([WEBROOT])
sh "review-webmaker #{CONFIG_FILE}"
end
file TEXTROOT => SRC do
- FileUtils.rm_rf [TEXTROOT]
+ FileUtils.rm_rf([TEXTROOT])
end
-CLEAN.include([BOOK, BOOK_PDF, BOOK_EPUB, BOOK + '-pdf', BOOK + '-epub', WEBROOT, 'images/_review_math', TEXTROOT])
+file IDGXMLROOT => SRC do
+ FileUtils.rm_rf([IDGXMLROOT])
+end
+
+CLEAN.include([BOOK, BOOK_PDF, BOOK_EPUB, BOOK + '-pdf', BOOK + '-epub', WEBROOT, 'images/_review_math', 'images/_review_math_text', TEXTROOT, IDGXMLROOT])