diff options
author | 2020-10-14 20:59:33 +0200 | |
---|---|---|
committer | 2020-10-29 08:58:13 +0100 | |
commit | f35319356d0ff309c701ed7a64d761f5a227b400 (patch) | |
tree | dbd103e92f6fb4f7eeedb7c3afee4edd35e74e1c | |
parent | 85866dab09f374ce7317009dc149c2303ee0a47f (diff) | |
download | fronde-epubizer.tar.gz fronde-epubizer.tar.xz fronde-epubizer.zip |
wip: Begin to work on epub integrationepubizer
-rw-r--r-- | lib/neruda/org_file.rb | 1 | ||||
-rw-r--r-- | lib/neruda/org_file/epubizer.rb | 16 | ||||
-rw-r--r-- | neruda.gemspec | 1 |
3 files changed, 18 insertions, 0 deletions
diff --git a/lib/neruda/org_file.rb b/lib/neruda/org_file.rb index e6dd000..4985220 100644 --- a/lib/neruda/org_file.rb +++ b/lib/neruda/org_file.rb @@ -4,6 +4,7 @@ require 'time' require 'fileutils' # neruda/config is required by htmlizer require 'neruda/org_file/htmlizer' +require 'neruda/org_file/epubizer' require 'neruda/org_file/extracter' require 'neruda/org_file/class_methods' require 'neruda/index' diff --git a/lib/neruda/org_file/epubizer.rb b/lib/neruda/org_file/epubizer.rb new file mode 100644 index 0000000..19d45be --- /dev/null +++ b/lib/neruda/org_file/epubizer.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Neruda + # This module holds epub related methods for the {Neruda::OrgFile} + # class. + module OrgFileEpubizer + # Create an epub version for the current file + # + # @return [Boolean, nil] the underlying ~system~ method return value + def to_epub + epub_file = Neruda::OrgFile.target_for_source(@file, @project) + epub_file.sub!(/\.html\z/, '.epub') + system 'pandoc', '-S', "-o #{epub_file}", @file + end + end +end diff --git a/neruda.gemspec b/neruda.gemspec index 1a2946b..a9dda9f 100644 --- a/neruda.gemspec +++ b/neruda.gemspec @@ -22,6 +22,7 @@ Gem::Specification.new do |s| 'lib/neruda/index/org_generator.rb', 'lib/neruda/org_file.rb', 'lib/neruda/org_file/class_methods.rb', + 'lib/neruda/org_file/epubizer.rb', 'lib/neruda/org_file/extracter.rb', 'lib/neruda/org_file/htmlizer.rb', 'lib/neruda/templater.rb', |