epubforge 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +17 -10
- data/VERSION +1 -1
- data/bin/epubforge +1 -1
- data/config/actions/epub.rb +50 -0
- data/config/actions/forge.rb +34 -13
- data/config/actions/git.rb +106 -0
- data/config/actions/help.rb +13 -13
- data/config/actions/html.rb +33 -0
- data/config/actions/mobi.rb +60 -0
- data/config/actions/new.rb +182 -0
- data/config/actions/word_count.rb +26 -24
- data/config/{actions → actions_to_ignore}/generate.rb +1 -1
- data/config/{actions → actions_to_ignore}/generate_chapter.rb +0 -0
- data/config/{actions → actions_to_ignore}/git_backup.rb +2 -2
- data/config/{actions → actions_to_ignore}/globals.rb +1 -1
- data/config/{actions → actions_to_ignore}/kindle.rb +3 -3
- data/config/{actions → actions_to_ignore}/local_action.rb +1 -1
- data/config/{actions → actions_to_ignore}/mobify.rb +3 -3
- data/config/actions_to_ignore/notes_to_epub.rb +19 -0
- data/config/actions_to_ignore/notes_to_kindle.rb +18 -0
- data/config/{actions → actions_to_ignore}/spell.rb +1 -1
- data/config/{actions → actions_to_ignore}/version.rb +3 -3
- data/config/{actions → actions_to_ignore}/wrap_scene_notes_in_hidden_div.rb +1 -1
- data/config/converters/epub_to_mobi.calibre.rb +8 -0
- data/config/converters/epub_to_mobi.kindlegen.rb +11 -0
- data/config/html_translators/default_kramdown.html_translator.rb +9 -0
- data/config/html_translators/default_markdown.html_translator.rb +10 -0
- data/config/html_translators/default_markdown_pandoc.html_translator.rb +10 -0
- data/config/html_translators/default_textile_pandoc.html_translator.rb +8 -0
- data/config/html_translators/default_xhtml.html_translator.rb +7 -0
- data/config/html_translators/fallback_html.html_translator.rb +9 -0
- data/config/html_translators/fallback_markdown.html_translator.rb +8 -0
- data/config/html_translators/fallback_textile.html_translator.rb +7 -0
- data/config/html_translators/fallback_txt.html_translator.rb +8 -0
- data/config/html_translators/fallback_unknown.html_translator.rb +7 -0
- data/lib/epubforge.rb +37 -82
- data/lib/{action/thor_action.rb → epubforge/action/action.rb} +89 -69
- data/lib/epubforge/action/action2.rb +109 -0
- data/lib/epubforge/action/action_definition.rb +62 -0
- data/lib/epubforge/action/actions_lookup.rb +45 -0
- data/lib/epubforge/action/chatterbox.rb +93 -0
- data/lib/{action → epubforge/action}/cli_command.rb +2 -2
- data/lib/{action → epubforge/action}/cli_sequence.rb +0 -0
- data/lib/{action → epubforge/action}/file_transformer.rb +0 -0
- data/lib/{action → epubforge/action}/hooks_interface.rb +2 -2
- data/lib/{action → epubforge/action}/run_description.rb +12 -9
- data/lib/{action → epubforge/action}/runner.rb +23 -24
- data/lib/{epub → epubforge/builder}/assets/asset.rb +1 -1
- data/lib/{epub → epubforge/builder}/assets/font.rb +1 -1
- data/lib/epubforge/builder/assets/html.rb +9 -0
- data/lib/{epub → epubforge/builder}/assets/image.rb +1 -1
- data/lib/epubforge/builder/assets/markdown.rb +9 -0
- data/lib/{epub → epubforge/builder}/assets/page.rb +12 -4
- data/lib/{epub → epubforge/builder}/assets/stylesheet.rb +1 -1
- data/lib/epubforge/builder/assets/textile.rb +9 -0
- data/lib/epubforge/builder/assets/xhtml.rb +9 -0
- data/lib/epubforge/builder/builder.rb +134 -0
- data/lib/{epub/builder.rb → epubforge/builder/epub.rb} +58 -161
- data/lib/epubforge/builder/html.rb +22 -0
- data/lib/epubforge/builder/packager.rb +16 -0
- data/lib/epubforge/core_extensions/array.rb +2 -0
- data/lib/{core_extensions → epubforge/core_extensions}/kernel.rb +0 -0
- data/lib/epubforge/core_extensions/nil_class.rb +2 -0
- data/lib/epubforge/core_extensions/object.rb +24 -0
- data/lib/{core_extensions → epubforge/core_extensions}/string.rb +1 -5
- data/lib/{custom_helpers.rb → epubforge/custom_helpers.rb} +0 -1
- data/lib/{errors.rb → epubforge/exceptions/errors.rb} +0 -0
- data/lib/{project → epubforge/project}/project.rb +23 -17
- data/lib/epubforge/utils/action_loader.rb +8 -0
- data/lib/epubforge/utils/class_loader.rb +102 -0
- data/lib/epubforge/utils/converter.rb +94 -0
- data/lib/{utils → epubforge/utils}/downloader.rb +0 -0
- data/lib/{utils → epubforge/utils}/file_orderer.rb +0 -0
- data/lib/epubforge/utils/file_path.rb +8 -0
- data/lib/epubforge/utils/html_translator.rb +126 -0
- data/lib/epubforge/utils/html_translator_queue.rb +113 -0
- data/lib/epubforge/utils/htmlizer.rb +61 -0
- data/lib/{utils → epubforge/utils}/misc.rb +0 -0
- data/lib/epubforge/utils/root_path.rb +8 -0
- data/lib/epubforge/utils/settings.rb +147 -0
- data/lib/epubforge/utils/template_evaluator.rb +7 -0
- data/templates/{default/book/afterword.markdown.template → project/book/afterword.markdown} +0 -0
- data/templates/project/book/chapter-%0000chapter%.markdown.template +4 -0
- data/templates/{default → project}/book/cover.xhtml.template +2 -2
- data/templates/{default/book/foreword.markdown.template → project/book/foreword.markdown} +0 -0
- data/templates/{default → project}/book/images/cover.png +0 -0
- data/templates/{default/book/stylesheets/stylesheet.css.template → project/book/stylesheets/stylesheet.css} +0 -0
- data/templates/project/book/title_page.markdown.template +5 -0
- data/templates/project/notes/character.%character.name_for_file%.markdown.template +15 -0
- data/templates/{default → project}/notes/images/cover.png +0 -0
- data/templates/{default/notes/stylesheets/stylesheet.css.template → project/notes/stylesheets/stylesheet.css} +0 -0
- data/templates/{default → project}/settings/actions/local_action.rb.example +1 -1
- data/templates/project/settings/config.rb.template +70 -0
- data/templates/project/settings/html_translators/example_translator.rb +29 -0
- data/templates/{default → project}/settings/wordcount.template +1 -1
- data/test/answers01.yml +30 -0
- data/test/helper.rb +62 -39
- data/test/misc/config.rb +5 -7
- data/test/test_epubforge.rb +18 -14
- data/test/{test_htmlizers.rb → test_html_translators.rb} +4 -8
- data/test/test_template_evaluator.rb +42 -0
- data/test/test_utils.rb +0 -11
- metadata +186 -189
- data/config/actions/gitify.rb +0 -72
- data/config/actions/init.rb +0 -138
- data/config/actions/notes_to_epub.rb +0 -18
- data/config/actions/notes_to_kindle.rb +0 -17
- data/config/htmlizers.rb +0 -70
- data/lib/action/actions_lookup.rb +0 -45
- data/lib/core_extensions/array.rb +0 -5
- data/lib/core_extensions/nil_class.rb +0 -5
- data/lib/core_extensions/object.rb +0 -5
- data/lib/epub/assets/html.rb +0 -8
- data/lib/epub/assets/markdown.rb +0 -8
- data/lib/epub/assets/textile.rb +0 -8
- data/lib/epub/assets/xhtml.rb +0 -8
- data/lib/epub/packager.rb +0 -16
- data/lib/utils/action_loader.rb +0 -7
- data/lib/utils/class_loader.rb +0 -102
- data/lib/utils/directory_builder.rb +0 -181
- data/lib/utils/file_path.rb +0 -152
- data/lib/utils/html_translator.rb +0 -100
- data/lib/utils/html_translator_queue.rb +0 -70
- data/lib/utils/htmlizer.rb +0 -92
- data/lib/utils/root_path.rb +0 -20
- data/lib/utils/settings.rb +0 -146
- data/lib/utils/template_evaluator.rb +0 -20
- data/templates/default/book/chapter-%i%.markdown.sequence +0 -4
- data/templates/default/book/title_page.markdown.template +0 -4
- data/templates/default/notes/character.named.markdown.template +0 -4
- data/templates/default/payload.rb +0 -65
- data/templates/default/settings/config.rb.form +0 -55
- data/templates/default/settings/htmlizers.rb +0 -0
- data/test/test_directory_builder.rb +0 -141
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
|
|
2
|
+
module EpubForge
|
|
3
|
+
module Utils
|
|
4
|
+
module HtmlTranslatorQueue
|
|
5
|
+
GROUP_NAMES = [:preferred, :user, :default, :fallback]
|
|
6
|
+
|
|
7
|
+
def self.included( base )
|
|
8
|
+
base.send( :include, FunWith::Patterns::Loader )
|
|
9
|
+
base.extend( HtmlTranslatorQueue::ClassMethods )
|
|
10
|
+
base.loader_pattern_only_register_classes( self )
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
module ClassMethods
|
|
14
|
+
def loader_pattern_register_item( translator )
|
|
15
|
+
@translators ||= {}
|
|
16
|
+
@translators[:all] ||= []
|
|
17
|
+
@translators[:named] ||= {}
|
|
18
|
+
|
|
19
|
+
for name in HtmlTranslatorQueue::GROUP_NAMES
|
|
20
|
+
@translators[name] ||= []
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
self.categorize( translator )
|
|
24
|
+
|
|
25
|
+
nil # returning true will break loader
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def translators
|
|
31
|
+
@translators
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def categorize( translator )
|
|
35
|
+
unless GROUP_NAMES.include?( translator.group )
|
|
36
|
+
puts "No group specified for html translator #{translator}. Group must be one of the following symbols: #{GROUP_NAMES.map(&:inspect).inspect}"
|
|
37
|
+
return false
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
@translators[:all] << translator
|
|
41
|
+
@translators[:named][translator.name] = translator if translator.name
|
|
42
|
+
@translators[translator.group] << translator
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def named( sym )
|
|
46
|
+
@translators[:named][sym]
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def each_translator( &block )
|
|
50
|
+
ordered_translators = []
|
|
51
|
+
for group in GROUP_NAMES.map{|g| @translators[g].reverse }
|
|
52
|
+
ordered_translators += group
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
if block_given?
|
|
56
|
+
for translator in ordered_translators
|
|
57
|
+
yield translator
|
|
58
|
+
end
|
|
59
|
+
else
|
|
60
|
+
ordered_translators.to_enum
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def location( name, path = nil )
|
|
65
|
+
@exec_location ||= {}
|
|
66
|
+
@exec_location[name] = path if path
|
|
67
|
+
@exec_location[name]
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# # A priority stack (like a priority queue, but FILO) with a simple job:
|
|
75
|
+
# # keep track of the translators (by name and by group), and return them
|
|
76
|
+
# # to the object user in the order they should be tried.
|
|
77
|
+
# class HtmlTranslatorQueue
|
|
78
|
+
# def self.group_names
|
|
79
|
+
# HtmlTranslator::GROUP_NAMES
|
|
80
|
+
# end
|
|
81
|
+
#
|
|
82
|
+
# def initialize
|
|
83
|
+
# @translators = {}
|
|
84
|
+
# @all_translators = []
|
|
85
|
+
# @translators_named = {}
|
|
86
|
+
# for name in GROUP_NAMES
|
|
87
|
+
# @translators[name] = []
|
|
88
|
+
# end
|
|
89
|
+
# end
|
|
90
|
+
#
|
|
91
|
+
# # def translators_handling_format( requested_format )
|
|
92
|
+
# # htmlizers = GROUP_NAMES.map{ |group|
|
|
93
|
+
# # (@translator_queue.keys - [:all, :named]).map do |format|
|
|
94
|
+
# # htmlizers = @translator_queue[format][group]
|
|
95
|
+
# # htmlizers ? htmlizers.select{|html| html.handles_format?(requested_format) } : []
|
|
96
|
+
# # end
|
|
97
|
+
# # }
|
|
98
|
+
# #
|
|
99
|
+
# # htmlizers.flatten
|
|
100
|
+
# # end
|
|
101
|
+
#
|
|
102
|
+
# # last installed, first yielded (within a given group)
|
|
103
|
+
# #
|
|
104
|
+
# # Returns them in priority order, user-defined ones first.
|
|
105
|
+
# # At the moment, it is up to individual translators to accept or
|
|
106
|
+
# # reject the translation job based on the file format (by extension, which is lame).
|
|
107
|
+
#
|
|
108
|
+
# def length
|
|
109
|
+
# @all_translators.length
|
|
110
|
+
# end
|
|
111
|
+
# end
|
|
112
|
+
# end
|
|
113
|
+
# end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# module EpubForge
|
|
2
|
+
# module Utils
|
|
3
|
+
#
|
|
4
|
+
# # Htmlizer coordinates the discovery, selection, and running of HtmlTranslators.
|
|
5
|
+
# # It can be handed basically any supported filetype (markdown, textile, txt), and
|
|
6
|
+
# # hand back an HTML translation of the file.
|
|
7
|
+
# class Htmlizer
|
|
8
|
+
# include Singleton
|
|
9
|
+
#
|
|
10
|
+
# def setup_once
|
|
11
|
+
# return false if @already_set_up
|
|
12
|
+
# @already_set_up = true
|
|
13
|
+
# @exec_location = {}
|
|
14
|
+
#
|
|
15
|
+
# # @translator_queue = HtmlTranslatorQueue.new
|
|
16
|
+
#
|
|
17
|
+
# @already_set_up
|
|
18
|
+
# end
|
|
19
|
+
#
|
|
20
|
+
#
|
|
21
|
+
# # Commenting out for the moment. Philosophically, maybe it shouldn't provide access to individual translators.
|
|
22
|
+
# # def translators_named( name )
|
|
23
|
+
# # @translator_queue[:named][name]
|
|
24
|
+
# # end
|
|
25
|
+
#
|
|
26
|
+
# #
|
|
27
|
+
# # def self.define( &block )
|
|
28
|
+
# # htmlizer = HtmlTranslator.new
|
|
29
|
+
# # yield htmlizer
|
|
30
|
+
# # HtmlTranslator.categorize( htmlizer )
|
|
31
|
+
# # end
|
|
32
|
+
# #
|
|
33
|
+
# # def categorize( htmlizer )
|
|
34
|
+
# # HtmlTranslator.categorize( htmlizer )
|
|
35
|
+
# # end
|
|
36
|
+
# #
|
|
37
|
+
# # def add_htmlizers( htmlizers_file )
|
|
38
|
+
# # if htmlizers_file.exist?
|
|
39
|
+
# # begin
|
|
40
|
+
# # require htmlizers_file.to_s
|
|
41
|
+
# # rescue Exception => e
|
|
42
|
+
# # puts e.message
|
|
43
|
+
# # puts e.backtrace.map{|line| "\t#{line}" }
|
|
44
|
+
# # puts "Failed to load htmlizers from project file #{htmlizers_file} Soldiering onward."
|
|
45
|
+
# # end
|
|
46
|
+
# # end
|
|
47
|
+
# # end
|
|
48
|
+
#
|
|
49
|
+
#
|
|
50
|
+
# # available options
|
|
51
|
+
# # :htmlizer => the sym for the requested htmlizer.
|
|
52
|
+
# # :opts => a string representing options to execute cmd with
|
|
53
|
+
#
|
|
54
|
+
#
|
|
55
|
+
#
|
|
56
|
+
# end
|
|
57
|
+
#
|
|
58
|
+
# Htmlizer.instance.setup_once
|
|
59
|
+
# end
|
|
60
|
+
# end
|
|
61
|
+
#
|
|
File without changes
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# TODO: Merge into FunWith::Configurations?
|
|
2
|
+
# have to make a tweak to configurator to allow it to work with project class instances
|
|
3
|
+
# module Configurator
|
|
4
|
+
# def self.extended(base)
|
|
5
|
+
# if base.respond_to?(:class_eval)
|
|
6
|
+
# base.class_eval { remove_instance_variable(:@configuration) if defined? @configuration }
|
|
7
|
+
# else
|
|
8
|
+
# puts "EXTENDING #{base} AS WE SPEAK"
|
|
9
|
+
# base.instance_variable_set( :@got_extended, true )
|
|
10
|
+
# # base.instance_variable_set( :@configuration, nil )
|
|
11
|
+
# end
|
|
12
|
+
# end
|
|
13
|
+
# end
|
|
14
|
+
#
|
|
15
|
+
# module EpubForge
|
|
16
|
+
# module Utils
|
|
17
|
+
# class Settings
|
|
18
|
+
# def self.thing_to_configure( *args )
|
|
19
|
+
# if( args.length >= 1 )
|
|
20
|
+
# @thing_to_configure = args.first
|
|
21
|
+
# end
|
|
22
|
+
# @thing_to_configure
|
|
23
|
+
# end
|
|
24
|
+
#
|
|
25
|
+
# # Takes a configurator object and (optionally) a settings file to write it out to.
|
|
26
|
+
# def initialize( configable, file = nil )
|
|
27
|
+
# @configable = configable
|
|
28
|
+
# @file = file.fwf_filepath.expand if file
|
|
29
|
+
# install_configuration
|
|
30
|
+
# end
|
|
31
|
+
#
|
|
32
|
+
# def act_on_string( keqv, setflag = :set )
|
|
33
|
+
# k,v = parse_kv( keqv )
|
|
34
|
+
# if setflag == :unset
|
|
35
|
+
# unset( k )
|
|
36
|
+
# elsif setflag == :set
|
|
37
|
+
# set( k, v )
|
|
38
|
+
# end
|
|
39
|
+
# end
|
|
40
|
+
#
|
|
41
|
+
# def set( key, val )
|
|
42
|
+
# setting, last_key = descend_key( key )
|
|
43
|
+
# setting[last_key] = val
|
|
44
|
+
# end
|
|
45
|
+
#
|
|
46
|
+
# def unset( key )
|
|
47
|
+
# setting, last_key = descend_key( key )
|
|
48
|
+
# setting.delete( last_key )
|
|
49
|
+
# end
|
|
50
|
+
#
|
|
51
|
+
# def write_settings_file( settings_file = nil )
|
|
52
|
+
# settings_file ||= @file
|
|
53
|
+
# settings_file = settings_file.fwf_filepath
|
|
54
|
+
# @depth = 0
|
|
55
|
+
# str = indented_line("EpubForge::Utils::Settings.thing_to_configure.config do")
|
|
56
|
+
# str += write_config( @configable.config.to_hash )
|
|
57
|
+
# str += indented_line("end")
|
|
58
|
+
# settings_file.write( str )
|
|
59
|
+
# end
|
|
60
|
+
#
|
|
61
|
+
# protected
|
|
62
|
+
# def install_configuration
|
|
63
|
+
# self.class.thing_to_configure( @configable )
|
|
64
|
+
# self.class.thing_to_configure.extend( Configurator )
|
|
65
|
+
# require @file
|
|
66
|
+
# self.class.thing_to_configure( nil )
|
|
67
|
+
# end
|
|
68
|
+
#
|
|
69
|
+
# def indented_line( str )
|
|
70
|
+
# puts " " * @depth + str + "\n"
|
|
71
|
+
# " " * @depth + str + "\n"
|
|
72
|
+
# end
|
|
73
|
+
#
|
|
74
|
+
# def write_config( h )
|
|
75
|
+
# str = ""
|
|
76
|
+
# @depth += 2
|
|
77
|
+
# for k, v in h
|
|
78
|
+
# if v.is_a?(Hash)
|
|
79
|
+
# str += indented_line( "#{k} do" )
|
|
80
|
+
# str += write_config( v )
|
|
81
|
+
# str += indented_line( "end" )
|
|
82
|
+
# else
|
|
83
|
+
# str += indented_line( "#{k} #{stringify_value( v )}" )
|
|
84
|
+
# end
|
|
85
|
+
# end
|
|
86
|
+
# @depth -= 2
|
|
87
|
+
#
|
|
88
|
+
# str
|
|
89
|
+
# end
|
|
90
|
+
#
|
|
91
|
+
# def stringify_value( v )
|
|
92
|
+
# case v
|
|
93
|
+
# when Regexp
|
|
94
|
+
# "/#{v.source}/"
|
|
95
|
+
# when Numeric
|
|
96
|
+
# "#{v}"
|
|
97
|
+
# when String
|
|
98
|
+
# escape_string( v )
|
|
99
|
+
# when FunWith::Files::FilePath
|
|
100
|
+
# escape_string( v ) + ".fwf_filepath"
|
|
101
|
+
# when Array # TODO: Is there a way to enter arrays?
|
|
102
|
+
# "[ #{ v.map{ |item| stringify_value(item) }.join(', ') } ]"
|
|
103
|
+
# when NilClass
|
|
104
|
+
# "nil"
|
|
105
|
+
# when TrueClass
|
|
106
|
+
# "true"
|
|
107
|
+
# when FalseClass
|
|
108
|
+
# "false"
|
|
109
|
+
# end
|
|
110
|
+
# end
|
|
111
|
+
#
|
|
112
|
+
# def escape_string( s )
|
|
113
|
+
# s.inspect
|
|
114
|
+
# end
|
|
115
|
+
#
|
|
116
|
+
# # If given a hierarchical setting key like git:host:url,
|
|
117
|
+
# # returns the hash attached to config[:git][:host], so the caller can say
|
|
118
|
+
# # rval[:url] = "bannedsorcery.com". Creates empty hashes as it descends,
|
|
119
|
+
# # if neccessary.
|
|
120
|
+
# def descend_key( k )
|
|
121
|
+
# keychain = k.split(":").map{ |key| :"#{key}" }
|
|
122
|
+
#
|
|
123
|
+
# s = @configable.config
|
|
124
|
+
#
|
|
125
|
+
# for key in keychain[0..-2]
|
|
126
|
+
# s[key] ||= {}
|
|
127
|
+
# s = s[key]
|
|
128
|
+
# end
|
|
129
|
+
#
|
|
130
|
+
# [s, keychain.last]
|
|
131
|
+
# end
|
|
132
|
+
#
|
|
133
|
+
# def parse_kv( str )
|
|
134
|
+
# if m = str.match( /^([a-z0-9_:]+)=(.*)$/ )
|
|
135
|
+
# discard, k, v = m.to_a
|
|
136
|
+
# elsif m = str.match( /^([a-z0-9_:]+)$/ )
|
|
137
|
+
# discard, k = m.to_a
|
|
138
|
+
# v = nil
|
|
139
|
+
# else
|
|
140
|
+
# k = v = nil
|
|
141
|
+
# end
|
|
142
|
+
#
|
|
143
|
+
# [k, v]
|
|
144
|
+
# end
|
|
145
|
+
# end
|
|
146
|
+
# end
|
|
147
|
+
# end
|
|
File without changes
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
6
6
|
<head>
|
|
7
|
-
<title
|
|
7
|
+
<title><%= @book[:title] %>, by <%= @book[:author] %></title>
|
|
8
8
|
</head>
|
|
9
9
|
|
|
10
10
|
<body>
|
|
11
|
-
<p><img class="cover" alt="
|
|
11
|
+
<p><img class="cover" alt="<%= @book[:title] %>, by <%= @book[:author] %>" src="<%= @book[:cover].nil? ? "../Images/cover.jpg" : @book[:cover].path %>" /></p>
|
|
12
12
|
</body>
|
|
13
13
|
</html>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Used by epubforge.
|
|
2
|
+
metadata do
|
|
3
|
+
name "<%= @book[:title] || "My Book" %>" # The title of the book
|
|
4
|
+
author "<%= @book[:author] || "Author" %>" # Your moniker. Your Nom de Plume. The thing people say to get your attention.
|
|
5
|
+
license "<%= @book[:license] || "All Rights Reserved" %>"
|
|
6
|
+
publisher "<%= @book[:publisher] || 'My Publisher' %>"
|
|
7
|
+
original_publication "<%= @book[:original_publication] || Time.now.strftime('%Y-%m-%d') %>" # The year this work was first published
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
filename "<%= (@book[:title] || "my_book").epf_underscorize %>" # The default filename for your ebook (no extension).
|
|
11
|
+
|
|
12
|
+
############### GOT GIT? #####################################
|
|
13
|
+
#
|
|
14
|
+
# settings to allow epubforge to interact with a git repository. It's a way to back up your story.
|
|
15
|
+
# I hope eventually to add some basic branching support (for folks who don't want to use git directly).
|
|
16
|
+
# If your repo is on a thumb drive, please make sure it's plugged in.
|
|
17
|
+
<% if @git %>
|
|
18
|
+
git do
|
|
19
|
+
repo_folder "<%= @git[:repo] %>"
|
|
20
|
+
remote_host "<%= @git[:host] %>"
|
|
21
|
+
remote_user "<%= @git[:user] %>"
|
|
22
|
+
repo_id "<%= @git[:repo_id] %>"
|
|
23
|
+
end
|
|
24
|
+
<% else %>
|
|
25
|
+
# git do
|
|
26
|
+
# repo_folder "/path/to/folder"
|
|
27
|
+
# remote_host "my.hostname.com"
|
|
28
|
+
# remote_user "myusername"
|
|
29
|
+
# repo_id "not sure we're using this"
|
|
30
|
+
# end
|
|
31
|
+
<% end %>
|
|
32
|
+
############### /GOT GIT? #####################################
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
# Any pages not listed here will be added
|
|
36
|
+
# to the ebook after the listed pages, in alphabetical order of
|
|
37
|
+
# filename. In this example, the title_page.markdown file goes first,
|
|
38
|
+
# then the foreword.markdown page, then chapters 1 and 2 (in alphanumeric order)
|
|
39
|
+
# and finally the afterword. Any pages not matched will be put after the
|
|
40
|
+
# set of matched pages.
|
|
41
|
+
#
|
|
42
|
+
# Note that the items in the list represent regular expressions. It works by
|
|
43
|
+
# sorting the sections into bins, based on the first regexp matched. Within the bins,
|
|
44
|
+
# results are returned in alphabetical order.
|
|
45
|
+
#
|
|
46
|
+
# Single quotes are preferred, because you don't have to escape backslashes for character classes
|
|
47
|
+
# like \s, \d, etc. This needs to be made easier for people who don't have a grasp of regular
|
|
48
|
+
# expressions.
|
|
49
|
+
pages do
|
|
50
|
+
book [
|
|
51
|
+
# matches title_page.markdown, title_page.textile, or
|
|
52
|
+
# title_page.(any other valid extension). This will be the first
|
|
53
|
+
# scene/chapter/division in the book.
|
|
54
|
+
'title_page',
|
|
55
|
+
'foreword',
|
|
56
|
+
|
|
57
|
+
# filename matches chapter, followed by anything. If you have a page called
|
|
58
|
+
# chapter_summary that comes after, you might want to define the matcher more
|
|
59
|
+
# specifically, for example 'chapter-\d+' (chapter followed by dash followed by any number of numbers).
|
|
60
|
+
#
|
|
61
|
+
'chapter-.*',
|
|
62
|
+
'afterword'
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
notes [
|
|
66
|
+
# You can set the order that the notes entries appear in below.
|
|
67
|
+
"example89823786",
|
|
68
|
+
"example89723987"
|
|
69
|
+
]
|
|
70
|
+
end
|