mint 0.2.9 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +45 -283
- data/bin/mint +10 -10
- data/bin/mint-epub +23 -0
- data/features/plugins/epub.feature +23 -0
- data/features/publish.feature +73 -0
- data/features/support/env.rb +1 -1
- data/lib/mint.rb +1 -0
- data/lib/mint/commandline.rb +3 -3
- data/lib/mint/document.rb +46 -5
- data/lib/mint/helpers.rb +65 -4
- data/lib/mint/mint.rb +6 -7
- data/lib/mint/plugin.rb +136 -0
- data/lib/mint/plugins/epub.rb +292 -0
- data/lib/mint/version.rb +1 -1
- data/plugins/templates/epub/container.haml +5 -0
- data/plugins/templates/epub/content.haml +36 -0
- data/plugins/templates/epub/layout.haml +6 -0
- data/plugins/templates/epub/title.haml +11 -0
- data/plugins/templates/epub/toc.haml +26 -0
- data/spec/commandline_spec.rb +91 -0
- data/spec/document_spec.rb +48 -9
- data/spec/helpers_spec.rb +231 -0
- data/spec/layout_spec.rb +6 -0
- data/spec/mint_spec.rb +94 -0
- data/spec/plugin_spec.rb +457 -0
- data/spec/plugins/epub_spec.rb +242 -0
- data/spec/resource_spec.rb +135 -0
- data/spec/spec_helper.rb +18 -0
- data/spec/style_spec.rb +69 -0
- metadata +103 -34
- data/features/mint_document.feature +0 -48
- data/features/step_definitions/mint_steps.rb +0 -1
data/README.md
CHANGED
@@ -1,49 +1,29 @@
|
|
1
|
-
|
1
|
+
What is Mint?
|
2
|
+
-------------
|
2
3
|
|
3
|
-
|
4
|
+
Mint transforms your plain text documents into beautiful documents. It makes that process as simple (but customizable) as possible.
|
4
5
|
|
5
|
-
|
6
|
-
---------------------------
|
7
|
-
|
8
|
-
Mint is a publishing platform for people who want to store their documents as plain text without giving up proper layout or the ability to share with friends.
|
9
|
-
|
10
|
-
I don't actually believe in tag lines, but if Mint were to have one, it might be one of these:
|
11
|
-
|
12
|
-
- Value your words. Leave the formatting up to us.
|
13
|
-
- Reuse your ideas. Reuse your formats. Keep them Mint fresh.
|
14
|
-
- Mint once, remix as needed.
|
15
|
-
|
16
|
-
Introduction
|
17
|
-
------------
|
18
|
-
|
19
|
-
Mint is an agile, lightweight solution for your documents.
|
20
|
-
|
21
|
-
Mint manages your documents in a decentralized but consistent way. It frees you from bloated word processors. Mint brings together standards and common templating languages for a clean, agile approach to documents. It uses HTML outside of the web. Leverages text for loads of different views. Keeps your data and formatting separate. In a word: simplifies. In a couple of words: kicks ass.
|
22
|
-
|
23
|
-
In a few more: *Mint processes words so you don't have to.*
|
6
|
+
Why would you want to keep all of your documents as plain text?
|
24
7
|
|
25
|
-
|
26
|
-
|
8
|
+
- To focus on words and structure when you write
|
9
|
+
- To be able to apply one style to an entire set of documents with one command
|
10
|
+
- To keep your documents under version control
|
11
|
+
- To make your documents available for scripting--for example, text analysis
|
27
12
|
|
28
|
-
|
13
|
+
What does Mint create from these source files? Beautiful, styled HTML ready to print, e-mail, and present.
|
29
14
|
|
30
|
-
|
15
|
+
In a few words: *Mint processes words so you don't have to.*
|
31
16
|
|
32
|
-
|
17
|
+
The mint command
|
18
|
+
----------------
|
33
19
|
|
34
|
-
|
20
|
+
If you have a plain text document formatted in Markdown or Textile or almost any other templating language, you're ready to go.
|
35
21
|
|
36
|
-
The Mint
|
37
|
-
--------------------
|
22
|
+
The easiest Mint command doesn't require configuration. It transforms a document into HTML and links it to the default stylesheet, which I've designed for you.
|
38
23
|
|
39
|
-
|
24
|
+
Simply type:
|
40
25
|
|
41
|
-
|
42
|
-
|
43
|
-
Mint is loaded with smart defaults, so if you don't want to configure something--say, the basic HTML skeleton of your document or the output directory--you don't have to. You'll probably be surprised at how easy it is to use out of the box, and how configurable it is.
|
44
|
-
|
45
|
-
document = Document.new 'Minimalism.md'
|
46
|
-
document.publish!
|
26
|
+
mint publish Minimalism.md
|
47
27
|
|
48
28
|
And voilà, Minimalism.html will show up next to Minimalism.md.
|
49
29
|
|
@@ -51,91 +31,37 @@ Opening Minimalism.html with your favorite web browser--[Firefox is best for typ
|
|
51
31
|
|
52
32
|
Sending that page to a printer is as easy as clicking "Print" from your browser. What comes out of your printer will have a 12 pt base font, normal margins, and a not-too-cramped baseline. (Ah the wonder of print stylesheets.)
|
53
33
|
|
54
|
-
|
55
|
-
|
56
|
-
[Firefox typography]: http://opentype.info/blog/2008/06/14/kerning-and-opentype-features-in-firefox-3/ "Firefox 3 supports kerning and automatic ligatures"
|
57
|
-
|
58
|
-
### Customizing Mint ###
|
59
|
-
|
60
|
-
To understand how the library works, with and without configuration, it is helpful to look at the options you can pass to the library and what their defaults are.
|
61
|
-
|
62
|
-
You can change a document by passing it one of several options.
|
63
|
-
|
64
|
-
#### Layout and style ####
|
65
|
-
|
66
|
-
`:layout` and `:style` are names of templates or file names. They can be overridden by `:template`, which sets both to the same name.
|
67
|
-
|
68
|
-
Defaults:
|
69
|
-
|
70
|
-
:template => 'default'
|
71
|
-
|
72
|
-
Notes:
|
73
|
-
|
74
|
-
1. If you specify a template name here, Mint will search its paths in order (see **The Mint Path** for more details) for a template with that name. A template file looks like the following:
|
75
|
-
|
76
|
-
MINT_PATH/templates/template_name/style.css
|
77
|
-
MINT_PATH/templates/template_name/layout.haml
|
78
|
-
|
79
|
-
2. If you specify a template name that is also the name of an existing file in your working directory, Mint will use the file and not look for a template. (It is unlikely you'll have an extension-less file named 'normal' or 'default' in your working directory, so don't worry about this edge case.) If you do specify an existing file, the path/file will be resolved from the directory where you're calling Mint (the 'working directory'). To use Mint this way (and I don't see this as more than a temporary solution) you'll probably want to call Mint from within your source's directory. Alternatively, you can use [`Dir.chdir`][Dir::chdir method] for the same effect.
|
80
|
-
|
81
|
-
#### Destination ####
|
82
|
-
|
83
|
-
`:destination` lets you organize your output. It directs Mint to write the template or document to one of root's subdirectories. There is an option to specify a separate `:style_destination`, which is resolved relative to `:destination`.
|
84
|
-
|
85
|
-
Defaults:
|
86
|
-
|
87
|
-
:destination => nil
|
88
|
-
:style_destination => nil
|
89
|
-
|
90
|
-
Notes:
|
34
|
+
You can throw as many files as you'd like in. Any commandline argument *not* preceded by an option (e.g., `--template`) or in the `mint` command vocabulary (more on that in a minute) will be interpreted as a file name:
|
91
35
|
|
92
|
-
|
36
|
+
mint publish Minimalism.md Proposal.md Protocol.md
|
93
37
|
|
94
|
-
|
38
|
+
This command can be tweaked with options and arguments to be more flexible:
|
95
39
|
|
96
|
-
|
40
|
+
mint publish Minimalism.md --template resume # specifies a style template
|
41
|
+
mint publish Minimalism.md --destination final --style-destination=styles
|
97
42
|
|
98
|
-
|
43
|
+
For a listing of mint options, take [a look at the API][API].
|
99
44
|
|
100
|
-
|
45
|
+
A basic Mint document
|
46
|
+
---------------------
|
101
47
|
|
102
|
-
|
103
|
-
content = 'Minimalism.md'
|
104
|
-
|
105
|
-
Document.new content
|
106
|
-
Document.new content, :destination => 'output',
|
107
|
-
:style => 'serif-pro'
|
108
|
-
Document.new content, :style => Style.new(:normal)
|
109
|
-
|
110
|
-
Style.new 'normal'
|
111
|
-
Style.new :normal
|
112
|
-
Style.new '~/Sites/Common Styles/normal.css',
|
113
|
-
:destination => 'styles'
|
114
|
-
Style.new '~/Sites/Common Styles/normal.css',
|
115
|
-
:style_destination => 'inline'
|
116
|
-
Style.new 'Common Styles/normal.css'
|
48
|
+
Mint is loaded with smart defaults, so if you don't want to configure something--say, the basic HTML skeleton of your document or the output directory--you don't have to. You'll probably be surprised at how easy it is to use out of the box, and how configurable it is.
|
117
49
|
|
118
|
-
|
50
|
+
document = Document.new 'Minimalism.md'
|
51
|
+
document.publish!
|
119
52
|
|
120
|
-
|
121
|
-
d.destination = 'final'
|
122
|
-
d.template = 'resume'
|
123
|
-
end
|
53
|
+
If you want to customize your document, though--and that's why I built this library--Mint makes that easy.
|
124
54
|
|
125
|
-
|
55
|
+
To understand Mint's flexibility, you'll want to [take a look at the API][API].
|
126
56
|
|
127
|
-
[
|
57
|
+
[Firefox typography]: http://opentype.info/blog/2008/06/14/kerning-and-opentype-features-in-firefox-3/ "Firefox 3 supports kerning and automatic ligatures"
|
128
58
|
|
129
|
-
|
130
|
-
|
59
|
+
Templates
|
60
|
+
---------
|
131
61
|
|
132
62
|
Templates can be written in any format accepted by the Tilt template interface library. (See [the Tilt TEMPLATES file][Tilt templates] for more information.)
|
133
63
|
|
134
|
-
|
135
|
-
|
136
|
-
### Place your content, point to your styles ###
|
137
|
-
|
138
|
-
In Mint layouts, Ruby calls are sparse but necessary.
|
64
|
+
In a template layouts, Ruby calls are sparse but necessary.
|
139
65
|
|
140
66
|
If you're designing a layout, you need to indicate where Mint should place your content. For that simple reason, raw HTML files cannot be layouts. Instead, if you want to use HTML templates, you should use the ERB format. These files are essentially HTML with the possibility for Ruby calls. You can even use the .html extension for your files. Just code the dynamic portion using ERB syntax.
|
141
67
|
|
@@ -143,22 +69,7 @@ Inside your template, use the `content` method to place your source's content.
|
|
143
69
|
|
144
70
|
You will want to point to your document's stylesheet (via a relative URL) from within your layout, usually in the `<head/>` element. Use the `stylesheet` method.
|
145
71
|
|
146
|
-
So if you're writing your layout using
|
147
|
-
|
148
|
-
<!doctype html>
|
149
|
-
<html>
|
150
|
-
<head>
|
151
|
-
<link rel='stylesheet' href='<%= stylesheet %>' />
|
152
|
-
</head>
|
153
|
-
|
154
|
-
<body>
|
155
|
-
<div id='container'>
|
156
|
-
<%= content %>
|
157
|
-
</div>
|
158
|
-
</body>
|
159
|
-
</html>
|
160
|
-
|
161
|
-
The same layout in Haml would be:
|
72
|
+
So if you're writing your layout using Haml, the template might look like this:
|
162
73
|
|
163
74
|
!!!
|
164
75
|
%html
|
@@ -168,16 +79,7 @@ The same layout in Haml would be:
|
|
168
79
|
%body
|
169
80
|
#container= content
|
170
81
|
|
171
|
-
|
172
|
-
|
173
|
-
You can build stylesheets using [CSS][], [SASS/SCSS][] or [Less][]. They will
|
174
|
-
always be compiled. They will only be copied, though, if you specify a style
|
175
|
-
destination.
|
176
|
-
|
177
|
-
[Tilt templates]: http://github.com/rtomayko/tilt/blob/master/TEMPLATES.md "A listing of all templates supported by Tilt."
|
178
|
-
[CSS]: http://en.wikipedia.org/wiki/Cascading_Style_Sheets
|
179
|
-
[SASS/SCSS]: http://sass-lang.com/
|
180
|
-
[Less]: http://lesscss.org/
|
82
|
+
You can build stylesheets using [CSS][], [SASS/SCSS][] or [Less][]. They will always be compiled for you.
|
181
83
|
|
182
84
|
Mint comes preloaded with several styles and layouts.
|
183
85
|
|
@@ -187,163 +89,23 @@ Mint comes preloaded with several styles and layouts.
|
|
187
89
|
4. Protocol
|
188
90
|
5. Protocol Flow\* - requires Javascript and jQuery
|
189
91
|
|
190
|
-
> Note: Starred entries are not yet
|
92
|
+
> Note: Starred entries are not yet implemented. If you have a killer
|
191
93
|
> template you think should be included, send it my way. I'll check
|
192
94
|
> it out and see if it should be part of the standard template library.
|
193
95
|
> (Of course, you'll get all the credit.)
|
194
96
|
|
195
97
|
I've included a base stylesheet that is useful for setting sensible typographic defaults.
|
196
98
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
Mint's path tells the library where to search for named templates. It can be useful for other things, too, especially for extensions and tools that use the library (for example, for storing config files for the `mint` command). The Mint path is flexible and something that you can modify, even from the command line. (Just export `MINT_PATH`=`your:colon-separated-paths:here`. Just make sure to specify higher-priority paths before lower-priority ones.)
|
201
|
-
|
202
|
-
So here's the rundown.
|
203
|
-
|
204
|
-
When you name a layout or style with a string or symbol, Mint will first search the current directory for that file or file path. If that file does not exist, Mint will search its path in order until it finds the appropriate template. If no template is found, it will fall back to the default template.
|
205
|
-
|
206
|
-
The default Mint path (in order) is:
|
207
|
-
|
208
|
-
- the current working directory
|
209
|
-
- `${HOME}/.mint`
|
210
|
-
- `/usr/share/mint` (or whatever your system uses for system-wide configuration - Mint will make a smart guess)
|
211
|
-
- the Mint gem directory (which holds the Mint-approved templates)
|
212
|
-
|
213
|
-
Templates should be in a directory named templates. Inside this directory, there should be a subdirectory for each template:
|
214
|
-
|
215
|
-
- `MINT_PATH/templates/normal/style.sass`
|
216
|
-
- `MINT_PATH/templates/normal/layout.haml`
|
217
|
-
|
218
|
-
Normally a style will go best with its layout complement. However, layouts and styles can be mixed and matched at your discretion. This is especially true where you are primarily customizing DOM elements with your stylesheet instead of targeting specific IDs or classes you're expecting to find. (In other words, this works best when your stylesheet focuses on modifying typography and not page layout.)
|
219
|
-
|
220
|
-
The `mint` command
|
221
|
-
---------------------
|
222
|
-
|
223
|
-
*The `mint` command is almost functional. Testing is in development.*
|
224
|
-
|
225
|
-
### The basic `mint` command ###
|
226
|
-
|
227
|
-
The easiest Mint command doesn't require configuration. It will transform the specified document into HTML and link it to the default stylesheet, which will be output in the same directory as the source documents. (If you have a ./templates/default/ subdirectory, the templates found in that directory will be used.)
|
228
|
-
|
229
|
-
mint Minimalism.md # creates Minimalism.html
|
230
|
-
|
231
|
-
You can throw as many files as you'd like in. Any commandline argument *not* preceded by an option (e.g., `--template`) or in the `mint` command vocabulary (more on that in a minute) will be interpreted as a file name:
|
232
|
-
|
233
|
-
mint Minimalism.md Proposal.md Protocol.md
|
234
|
-
|
235
|
-
This command can be tweaked with options and arguments to be more flexible:
|
236
|
-
|
237
|
-
mint Minimalism.md --template resume # specifies a style template
|
238
|
-
mint Minimalism.md --destination final --style-destination=styles
|
239
|
-
|
240
|
-
### Mint options & shortcuts ###
|
241
|
-
|
242
|
-
You can pass several options to `mint`. Following the Unix tradition, common options have a short and long form.
|
243
|
-
|
244
|
-
The following correspond to the parameters you can pass to `Mint::Document.new`, as described in [The Mint library][]:
|
245
|
-
|
246
|
-
- `--template, -t`
|
247
|
-
- `--layout, -l`
|
248
|
-
- `--style, -s`
|
249
|
-
- `--destination, -d`
|
250
|
-
- `--style-destination, -n`
|
251
|
-
|
252
|
-
There are also scoping options, both for the `set` and `edit` commands:
|
253
|
-
|
254
|
-
- `--global, -G`
|
255
|
-
- `--user, -U`
|
256
|
-
- `--local, -L`
|
257
|
-
|
258
|
-
*If you've used `MINT_PATH` to set up Mint, then you should be aware that
|
259
|
-
`--local` refers to the first element, `--user` refers to the second, and
|
260
|
-
`--global` refers to the third.*
|
261
|
-
|
262
|
-
Other options have nothing to do with document configuration but are there for convenience:
|
263
|
-
|
264
|
-
- `--verbose, -v` - will output all rendering results
|
265
|
-
- `--simulation, -s` - will not actually render any files
|
266
|
-
|
267
|
-
[The Mint library]: #ii_the_mint_library
|
268
|
-
|
269
|
-
### `mint` command vocabulary ###
|
270
|
-
|
271
|
-
Not all commandline arguments will be read as files. `mint` has a certain vocabulary that you can use, for example, to manipulate configuration options or edit layout files.
|
272
|
-
|
273
|
-
Currently, the `mint` vocabulary consists of `set`, `edit`, and `config`. (Coming soon: `install` and `package`.)
|
274
|
-
|
275
|
-
### `mint` configuration ###
|
276
|
-
|
277
|
-
`mint` is capable of using config files to harness the power of convention without sacrificing the flexibility of configuration. You can configure `mint` on a global, user-wide, or local (directory-specific) scale to avoid passing commandline options every time you call `mint`.
|
278
|
-
|
279
|
-
To set a local (directory-specific) configuration option, call `mint set`:
|
280
|
-
|
281
|
-
mint set [--local] template=serif-professional
|
282
|
-
|
283
|
-
This will create (or update) a config file: ./.mint/config.yml
|
284
|
-
|
285
|
-
It will contain:
|
286
|
-
|
287
|
-
template: serif-professional
|
288
|
-
|
289
|
-
From now on, calling `mint` in this directory will automatically draw on this option. (Commandline options will override any file-based options.)
|
290
|
-
|
291
|
-
You can also set user-wide options:
|
292
|
-
|
293
|
-
mint set --user template=professional
|
294
|
-
|
295
|
-
Doing so will create the same style config file, but in your system's user-wide configuration location:
|
296
|
-
|
297
|
-
- In Linux and other FHS-compliant systems, and on Mac OS X this
|
298
|
-
will be in ~/.mint/config.yaml
|
299
|
-
- In Windows, this will be *(somewhere dumb...)*
|
300
|
-
|
301
|
-
Finally, you can set global options for all users:
|
302
|
-
|
303
|
-
mint set --global template=normal
|
304
|
-
|
305
|
-
This configuration affects all users and will be put somewhere appropriate:
|
306
|
-
|
307
|
-
- In Linux and on other FHS-compliant systems, this will be in /usr/share/mint
|
308
|
-
- On Mac OS X, this is going to land somewhere yet to be determined, possibly inside of /Library/Application Support/Mint or /usr/share/mint -- I haven't decided
|
309
|
-
- On Windows, this will end up *(somewhere dumber than before)*
|
310
|
-
|
311
|
-
These options give you the power to unify a directory or user or all users under a certain default layout and style. These options are all overridden via commandline options and only provide defaults so that you can save typing common commands. `mint` selects the most specific option possible, starting with the commandline, then checking local the config file, and finally moving to the user-wide and global config files.
|
312
|
-
|
313
|
-
If configuration options get complicated, it may be useful to list all active defaults, with more specific options replacing more general ones per above:
|
314
|
-
|
315
|
-
mint config
|
316
|
-
|
317
|
-
[Yaml]: http://yaml.org/
|
318
|
-
|
319
|
-
### Editing files in a project ###
|
320
|
-
|
321
|
-
Inside of a directory, you can edit any stylesheet or document template that would normally be used in your current context without delving into the Mint templates directories, except of course the default templates provided with Mint.
|
322
|
-
|
323
|
-
# Selects the first template in your path with the appropriate name:
|
324
|
-
mint edit --layout my-fun-layout
|
325
|
-
mint edit --style snazzy-styles
|
326
|
-
|
327
|
-
# Selects the template from a specified context
|
328
|
-
mint edit user --layout my-fun-layout
|
329
|
-
|
330
|
-
Mint will open the appropriate file in the editor specified by EDITOR. The same short forms listed earlier apply here:
|
331
|
-
|
332
|
-
mint edit -l normal
|
333
|
-
mint edit -s normal
|
334
|
-
|
335
|
-
The future of Mint
|
336
|
-
----------------------
|
337
|
-
|
338
|
-
This section documents features that do not yet exist, but that I would like to have in future versions of Mint.
|
339
|
-
|
340
|
-
### Composed styles ###
|
99
|
+
Plugins: A work in progress
|
100
|
+
---------------------------
|
341
101
|
|
342
|
-
|
102
|
+
I've designed the beginnings of a plugin system. With this system, you can implement a callback or two and have full control over document creation and sharing. I'll get documentation going soon. For now, look to lib/mint/plugins/epub.rb and bin/mint-epub for an example of how to build one. It's not complete and I'm open to API suggestions.
|
343
103
|
|
344
|
-
|
104
|
+
This is going to be useful for things like creating actual office documents or e-books or even bound novels. I'm actually thinking that half the power of this library is its plugin system.
|
345
105
|
|
346
|
-
|
106
|
+
[API]: http://github.com/davejacobs/mint/tree/master/doc/API.md
|
107
|
+
[Tilt templates]: http://github.com/rtomayko/tilt/blob/master/TEMPLATES.md "A listing of all templates supported by Tilt."
|
108
|
+
[CSS]: http://en.wikipedia.org/wiki/Cascading_Style_Sheets
|
109
|
+
[SASS/SCSS]: http://sass-lang.com/
|
110
|
+
[Less]: http://lesscss.org/
|
347
111
|
|
348
|
-
# Note: I haven't implemented this yet
|
349
|
-
mint package document.md
|
data/bin/mint
CHANGED
@@ -20,6 +20,11 @@ parser.parse!
|
|
20
20
|
# Mint::CommandLine.send(command, commandline_options)
|
21
21
|
|
22
22
|
case ARGV.first.downcase.to_sym
|
23
|
+
when :publish
|
24
|
+
commandline_options.delete :verbose
|
25
|
+
commandline_options.delete :simulation
|
26
|
+
ARGV.shift
|
27
|
+
Mint::CommandLine.publish!(ARGV, commandline_options)
|
23
28
|
when :help
|
24
29
|
Mint::CommandLine.help(parser.help)
|
25
30
|
when :install
|
@@ -37,14 +42,9 @@ else
|
|
37
42
|
# merge them with the config options, and start minting the
|
38
43
|
# document list.
|
39
44
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
commandline_options.delete :verbose
|
46
|
-
commandline_options.delete :simulation
|
47
|
-
|
48
|
-
Mint::CommandLine.mint(ARGV, commandline_options)
|
49
|
-
# end
|
45
|
+
begin
|
46
|
+
system "mint-#{ARGV.first} #{ARGV[1..-1].join ' '}"
|
47
|
+
rescue
|
48
|
+
Mint::CommandLine.help(parser.help)
|
49
|
+
end
|
50
50
|
end
|
data/bin/mint-epub
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# A script for publishing Mint in the ePub format
|
4
|
+
# Usage: mint epub [options] files
|
5
|
+
|
6
|
+
require 'mint'
|
7
|
+
require 'mint/plugins/epub'
|
8
|
+
|
9
|
+
# NOTE: This is not how I want this plugin to be called.
|
10
|
+
# However, I do want a first iteration of the plugin
|
11
|
+
# system on master, so we'll go with this for now.
|
12
|
+
|
13
|
+
def usage
|
14
|
+
abort 'mint epub publish file'
|
15
|
+
end
|
16
|
+
|
17
|
+
case ARGV.shift.downcase.to_sym
|
18
|
+
when :publish
|
19
|
+
destination = ARGV.first.gsub(/\.[^.]*$/, '')
|
20
|
+
opts = { destination: destination, style_destination: 'OPS' }
|
21
|
+
document = Mint::Document.new(ARGV.first, opts)
|
22
|
+
document.publish! :plugins => [Mint::EPub]
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Feature: Publish ePub document
|
2
|
+
As a writer
|
3
|
+
I want to create an ePub document at the command line from plain text
|
4
|
+
So that I can publish books from style-free text
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given a file named "content.md" with:
|
8
|
+
"""
|
9
|
+
Chapter 1
|
10
|
+
=========
|
11
|
+
|
12
|
+
This is a test. It is theoretically formatted in
|
13
|
+
the Markdown templating language.
|
14
|
+
|
15
|
+
Chapter 2
|
16
|
+
=========
|
17
|
+
|
18
|
+
This is a second chapter.
|
19
|
+
"""
|
20
|
+
|
21
|
+
Scenario: Publish document with defaults
|
22
|
+
When I run `mint-epub publish content.md`
|
23
|
+
Then a file named "content.epub" should exist
|