samples/sample-book/src/lib/tasks/review.rake in review-4.0.0 vs samples/sample-book/src/lib/tasks/review.rake in review-4.1.0

- old
+ new

@@ -1,6 +1,6 @@ -# Copyright (c) 2006-2019 Minero Aoki, Kenshi Muto, Masayoshi Takahashi, Masanori Kado. +# Copyright (c) 2006-2020 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 @@ -28,11 +28,15 @@ CATALOG_FILE = ENV['REVIEW_CATALOG_FILE'] || 'catalog.yml' WEBROOT = ENV['REVIEW_WEBROOT'] || 'webroot' TEXTROOT = BOOK + '-text' TOPROOT = BOOK + '-text' IDGXMLROOT = BOOK + '-idgxml' +PDF_OPTIONS = ENV['REVIEW_PDF_OPTIONS'] || '' +EPUB_OPTIONS = ENV['REVIEW_EPUB_OPTIONS'] || '' +WEB_OPTIONS = ENV['REVIEW_WEB_OPTIONS'] || '' IDGXML_OPTIONS = ENV['REVIEW_IDGXML_OPTIONS'] || '' +TEXT_OPTIONS = ENV['REVIEW_TEXT_OPTIONS'] || '' def build(mode, chapter) 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])) @@ -74,16 +78,16 @@ desc 'generate static HTML file for web' task web: WEBROOT desc 'generate text file (without decoration)' task plaintext: TEXTROOT do - sh "review-textmaker -n #{CONFIG_FILE}" + sh "review-textmaker #{TEXT_OPTIONS} -n #{CONFIG_FILE}" end desc 'generate (decorated) text file' task text: TOPROOT do - sh "review-textmaker #{CONFIG_FILE}" + sh "review-textmaker #{TEXT_OPTIONS} #{CONFIG_FILE}" end desc 'generate IDGXML file' task idgxml: IDGXMLROOT do sh "review-idgxmlmaker #{IDGXML_OPTIONS} #{CONFIG_FILE}" @@ -98,20 +102,20 @@ 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']) - sh "review-pdfmaker #{CONFIG_FILE}" + sh "review-pdfmaker #{PDF_OPTIONS} #{CONFIG_FILE}" end file BOOK_EPUB => SRC + SRC_EPUB do FileUtils.rm_rf([BOOK_EPUB, BOOK, BOOK + '-epub']) - sh "review-epubmaker #{CONFIG_FILE}" + sh "review-epubmaker #{EPUB_OPTIONS} #{CONFIG_FILE}" end file WEBROOT => SRC do FileUtils.rm_rf([WEBROOT]) - sh "review-webmaker #{CONFIG_FILE}" + sh "review-webmaker #{WEB_OPTIONS} #{CONFIG_FILE}" end file TEXTROOT => SRC do FileUtils.rm_rf([TEXTROOT]) end