mint 0.1.1 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- *The following is a **rough draft** of the current Mint design, along with my future plans for the library and tool.*
1
+ *The following is a **rough draft** of the current Mint design, along with my future plans for the library and tool. The code is not yet tested, though it will be as soon as I decide on a framework, and the binary does not yet work. This is concept stuff, people.*
2
2
 
3
3
  If I believed in slogans...
4
4
  ---------------------------
@@ -14,7 +14,7 @@ Introduction
14
14
 
15
15
  Mint is an agile, lightweight solution for your documents.
16
16
 
17
- Mint manages your documents in a decentralized 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 tons of different views. Keeps your data and formatting separate. In a word: simplifies. In a couple of words: kicks ass.
17
+ 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.
18
18
 
19
19
  In a few more: *Mint processes words so you don't have to.*
20
20
 
@@ -25,38 +25,33 @@ I. Use cases
25
25
  II. The Mint library
26
26
  III. Designing a template
27
27
  IV. The Mint path
28
- V. The `mint` command
28
+ V. The `mint` command
29
29
  VI. Future directions and tools
30
30
 
31
31
  I. Use cases
32
32
  ------------
33
33
 
34
- 1. Jake has text files formatted as Markdown-style text. He has traditionally published these as blog entries, which works well because his webserver takes care of processing the Markdown, generating HTML, and styling it with his static CSS. Jake has no way of visualizing his documents without a webserver running. He likes the convenience of centralized CSS styles that he can update once and cascade everywhere. He does not like depending on a webserver for static pages. Jake wants a document management system where source files are written in Markdown but are "printed" into HTML and styled with centralized sheets he creates himself.
34
+ 1. Jake has text files formatted as Markdown-style text. He has traditionally published these as blog entries, which works well because his webserver takes care of processing the Markdown, generating HTML, and styling it with his static CSS. Jake has no way of visualizing his documents without a webserver running. He likes the convenience of centralized CSS styles that he can update once and cascade everywhere. He does not like depending on a webserver for static pages, i.e., his local documents. Jake wants a document management system where source files are written in Markdown but are "printed" into HTML and styled with centralized sheets he creates himself. In some cases, he merely wants to tweak the typography settings of a solid existing style. Above all, he wants simplicity: he does not want to have to put his documents into a certain structure in order for them to be rendered. And he wants default styles so that he doesn't have to create them on his own.
35
35
 
36
- 2. Donna has traditionally used a WYSIWYG word processor to create, edit, version, and present ideas in her personal and school life (not work). She wants her documents to exist forever without breaking standards: she wants them to be completely future-compatible. Therefore, she wants to migrate away from her proprietary word processor. She wants a migration tool to make the initial conversion. Interoperability with other people is not required. As long as she can view and print formatted documents, keeping source files as plaintext, she is happy.
36
+ 2. Donna has traditionally used a WYSIWYG word processor to create, edit, version, and present ideas in her personal and school life (not work). She wants her documents to exist forever without breaking standards: she wants them to be completely future-proof. Therefore, she wants to migrate away from her proprietary word processor. (Even non-proprietary word processors are really too heavyweight for her text-centered documents.) She wants a migration tool to make the initial conversion. Interoperability with other people is not required. As long as she can view and print formatted documents, keeping source files as plain text, she is happy.
37
37
 
38
- 3. Bertrande wants to build a styles gallery that previews certain styles on Textile-formatted documents using a web application... (finish later)
39
-
40
- 4. Marina wants to convert all her proprietary processed documents to Markdown for future compatibility, but wants to share these documents with friends at work. Interoperability is important here. The friends should be able to easily view *and* edit *and* annotate all documents.
38
+ 3. Marina wants to convert all her proprietary processed documents to Markdown for future compatibility, but wants to share these documents with friends at work. Interoperability is important here. The friends should be able to easily view *and* edit *and* annotate all documents. Marina will be happiest if she has a simple GUI that can export documents to an open-source document format that's interoperable with word processors.
41
39
 
42
40
  II. The Mint library
43
41
  --------------------
44
42
 
45
- This section discusses the Mint library API. Read on for the mint binary.
46
-
43
+ This section discusses the Mint library API. This library encapsulates the idea of a styled document, which is composed of a stylesheet, a layout and content. Mint makes combining those seemless. See **The `mint` command** for more information on an easy-to-use binary.
44
+
47
45
  ### A basic Mint document ###
48
46
 
49
- 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 name or director--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.
47
+ 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.
50
48
 
51
- document = Document.new '~/Documents/Minimalism.md'
52
- document.press
53
-
54
- And voilà, you will find the following next to Minimalism.md in the same directory:
49
+ document = Document.new '~/Documents/Minimalism.md'
50
+ document.mint
55
51
 
56
- - Minimalism.html
57
- - styles/default.css
52
+ And voilà, Minimalism.html will show up next to Minimalism.md.
58
53
 
59
- Opening Minimalism.html with your favorite web browser--[Firefox is best for typography][Firefox typography]--will show what looks like a word processed document, complete with big bolded headers, italic emphasis, automatically numbered lists, and bullets.
54
+ Opening Minimalism.html with your favorite web browser--[Firefox is best for typography][Firefox typography], but Webkit-based browsers (Chrome, Safari) work, too--will show what looks like a word processed document, complete with big bolded headers, italic emphasis, automatically indented and numbered lists, and bullets. If you're in a modern browser, you'll even see ligatures and proper kerning. The page will be on a white canvas that looks like a page, even though you are in a browser.
60
55
 
61
56
  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.)
62
57
 
@@ -70,101 +65,84 @@ To understand how the library works, with and without configuration, it is helpf
70
65
 
71
66
  You can pass any of the following to a new document:
72
67
 
73
- - `:layout` and `:style` are names of templates or file names.
68
+ - `:layout` and `:style` are names of templates or file names. They can be overridden by `:template`, which sets both to the same name.
74
69
 
75
70
  Defaults:
76
-
77
- :layout => 'default'
78
- :style => 'default'
79
71
 
80
- Notes:
81
-
82
- 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:
72
+ :template => 'default'
83
73
 
84
- PATH/templates/TEMPLATE_NAME/style.sass
85
- PATH/templates/TEMPLATE_NAME/layout.haml
86
-
87
- 2. If you specify a template name, it MUST be a simple name without extensions or directories included. Also, it must not be the name of a file in the working directory. (It is unlikely you'll have an extension-less file named 'normal' or 'default' in your working directory.)
74
+ Notes:
88
75
 
89
- 3. You can include path information if you're specifying a source file instead of a template name. If you do specify a file, the path/file will be resolved from the directory where you're calling Mint (the 'working directory'). If you're going 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 the context of your source directory. Alternatively, you can use [`Dir.chdir`][Dir::chdir method] for the same effect.
76
+ 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:
90
77
 
91
- 4. You can specify nil if you don't want a style to be rendered. This is useful if you're pointing a lot of documents to one stylesheet and only want to Mint the stylesheet one time.
78
+ ${MINT_PATH}/templates/template_name/style.css
79
+ ${MINT_PATH}/templates/template_name/layout.haml
92
80
 
93
- - `:root` is the root context of the final document. That is, the output. All relative *output* paths are resolved from the root path. `:root` itself must be an absolute path or nil. In most cases where you want a relative `:root`, try using `:destination`, instead. `:root` is most useful when compiling several source documents from different folders into a single, centralized directory.
94
-
95
- Default:
96
-
97
- :root => nil
98
-
99
- Notes:
100
-
101
- 1. If nil, `:root` defaults to your content's parent directory.
102
- 2. `:root` MUST be a directory.
81
+ 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.
103
82
 
104
- - `:destination` lets you specify a subdirectory for your output. There is an option to specify a separate `:style_destination`. The former is resolved relative to `:root`. The latter is resolved relative to `:destination`.
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`.
105
84
 
106
85
  Defaults:
107
86
 
108
- :destination => nil
87
+ :destination => ''
109
88
  :style_destination => nil
110
89
 
111
90
  Notes:
112
91
 
113
- 1. `:destination` MUST refer to a directory and *not* a file. If you want to specify the output file name, use the `:name` parameter.
92
+ 1. `:destination` *must* refer to a directory (existing or not) and not a file.
114
93
 
115
- 2. Mint resolves `:destination` relative to `:root` and serves as a way of organizing output files. `:style_destination` is resolved relative to `:destination` so that packaging styles inside document directories is easy. (This supports the common case where you will want a subdirectory called `'styles'` to hold your style files.)
94
+ 2. `:style_destination` is resolved relative to `:destination` so that packaging styles inside document directories is easy. (This supports the common case where you will want a subdirectory called 'styles' to hold your style files.) When `:style_destination` is nil (default), the stylesheet will not be copied anywhere. Instead, your document will link to the rendered stylesheet in place. If `:style_destination` is 'inline', your style will be included inline with your published document.
116
95
 
117
- 3. If either value is nil, it is simply ignored.
118
-
119
- - `:name` is the name of the output file, which will end up in `/:root/:destination/`. `:style_name` is the name of the stylesheet output file and will show up in `/:root/:destination/:style_destination/`.
120
-
121
- Defaults:
122
-
123
- :name => nil
124
- :style_name => nil
96
+ ### Examples ###
125
97
 
126
- Notes:
98
+ At this point, a couple of example may be useful.
127
99
 
128
- 1. If nil, the name of a Document or stylesheet comes from it's source file. (Minimalism.md will turn into Minimalism.html without configuration.)
100
+ The following are possible:
129
101
 
130
- In summary: if `:root` is unspecified, it will be the directory where your content file. The rendered content and style files will be placed directly into this directory unless given a specific `:destination`. The output names will come from their source files unless you specify `:name`.
102
+ include Mint
103
+ content = '~/Documents/Minimalism.md'
104
+
105
+ Document.new content
106
+ Document.new content, :destination => 'directory', :style => 'serif-pro'
107
+ Document.new content, :style => Style.new(:normal)
108
+
109
+ Style.new 'normal'
110
+ Style.new :normal
111
+ Style.new '~/Sites/Common Styles/normal.css', :destination => 'styles'
112
+ Style.new '~/Sites/Common Styles/normal.css',
113
+ :style_destination => 'inline'
114
+ Style.new 'Common Styles/normal.css'
131
115
 
132
- Without configuration, `destination = root = content.dirname.expand_path`
116
+ > Note: A style's destination is specified as `:destination` when passed directly to the file or as `:style_destination` when passed to a document or project
133
117
 
134
- ### Examples ###
118
+ If block-style initiation is your thing:
135
119
 
136
- At this point, a couple of example may be useful.
120
+ Document.new content do |d|
121
+ d.destination = 'final'
122
+ d.template = 'resume'
123
+ end
137
124
 
138
- The following are possible:
125
+ > Note: Block-style indentation passes the block to you *after* initializing
126
+ > the document with default values. So you do not need to worry about
127
+ > specifying each argument. Anything you specify will override what
128
+ > is already there.
139
129
 
140
- content = '~/Documents/Minimalism.md'
141
-
142
- Document.new content
143
-
144
- Document.new content, :root => '~/Documents/Final', :destination => 'directory', :name => 'final.html'
145
- Document.new content, :root => 'directory'
146
- Document.new content, :root => 'directory', :destination => 'subdirectory'
147
-
148
- Style.new 'normal'
149
- Style.new '~/Sites/Commons/style/normal.sass', :destination => 'style', :name => 'normal.css' # :destination is converted to :style_destination in the context of a document
150
- Style.new '~/Sites/Commons/style/normal.css'
151
- Style.new 'Commons/style/normal.css'
152
-
153
- If block-style initiation is your thing:
130
+ One warning: when you initialize a document via a block, do not try
131
+ the following:
154
132
 
155
133
  Document.new content do |d|
156
- d.root = 'my-book'
157
- d.name = 'my-book-final-draft.html'
158
-
159
- d.style 'normal' do |s|
160
- s.destination = 'styles'
161
- s.name = 'stylesheet.css'
162
- end
134
+ # The wrong way to block-initialize a style destination:
135
+ d.style_destination = 'styles'
163
136
  end
164
-
165
- > Note: Block-style indentation passes the block to you after initializing
166
- > the Document with default values. So you do not need to worry about
167
- > specifying each argument. Anything you specify will override what is already there.
137
+
138
+ Because `:style_destination` translates internally to `:destination` (so that it can be passed to the style initializer), setting `:style_destination` is meaningless in a document block. Instead, you should do the following:
139
+
140
+ Document.new content do |d|
141
+ # The right way to block-initialize a style destination:
142
+ d.style.destination = 'styles'
143
+ end
144
+
145
+ *(Should this change? Maybe I'll fix that.)*
168
146
 
169
147
  [Dir::chdir method]: http://ruby-doc.org/core/classes/Dir.html#M002314 "You can change the current directory context with Dir::chdir(path)"
170
148
 
@@ -173,15 +151,17 @@ III. Designing a template
173
151
 
174
152
  Templates can be written in any format accepted by the Tilt template interface library. (See [the Tilt TEMPLATES file][Tilt templates] for more information.)
175
153
 
176
- Mint gives you convenience methods that you can use in your templates.
154
+ Templates are rendered in the context of the document they are "about", so Mint documents give you convenience methods you can easily use in your templates.
177
155
 
178
156
  ### Place your content, point to your styles ###
179
157
 
180
- If you're designing a layout, you need to indicate where Mint should place your content. Therefore, raw HTML files cannot be layouts. Instead, if you want to use HTML templates, you should change the extension to .erb. These files are essentially HTML with the possibility for Ruby calls.
158
+ In Mint layouts, Ruby calls are sparse but necessary.
159
+
160
+ 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.
181
161
 
182
- Inside your template, use the keyword (well, actually the method) `content` to place your source's content.
162
+ Inside your template, use the `content` method to place your source's content.
183
163
 
184
- 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 keyword `stylesheet`.
164
+ 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.
185
165
 
186
166
  So if you're writing your layout using Erb, the template might look like this:
187
167
 
@@ -190,7 +170,7 @@ So if you're writing your layout using Erb, the template might look like this:
190
170
  <head>
191
171
  <link rel='stylesheet' href='<%= stylesheet %>' />
192
172
  </head>
193
-
173
+
194
174
  <body>
195
175
  <div id='container'>
196
176
  <%= content %>
@@ -203,83 +183,103 @@ The same layout in Haml would be:
203
183
  !!!
204
184
  %html
205
185
  %head
206
- %link{ :rel => 'stylesheet', :href => stylesheet }
207
-
186
+ %link(rel='stylesheet' href=stylesheet)
187
+
208
188
  %body
209
189
  #container= content
210
-
190
+
211
191
  ### Style your content ###
212
192
 
213
- You can build stylesheets using [CSS][], [Sass/Scss][] or [Less][].
193
+ You can build stylesheets using [Css][], [Sass/Scss][] or [Less][]. They will
194
+ always be compiled. They will only be copied, though, if you specify a style
195
+ destination.
214
196
 
215
197
  [Tilt templates]: http://github.com/rtomayko/tilt/blob/master/TEMPLATES.md "A listing of all templates supported by Tilt."
216
- [CSS]: http://en.wikipedia.org/wiki/Cascading_Style_Sheets
198
+ [Css]: http://en.wikipedia.org/wiki/Cascading_Style_Sheets
217
199
  [Sass/Scss]: http://sass-lang.com/
218
200
  [Less]: http://lesscss.org/
219
201
 
220
- Mint comes preloaded with several styles and layouts:
202
+ Mint comes preloaded with several styles and layouts.
221
203
 
222
204
  1. Default
223
205
  2. Serif Pro
224
206
  3. Sans Pro
225
207
  4. Protocol
226
- 5. Protocol Flow - requires Javascript
208
+ 5. Protocol Flow - requires Javascript and jQuery
227
209
  6. Resume
228
210
 
211
+ > Note: These aren't all designed yet. Also, if you have a killer
212
+ > template you think should be included, send it my way. I'll check
213
+ > it out and see if it should be part of the standard template library.
214
+ > (Of course, you'll get all the credit.)
215
+
216
+ I'm going to build a template extension system soon so that you can easily base your template off of another one using its template name, and without knowing its location on disk.
217
+
229
218
  IV. The Mint path
230
219
  -----------------
231
220
 
232
- Mint's path can be useful for a lot of things, especially for extensions and tools that use the library. The most important use for the path in the library is to find named templates.
221
+ 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.)
233
222
 
234
- When given a style or layout name (instead of a file name), Mint will search its paths in order until it finds the appropriate template. If no template is found, it will fall back to the default template.
223
+ So here's the rundown.
224
+
225
+ 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.
235
226
 
236
227
  The default Mint path (in order) is:
237
228
 
238
229
  - the current working directory
239
- - HOME_DIRECTORY/.mint
240
- - /usr/share/mint (or whatever your system uses for system-wide configuration)
241
- - the gem's source directory (as a final effort)
230
+ - ${HOME}/.mint
231
+ - /usr/share/mint (or whatever your system uses for system-wide configuration - Mint will make a smart guess)
232
+ - the Mint gem directory (which holds the Mint-approved templates)
242
233
 
243
234
  Templates should be in a directory named templates. Inside this directory, there should be a subdirectory for each template:
244
235
 
245
- - PATH/templates/normal/style.sass
246
- - PATH/templates/normal/layout.haml
247
-
248
- Normally a style will go best with its complement layout. However, layouts and styles can be mixed and matched at your discretion. This is especially true where you are not using stylesheets to format specific IDs or classes you're expecting to find in your layout. (In other words, this works best when you're focused on typography and not page layout.)
236
+ - ${MINT\_PATH}/templates/normal/style.css
237
+ - ${MINT\_PATH}/templates/normal/layout.haml
238
+
239
+ 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.)
249
240
 
250
241
  V. The `mint` command
251
242
  ---------------------
252
243
 
253
- *The `mint` command is not yet functional.*
244
+ *The `mint` command is almost functional. Testing is in development.*
254
245
 
255
246
  ### The basic `mint` command ###
256
247
 
257
- The easiest Mint command doesn't require configuration. It will transform all of your Documents into HTML and link all of them to the default stylesheet, which will be output in the same directory as the source documents.
248
+ 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.)
249
+
250
+ mint Minimalism.md # creates Minimalism.html
251
+
252
+ 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:
253
+
254
+ mint Minimalism.md Proposal.md Protocol.md
258
255
 
259
- mint
260
-
261
- If you have a ./templates/default/ subdirectory, the templates found in that directory will be used.
262
-
263
256
  This command can be tweaked with options and arguments to be more flexible:
264
257
 
265
- mint Minimalism.md # renders a specific file
266
- mint Minimalism.md Final.html # specifies an output file
267
- mint Minimalism.md --style=resume # specifies a style template
268
- mint Minimalism.md --root=~/Documents/Minimalism --style=default --style-destination=styles
258
+ mint Minimalism.md --template resume # specifies a style template
259
+ mint Minimalism.md --destination final --style-destination=styles
269
260
 
270
- ### Mint options &amp; shortcuts ###
261
+ ### Mint options & shortcuts ###
271
262
 
272
- You can pass several options to `mint`. Each option has a short form.
263
+ You can pass several options to `mint`. Following the Unix tradition, common options have a short and long form.
273
264
 
274
265
  The following correspond to the parameters you can pass to `Mint::Document.new`, as described in [The Mint library][]:
275
266
 
276
- - `--layout, -L`
277
- - `--style, -S`
278
- - `--root, -R`
279
- - `--destination, -D`
280
- - `--name, -N`
281
- - `--style-destination`
282
- - `--style-name`
267
+ - `--template, -t`
268
+ - `--layout, -l`
269
+ - `--style, -s`
270
+ - `--destination, -d`
271
+ - `--style-destination, -n`
272
+ - `--copy-style`
273
+
274
+ There are also scoping options, both for the `set` and `edit` commands:
275
+
276
+ - `--global, -G`
277
+ - `--user, -U`
278
+ - `--local, -L`
279
+
280
+ *If you've used `MINT_PATH` to set up Mint, then you should be aware that
281
+ `--local` refers to the first element, `--user` refers to the second, and
282
+ `--global` refers to the third.*
283
283
 
284
284
  Other options have nothing to do with document configuration but are there for convenience:
285
285
 
@@ -288,92 +288,82 @@ Other options have nothing to do with document configuration but are there for c
288
288
 
289
289
  [The Mint library]: #ii_the_mint_library
290
290
 
291
- ### Mint projects ###
291
+ ### `mint` command vocabulary ###
292
292
 
293
- A more powerful and reconfigurable version of Mint uses Mint projects. To initialize a project in the current directory:
293
+ 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.
294
294
 
295
- mint init
295
+ Currently, the `mint` vocabulary consists of `set`, `edit`, and `config`.
296
296
 
297
- The following does the same thing, but all documents rendered in this project will use the normal template (both layout and style) by default.
298
-
299
- mint init --template normal
297
+ ### `mint` configuration ###
300
298
 
301
- The following does the same thing, but all documents rendered in this project will use the protocol.haml layout and serif-professional style by default.
302
-
303
- mint init --layout protocol.haml --style serif-professional
304
-
305
- You will want to make sure that your layouts and styles are compatible. Most text-heavy layouts should be compatible with any style (and Mint is made for text-heavy documents). If you're using Mint with specialized style files, though, and expect certain IDs and classes in your layout document, you will want to check for layout/style compatibility.
299
+ `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`.
306
300
 
307
- A project stores references to all of its documents. You can list documents with:
301
+ To set a local (directory-specific) configuration option, call `mint set`:
308
302
 
309
- mint list
303
+ mint set [local] --template serif-professional --destination final
310
304
 
311
- You can find out which documents have been minted (and where), along with any universal templates using:
305
+ This will create (or update) a config file: ./.mint/config.yml
312
306
 
313
- mint status
314
-
315
- ### Project configuration ###
307
+ It will contain:
316
308
 
317
- Mint projects can be associated with [Yaml configuration files][Yaml]. These files are created if you pass any options to `mint init` when you create a project. Alternatively, you can set global configuration options after creating a project:
309
+ template: serif-professional
310
+ destination: final
318
311
 
319
- mint set --template serif-pro
312
+ From now on, calling `mint` in this directory will automatically draw on these two options. (Commandline options will override these file options.)
320
313
 
321
- Projects use configuration files *and not command-line options* to determine how they should behave. You can modify the config file through the command line, but do not use the command line to pass options while minting an entire project.
314
+ You can also set user-wide options:
322
315
 
323
- In other words, this is okay for minting a single file:
316
+ mint set --user template=professional
324
317
 
325
- mint --template normal
326
-
327
- It is *not* okay if you are inside a project. In this case, you SHOULD alter the configuration file (via command line or an editor) and then type:
318
+ Doing so will create the same style config file, but in your system's user-wide configuration location:
319
+
320
+ - In Linux and other FHS-compliant systems, and on Mac OS X this
321
+ will be in ~/.mint/config.yaml
322
+ - In Windows, this will be *(somewhere dumb...)*
323
+
324
+ Finally, you can set global options for all users:
325
+
326
+ mint set --global template=normal
328
327
 
329
- mint
330
-
331
- The config.yaml file can include the following options:
332
-
333
- layout: normal
334
- destination: output
335
- style: normal
336
- style_destination: styles
337
- template: resume # overrides layout and style options
328
+ This configuration affects all users and will be put somewhere appropriate:
338
329
 
339
- [...]
330
+ - In Linux and on other FHS-compliant systems, this will be in /usr/share/mint
331
+ - On Mac OS X, this is going to land somewhere unknown, possibly inside
332
+ of /Library/Application Support/Mint or /usr/share/mint -- I haven't decided
333
+ - On Windows, this will end up *(somewhere dumber than before)*
340
334
 
341
- These files give you the power to unify a project with a certain layout and style.
342
-
343
- If configuration options get complicated, it may be useful to list all active defaults:
335
+ 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.
336
+
337
+ If configuration options get complicated, it may be useful to list all active defaults, with more specific options replacing more general ones per above:
344
338
 
345
339
  mint config
346
-
340
+
347
341
  [Yaml]: http://yaml.org/
348
-
342
+
349
343
  ### Editing files in a project ###
350
344
 
351
- Inside of a project directory, you can edit any stylesheet or document template that would normally be used by the project without delving into the Mint templates directories.
345
+ 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.
346
+
347
+ # Selects the first template in your path with the appropriate name:
348
+ mint edit --layout my-fun-layout
349
+ mint edit --style snazzy-styles
352
350
 
353
- mint edit --layout default # selects the first template in your path
354
- mint edit --style normal # with the appropriate name
351
+ # Selects the template from a specified context
352
+ mint edit user --layout my-fun-layout
355
353
 
356
- Mint will open the appropriate file in the editor specified by EDITOR. There is a short form for each option:
354
+ Mint will open the appropriate file in the editor specified by EDITOR. The same short forms listed earlier apply here:
357
355
 
358
356
  mint edit -L normal
359
357
  mint edit -S normal
360
358
 
361
- To remove all mint-generated files in a directory (or for a package):
362
-
363
- mint restore .
364
-
365
359
  VI. The future of Mint
366
360
  ----------------------
367
361
 
368
362
  This section documents features that do not yet exist, but that I would like to have in future versions of Mint.
369
363
 
370
- ### Possible next steps ###
371
-
372
- I might introduce the concept of a project registry. This would allow for interlinking between Mint projects scattered around a system, or perhaps even remotely. (How useful would a remote link be without the Web, though?)
373
-
374
- `mint init` would register a project, whose name would be based on its parent directory. The project directory would be a user-wide listing that could allow hyperlinking between separate Mint projects, along with use of common stylesheets. There would also be a manual option:
364
+ ### Composed styles ###
375
365
 
376
- mint add --project ~/Projects/NamedProject --name=NamedProject
366
+ Not everyone wants to code an entire stylesheet every time he wants a new look. In fact, the most common use case for stylesheets is probably tweaking typography. For this reason (and to make this tool as accessible as possible), I want to implement a feature where you can select one stylesheet as a base and implement tweaks on top of that file. Of course Css makes this easy enough, but I want to implement this feature in such a way that it is easy and intuitive for everyone.
377
367
 
378
368
  ### Packages ###
379
369
 
@@ -383,57 +373,14 @@ Sometimes, it may be useful to "finalize" the design of a document, for example,
383
373
 
384
374
  To package a document with its stylesheet, as a sort of a printing:
385
375
 
386
- mint package document.md --name Document # will get the extension .pkg?
387
-
388
- Eventually, I want this to include multiple output formats, like HTML4, HTML5, PDF and ePub. The format opened by the `mint open` command could be determined by the application you choose to open it with.
376
+ mint package document.md --name Document
389
377
 
390
- When that does happen, you'll also be able to set the default version of the document that will open using:
391
-
392
- mint set --package-default html5
393
-
394
- ### My dreams about Mint, and where it could go ###
395
-
396
- I have more ideas for Mint, but they are probably far-off pipe dreams.
378
+ Eventually, this could include multiple output formats, like Html4, Html5, Pdf and ePub. The format opened by the `mint open` command could be determined by the application you choose to open it with. (This would take some serious OS hacking, I think.)
397
379
 
398
- What if Mint were social and a good citizen with respect to data portability? This could look like:
399
-
400
- mint share --user http://davejacobs.myopenid.com/
401
- mint share --user =david --service freeXRI
402
- mint share --user @dave_jacobs --service twitter
403
- mint share --service twitter
404
-
405
- For this last command, Mint would upload an HTML to a preconfigured FTP server or web application and then post a link to that document in the recipient's Twitter stream. I'm not sure exactly how this would go.
380
+ When that does happen, you'll also be able to set the default version of the document that will open using:
406
381
 
407
- The configuration file could look something like:
408
-
409
- services:
410
- - twitter:
411
- authorization: OAuth
412
- key: etc.
382
+ mint set [local] --package-default html5
413
383
 
414
- - openid:
415
- url: http://davejacobs.myopenid.com/
416
- authorization: OAuth
417
- key: etc.
418
-
419
- Or you could publish multiple output formats, and to multiple locations:
420
-
421
- mint publish --ftp default
422
- mint publish --blog personal
423
-
424
- The configuration:
425
-
426
- publishers:
427
- - ftp:
428
- - default:
429
- server: ftp.provider.com
430
- security: sftp
431
- directory: /home/USERNAME/example.com/documents
432
- - blog:
433
- - personal:
434
-
435
- Or you could connect to a service to protect your intellectual property rights:
436
-
437
- mint copyright
438
-
439
- I don't know if this is even possible, but wouldn't it be cool to generate a unique number based on the date, time, and contents of any article published and assign it to the article as a hash of all its metadata. The number would be so complex that you could not generate it without all the appropriate data. And using all the appropriate metadata (including date) would give the same number every time. But somehow, the algorithm would have to never run after the current date, so that potential plagiarists could not figure out what the hash should be for a date previous to the date you published it. That idea needs work, but I feel like maybe it could work out, probably as a separate service. Wouldn't it be cool?
384
+ ### More ###
385
+
386
+ More ideas are coming soon...