mint 0.5.1 → 0.7.1
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.
- data/Gemfile +18 -0
- data/README.md +3 -3
- data/bin/mint +27 -27
- data/bin/mint-epub +6 -6
- data/config/syntax.yaml +12 -12
- data/{templates → config/templates}/base/style.sass +11 -4
- data/config/templates/default/css/style.css +158 -0
- data/config/templates/default/layout.haml +8 -0
- data/{templates → config/templates}/default/style.sass +0 -0
- data/{templates/default → config/templates/protocol}/layout.haml +0 -0
- data/config/templates/protocol/style.sass +20 -0
- data/config/templates/reset.css +92 -0
- data/config/templates/zen/css/style.css +145 -0
- data/{templates/pro → config/templates/zen}/layout.haml +0 -0
- data/config/templates/zen/style.sass +24 -0
- data/features/config.feature +21 -0
- data/features/publish.feature +3 -3
- data/features/support/env.rb +9 -27
- data/features/templates.feature +79 -0
- data/lib/mint.rb +11 -11
- data/lib/mint/{commandline.rb → command_line.rb} +96 -80
- data/lib/mint/css.rb +43 -34
- data/lib/mint/document.rb +99 -93
- data/lib/mint/helpers.rb +21 -17
- data/lib/mint/layout.rb +1 -1
- data/lib/mint/mint.rb +92 -36
- data/lib/mint/plugin.rb +5 -5
- data/lib/mint/plugins/epub.rb +51 -51
- data/lib/mint/resource.rb +2 -2
- data/lib/mint/style.rb +2 -2
- data/lib/mint/version.rb +1 -1
- data/spec/command_line_spec.rb +87 -0
- data/spec/css_spec.rb +46 -0
- data/spec/document_spec.rb +38 -40
- data/spec/helpers_spec.rb +101 -83
- data/spec/layout_spec.rb +1 -1
- data/spec/mint_spec.rb +184 -60
- data/spec/plugin_spec.rb +61 -67
- data/spec/plugins/epub_spec.rb +47 -47
- data/spec/resource_spec.rb +9 -9
- data/spec/spec_helper.rb +20 -93
- data/spec/style_spec.rb +6 -8
- data/spec/support/fixtures/content.md +16 -0
- data/spec/support/fixtures/dynamic.sass +3 -0
- data/spec/support/fixtures/layout.haml +3 -0
- data/spec/support/fixtures/static.css +3 -0
- data/spec/support/matchers.rb +15 -0
- metadata +160 -70
- data/spec/commandline_spec.rb +0 -91
- data/templates/pro/style.sass +0 -0
data/Gemfile
ADDED
data/README.md
CHANGED
@@ -47,7 +47,7 @@ A basic Mint document
|
|
47
47
|
|
48
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.
|
49
49
|
|
50
|
-
document = Document.new
|
50
|
+
document = Document.new "Minimalism.md"
|
51
51
|
document.publish!
|
52
52
|
|
53
53
|
If you want to customize your document, though--and that's why I built this library--Mint makes that easy.
|
@@ -74,7 +74,7 @@ So if you're writing your layout using Haml, the template might look like this:
|
|
74
74
|
!!!
|
75
75
|
%html
|
76
76
|
%head
|
77
|
-
%link(rel=
|
77
|
+
%link(rel="stylesheet" href=stylesheet)
|
78
78
|
|
79
79
|
%body
|
80
80
|
#container= content
|
@@ -84,7 +84,7 @@ You can build stylesheets using [CSS][], [SASS/SCSS][] or [Less][]. They will al
|
|
84
84
|
Mint comes preloaded with several styles and layouts.
|
85
85
|
|
86
86
|
1. Default
|
87
|
-
2.
|
87
|
+
2. Zen
|
88
88
|
3. Resume\*
|
89
89
|
4. Protocol
|
90
90
|
5. Protocol Flow\* - requires Javascript and jQuery
|
data/bin/mint
CHANGED
@@ -1,38 +1,38 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# A script for harnessing Mint at the commandline
|
3
|
-
# Usage: mint [options] files
|
3
|
+
# Usage: mint [command] [options] [files]
|
4
4
|
|
5
|
-
require
|
5
|
+
require "mint"
|
6
|
+
require "shellwords"
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
process_opts = lambda {|k,v| commandline_options[k] = v }
|
10
|
-
parser = Mint::CommandLine.parser(&process_opts)
|
11
|
-
parser.parse!
|
8
|
+
argv, commandline_options, help =
|
9
|
+
Mint::CommandLine.parse(ARGV).values_at(:argv, :options, :help)
|
12
10
|
|
13
|
-
|
14
|
-
# will have to refactor commandline.rb code and tests
|
15
|
-
#
|
16
|
-
# first = ARGV.first.downcase.to_sym
|
17
|
-
# commands = [ :install, :edit, :set, :config ]
|
18
|
-
# command = commands.include?(first) ? command : :mint
|
19
|
-
|
20
|
-
# Mint::CommandLine.send(command, commandline_options)
|
21
|
-
|
22
|
-
case ARGV.first.downcase.to_sym
|
11
|
+
case argv.shift.downcase.to_sym
|
23
12
|
when :publish
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
13
|
+
# Aruba chokes here, so we use this hack to convince Mint we're
|
14
|
+
# not in a pipeline
|
15
|
+
files =
|
16
|
+
if $stdin.tty? || ENV["MINT_NO_PIPE"]
|
17
|
+
argv
|
18
|
+
else
|
19
|
+
$stdin.each_line.reduce [] do |list, line|
|
20
|
+
list.concat(Shellwords.split(line))
|
21
|
+
end
|
22
|
+
end
|
23
|
+
Mint::CommandLine.publish!(files, commandline_options)
|
28
24
|
when :help
|
29
|
-
Mint::CommandLine.help(
|
25
|
+
Mint::CommandLine.help(help)
|
30
26
|
when :install
|
31
|
-
Mint::CommandLine.install(
|
27
|
+
Mint::CommandLine.install(argv.shift, commandline_options)
|
28
|
+
when :uninstall
|
29
|
+
Mint::CommandLine.uninstall(argv.shift, commandline_options)
|
30
|
+
when :templates
|
31
|
+
Mint::CommandLine.templates(argv.shift, commandline_options)
|
32
32
|
when :edit
|
33
|
-
Mint::CommandLine.edit(
|
33
|
+
Mint::CommandLine.edit(argv.shift, commandline_options)
|
34
34
|
when :set
|
35
|
-
Mint::CommandLine.set(
|
35
|
+
Mint::CommandLine.set(argv.shift, argv.shift, commandline_options)
|
36
36
|
when :config
|
37
37
|
Mint::CommandLine.config
|
38
38
|
else
|
@@ -43,8 +43,8 @@ else
|
|
43
43
|
# document list.
|
44
44
|
|
45
45
|
begin
|
46
|
-
system
|
46
|
+
system 'mint-#{argv.first} #{argv[1..-1].join " "}'
|
47
47
|
rescue
|
48
|
-
Mint::CommandLine.help(
|
48
|
+
Mint::CommandLine.help(help)
|
49
49
|
end
|
50
50
|
end
|
data/bin/mint-epub
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# A script for publishing Mint in the ePub format
|
4
|
-
# Usage: mint epub [options] files
|
4
|
+
# Usage: mint epub [command] [options] [files]
|
5
5
|
|
6
|
-
require
|
7
|
-
require
|
6
|
+
require "mint"
|
7
|
+
require "mint/plugins/epub"
|
8
8
|
|
9
9
|
# NOTE: This is not how I want this plugin to be called.
|
10
10
|
# However, I do want a first iteration of the plugin
|
11
11
|
# system on master, so we'll go with this for now.
|
12
12
|
|
13
13
|
def usage
|
14
|
-
abort
|
14
|
+
abort "mint epub publish file"
|
15
15
|
end
|
16
16
|
|
17
17
|
case ARGV.shift.downcase.to_sym
|
18
18
|
when :publish
|
19
|
-
destination = ARGV.first.gsub(/\.[^.]*$/,
|
20
|
-
opts = { destination: destination, style_destination:
|
19
|
+
destination = ARGV.first.gsub(/\.[^.]*$/, "")
|
20
|
+
opts = { destination: destination, style_destination: "OPS" }
|
21
21
|
document = Mint::Document.new(ARGV.first, opts)
|
22
22
|
document.publish! :plugins => [Mint::EPub]
|
23
23
|
end
|
data/config/syntax.yaml
CHANGED
@@ -2,70 +2,70 @@ template:
|
|
2
2
|
short: t
|
3
3
|
long: template
|
4
4
|
parameter: true
|
5
|
-
description:
|
5
|
+
description: "Specify the template (layout + style)"
|
6
6
|
|
7
7
|
layout:
|
8
8
|
short: l
|
9
9
|
long: layout
|
10
10
|
parameter: true
|
11
|
-
description:
|
11
|
+
description: "Specify only the style"
|
12
12
|
|
13
13
|
style:
|
14
14
|
short: s
|
15
15
|
long: style
|
16
16
|
parameter: true
|
17
|
-
description:
|
17
|
+
description: "Specify only the style"
|
18
18
|
|
19
19
|
root:
|
20
20
|
short: w
|
21
21
|
long: r
|
22
22
|
parameter: true
|
23
|
-
description:
|
23
|
+
description: "Specify a root outside the current directory"
|
24
24
|
|
25
25
|
destination:
|
26
26
|
short: d
|
27
27
|
long: destination
|
28
28
|
parameter: true
|
29
|
-
description:
|
29
|
+
description: "Specify a destination directory, relative to the root"
|
30
30
|
|
31
31
|
style_destination:
|
32
32
|
short: n
|
33
33
|
long: style-destination
|
34
34
|
parameter: true
|
35
|
-
description:
|
35
|
+
description: "Specify a destination directory for stylesheets, or nil to link in place"
|
36
36
|
|
37
37
|
global:
|
38
38
|
short: G
|
39
39
|
long: global
|
40
40
|
parameter: false
|
41
|
-
description:
|
41
|
+
description: "Specify config changes on a global level"
|
42
42
|
|
43
43
|
user:
|
44
44
|
short: U
|
45
45
|
long: user
|
46
46
|
parameter: false
|
47
|
-
description:
|
47
|
+
description: "Specify config changes on a user-wide level"
|
48
48
|
|
49
49
|
local:
|
50
50
|
short: L
|
51
51
|
long: local
|
52
52
|
parameter: false
|
53
|
-
description:
|
53
|
+
description: "Specify config changes on a project-specific level"
|
54
54
|
|
55
55
|
force:
|
56
56
|
short: f
|
57
57
|
long: force
|
58
58
|
parameter: false
|
59
|
-
description:
|
59
|
+
description: "Force file overwrite without prompt"
|
60
60
|
|
61
61
|
verbose:
|
62
62
|
short: v
|
63
63
|
long: verbose
|
64
64
|
parameter: false
|
65
|
-
description:
|
65
|
+
description: "Verbose output"
|
66
66
|
|
67
67
|
simulation:
|
68
68
|
short: S
|
69
69
|
long: simulation
|
70
70
|
parameter: false
|
71
|
-
description:
|
71
|
+
description: "Simulate transformation without actually creating files"
|
@@ -57,7 +57,6 @@ ul, ol
|
|
57
57
|
p
|
58
58
|
margin: ($screen_unit / 2) 0
|
59
59
|
|
60
|
-
// For some reason this is necessary ...
|
61
60
|
ul+p, ol+p, blockquote+p, pre+p
|
62
61
|
text-indent: 0
|
63
62
|
|
@@ -69,7 +68,7 @@ a
|
|
69
68
|
text-decoration: underline
|
70
69
|
|
71
70
|
code
|
72
|
-
font-family: Menlo, Mensch,
|
71
|
+
font-family: Monaco, Menlo, Mensch, Consolas, Monotype, mono
|
73
72
|
font-style: normal
|
74
73
|
|
75
74
|
pre, blockquote
|
@@ -78,7 +77,7 @@ pre, blockquote
|
|
78
77
|
margin-right: $screen_unit * 2
|
79
78
|
padding: $screen_unit / 3 $screen_unit
|
80
79
|
padding-left: $screen_unit * 3/4
|
81
|
-
|
80
|
+
white-space: pre
|
82
81
|
|
83
82
|
p
|
84
83
|
margin: 0
|
@@ -96,15 +95,23 @@ img
|
|
96
95
|
#container
|
97
96
|
display: block
|
98
97
|
border: solid 1px #999
|
99
|
-
width:
|
98
|
+
width: 740px
|
100
99
|
padding: 60px
|
101
100
|
margin: ($screen_unit / 2) auto
|
102
101
|
background-color: #fff
|
102
|
+
box-sizing: border-box
|
103
|
+
-moz-box-sizing: border-box
|
104
|
+
-webkit-box-sizing: border-box
|
103
105
|
|
104
106
|
code
|
105
107
|
font-size: $screen_font_size * 7/8
|
106
108
|
|
107
109
|
pre
|
110
|
+
white-space: pre-wrap
|
111
|
+
white-space: -moz-pre-wrap
|
112
|
+
white-space: -o-pre-wrap
|
113
|
+
word-wrap: break-word
|
114
|
+
|
108
115
|
code
|
109
116
|
font-size: $screen_font_size * 3/4
|
110
117
|
|
@@ -0,0 +1,158 @@
|
|
1
|
+
@import url(../reset.css);
|
2
|
+
body {
|
3
|
+
font-family: Georgia, serif; }
|
4
|
+
|
5
|
+
h1, h2 {
|
6
|
+
line-height: 1.3; }
|
7
|
+
|
8
|
+
h2, h3, h4, h5, h6 {
|
9
|
+
line-height: 23.4px; }
|
10
|
+
|
11
|
+
h1, h2, h3, h4, h5, h6 {
|
12
|
+
font-weight: normal; }
|
13
|
+
|
14
|
+
h1 {
|
15
|
+
font-size: 27px;
|
16
|
+
margin-top: 23.4px;
|
17
|
+
margin-bottom: 23.4px; }
|
18
|
+
|
19
|
+
h2 {
|
20
|
+
font-size: 21.6px;
|
21
|
+
margin-top: 23.4px;
|
22
|
+
margin-bottom: 23.4px; }
|
23
|
+
|
24
|
+
h3 {
|
25
|
+
font-size: 19.8px;
|
26
|
+
margin-top: 35.1px;
|
27
|
+
margin-bottom: 11.7px; }
|
28
|
+
|
29
|
+
h4 {
|
30
|
+
font-size: 18.9px;
|
31
|
+
margin-top: 40.95px;
|
32
|
+
margin-bottom: 5.85px; }
|
33
|
+
|
34
|
+
h5, h6 {
|
35
|
+
font-size: 18px;
|
36
|
+
margin-top: 20.475px;
|
37
|
+
margin-bottom: 2.925px; }
|
38
|
+
|
39
|
+
ul {
|
40
|
+
list-style-type: square; }
|
41
|
+
ul ul {
|
42
|
+
list-style-type: circle; }
|
43
|
+
|
44
|
+
ul, ol {
|
45
|
+
margin: 5.85px 0 0 11.7px;
|
46
|
+
padding-left: 28.08px; }
|
47
|
+
ul li p, ol li p {
|
48
|
+
text-indent: 0 !important; }
|
49
|
+
ul li + li, ol li + li {
|
50
|
+
margin-top: 5.85px; }
|
51
|
+
|
52
|
+
p {
|
53
|
+
margin: 11.7px 0; }
|
54
|
+
|
55
|
+
ul + p, ol + p, blockquote + p, pre + p {
|
56
|
+
text-indent: 0; }
|
57
|
+
|
58
|
+
a:link, a:visited, a:active {
|
59
|
+
color: #cb0018;
|
60
|
+
text-decoration: none; }
|
61
|
+
a:hover {
|
62
|
+
text-decoration: underline; }
|
63
|
+
|
64
|
+
code {
|
65
|
+
font-family: Monaco, Menlo, Mensch, Consolas, Monotype, mono;
|
66
|
+
font-style: normal; }
|
67
|
+
|
68
|
+
pre, blockquote {
|
69
|
+
display: block;
|
70
|
+
margin-left: 23.4px;
|
71
|
+
margin-right: 46.8px;
|
72
|
+
padding: 7.8px 23.4px;
|
73
|
+
padding-left: 17.55px;
|
74
|
+
white-space: pre; }
|
75
|
+
pre p, blockquote p {
|
76
|
+
margin: 0;
|
77
|
+
line-height: 1.35; }
|
78
|
+
|
79
|
+
img {
|
80
|
+
display: block; }
|
81
|
+
|
82
|
+
@media screen {
|
83
|
+
body {
|
84
|
+
font-size: 18px;
|
85
|
+
line-height: 23.4px;
|
86
|
+
background-color: #666666; }
|
87
|
+
|
88
|
+
#container {
|
89
|
+
display: block;
|
90
|
+
border: solid 1px #999999;
|
91
|
+
width: 740px;
|
92
|
+
padding: 60px;
|
93
|
+
margin: 11.7px auto;
|
94
|
+
background-color: white;
|
95
|
+
box-sizing: border-box;
|
96
|
+
-moz-box-sizing: border-box;
|
97
|
+
-webkit-box-sizing: border-box; }
|
98
|
+
|
99
|
+
code {
|
100
|
+
font-size: 15.75px; }
|
101
|
+
|
102
|
+
pre {
|
103
|
+
white-space: pre-wrap;
|
104
|
+
white-space: -moz-pre-wrap;
|
105
|
+
white-space: -o-pre-wrap;
|
106
|
+
word-wrap: break-word; }
|
107
|
+
pre code {
|
108
|
+
font-size: 13.5px; } }
|
109
|
+
@media print {
|
110
|
+
@page {
|
111
|
+
margin-left: 1in;
|
112
|
+
margin-right: 1in;
|
113
|
+
margin-top: 1in;
|
114
|
+
margin-bottom: 1in; }
|
115
|
+
|
116
|
+
body {
|
117
|
+
font-size: 12pt;
|
118
|
+
line-height: 15.6pt;
|
119
|
+
width: auto;
|
120
|
+
margin: 0;
|
121
|
+
padding: 0; }
|
122
|
+
|
123
|
+
code {
|
124
|
+
font-size: 10.5pt; }
|
125
|
+
|
126
|
+
pre code {
|
127
|
+
font-size: 9pt; }
|
128
|
+
|
129
|
+
h1, h2, h3, h4, h5, h6, li, blockquote {
|
130
|
+
page-break-inside: avoid; }
|
131
|
+
|
132
|
+
p {
|
133
|
+
widows: 3;
|
134
|
+
orphans: 3; } }
|
135
|
+
body {
|
136
|
+
font-family: Georgia, "Hoefler Text", Garamond, FreeSerif, serif; }
|
137
|
+
|
138
|
+
h1 {
|
139
|
+
border-bottom: solid 2px #666666; }
|
140
|
+
|
141
|
+
h3 {
|
142
|
+
font-style: italic; }
|
143
|
+
|
144
|
+
h4 {
|
145
|
+
font-variant: small-caps; }
|
146
|
+
|
147
|
+
h5, h6 {
|
148
|
+
font-weight: bold; }
|
149
|
+
|
150
|
+
p + p {
|
151
|
+
text-indent: 23.4px; }
|
152
|
+
|
153
|
+
pre, blockquote {
|
154
|
+
font-size: 18px;
|
155
|
+
border-left: solid 2px #dddddd; }
|
156
|
+
|
157
|
+
blockquote {
|
158
|
+
font-style: italic; }
|