mint 0.7.3 → 0.8.0

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.
Files changed (71) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +23 -14
  3. data/LICENSE +22 -0
  4. data/README.md +82 -56
  5. data/bin/mint +47 -10
  6. data/bin/mint-epub +1 -4
  7. data/config/templates/base/style.css +187 -0
  8. data/config/templates/default/css/style.css +126 -79
  9. data/config/templates/default/layout.erb +10 -0
  10. data/config/templates/default/style.css +237 -0
  11. data/config/templates/garden/layout.erb +38 -0
  12. data/config/templates/garden/style.css +303 -0
  13. data/config/templates/newspaper/layout.erb +16 -0
  14. data/config/templates/nord/layout.erb +11 -0
  15. data/config/templates/nord/style.css +339 -0
  16. data/config/templates/nord-dark/layout.erb +11 -0
  17. data/config/templates/nord-dark/style.css +339 -0
  18. data/config/templates/protocol/layout.erb +9 -0
  19. data/config/templates/protocol/style.css +25 -0
  20. data/config/templates/zen/layout.erb +11 -0
  21. data/config/templates/zen/style.css +114 -0
  22. data/lib/mint/command_line.rb +253 -111
  23. data/lib/mint/css.rb +11 -4
  24. data/lib/mint/css_template.rb +37 -0
  25. data/lib/mint/document.rb +193 -43
  26. data/lib/mint/helpers.rb +50 -10
  27. data/lib/mint/layout.rb +2 -3
  28. data/lib/mint/markdown_template.rb +47 -0
  29. data/lib/mint/mint.rb +181 -114
  30. data/lib/mint/plugin.rb +3 -3
  31. data/lib/mint/plugins/epub.rb +1 -2
  32. data/lib/mint/resource.rb +19 -9
  33. data/lib/mint/style.rb +10 -14
  34. data/lib/mint/version.rb +1 -1
  35. data/lib/mint.rb +1 -0
  36. data/man/mint.1 +135 -0
  37. data/spec/cli/README.md +99 -0
  38. data/spec/cli/argument_parsing_spec.rb +207 -0
  39. data/spec/cli/bin_integration_spec.rb +348 -0
  40. data/spec/cli/configuration_management_spec.rb +363 -0
  41. data/spec/cli/full_workflow_integration_spec.rb +527 -0
  42. data/spec/cli/publish_workflow_spec.rb +368 -0
  43. data/spec/cli/template_management_spec.rb +300 -0
  44. data/spec/css_spec.rb +1 -1
  45. data/spec/document_spec.rb +105 -68
  46. data/spec/helpers_spec.rb +42 -42
  47. data/spec/mint_spec.rb +104 -80
  48. data/spec/plugin_spec.rb +86 -88
  49. data/spec/run_cli_tests.rb +95 -0
  50. data/spec/spec_helper.rb +8 -1
  51. data/spec/style_spec.rb +18 -16
  52. data/spec/support/cli_helpers.rb +169 -0
  53. data/spec/support/fixtures/content-2.md +16 -0
  54. data/spec/support/matchers.rb +1 -1
  55. metadata +145 -167
  56. data/config/syntax.yaml +0 -71
  57. data/config/templates/base/style.sass +0 -144
  58. data/config/templates/default/layout.haml +0 -8
  59. data/config/templates/default/style.sass +0 -36
  60. data/config/templates/protocol/layout.haml +0 -7
  61. data/config/templates/protocol/style.sass +0 -20
  62. data/config/templates/zen/css/style.css +0 -145
  63. data/config/templates/zen/layout.haml +0 -7
  64. data/config/templates/zen/style.sass +0 -24
  65. data/features/config.feature +0 -21
  66. data/features/plugins/epub.feature +0 -23
  67. data/features/publish.feature +0 -73
  68. data/features/support/env.rb +0 -15
  69. data/features/templates.feature +0 -79
  70. data/spec/command_line_spec.rb +0 -87
  71. data/spec/plugins/epub_spec.rb +0 -242
@@ -1,158 +1,205 @@
1
- @import url(../reset.css);
1
+ @import '../reset.css';
2
2
  body {
3
- font-family: Georgia, serif; }
3
+ font-family: Ubuntu, "Hoefler Text", "Grandesign Neue Serif", Ubuntu, Georgia, FreeSerif, serif, Georgia, serif;
4
+ }
4
5
 
5
6
  h1, h2 {
6
- line-height: 1.3; }
7
+ line-height: 1.3;
8
+ }
7
9
 
8
10
  h2, h3, h4, h5, h6 {
9
- line-height: 23.4px; }
11
+ line-height: 22.5px;
12
+ }
10
13
 
11
14
  h1, h2, h3, h4, h5, h6 {
12
- font-weight: normal; }
15
+ font-family: "Hoefler Text", Garamond, Georgia;
16
+ font-weight: normal;
17
+ }
13
18
 
14
19
  h1 {
15
- font-size: 27px;
16
- margin-top: 23.4px;
17
- margin-bottom: 23.4px; }
20
+ font-size: 22.5px;
21
+ margin-top: 22.5px;
22
+ margin-bottom: 22.5px;
23
+ }
18
24
 
19
25
  h2 {
20
- font-size: 21.6px;
21
- margin-top: 23.4px;
22
- margin-bottom: 23.4px; }
26
+ font-size: 18px;
27
+ margin-top: 33.75px;
28
+ margin-bottom: 11.25px;
29
+ }
23
30
 
24
31
  h3 {
25
- font-size: 19.8px;
26
- margin-top: 35.1px;
27
- margin-bottom: 11.7px; }
32
+ font-size: 16.5px;
33
+ margin-top: 39.375px;
34
+ margin-bottom: 5.625px;
35
+ }
28
36
 
29
37
  h4 {
30
- font-size: 18.9px;
31
- margin-top: 40.95px;
32
- margin-bottom: 5.85px; }
38
+ font-size: 15.75px;
39
+ margin-top: 19.6875px;
40
+ margin-bottom: 2.8125px;
41
+ }
33
42
 
34
43
  h5, h6 {
35
- font-size: 18px;
36
- margin-top: 20.475px;
37
- margin-bottom: 2.925px; }
44
+ font-size: 15px;
45
+ margin-top: 19.6875px;
46
+ margin-bottom: 2.8125px;
47
+ }
38
48
 
39
49
  ul {
40
- list-style-type: square; }
41
- ul ul {
42
- list-style-type: circle; }
50
+ list-style-type: square;
51
+ }
52
+ ul ul {
53
+ list-style-type: circle;
54
+ }
43
55
 
44
56
  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; }
57
+ margin: 5.625px 0 0 11.25px;
58
+ padding-left: 27px;
59
+ }
60
+ ul li p, ol li p {
61
+ text-indent: 0 !important;
62
+ }
63
+ ul li + li, ol li + li {
64
+ margin-top: 5.625px;
65
+ }
51
66
 
52
67
  p {
53
- margin: 11.7px 0; }
68
+ margin: 11.25px 0;
69
+ }
54
70
 
55
71
  ul + p, ol + p, blockquote + p, pre + p {
56
- text-indent: 0; }
72
+ text-indent: 0;
73
+ }
57
74
 
58
75
  a:link, a:visited, a:active {
59
76
  color: #cb0018;
60
- text-decoration: none; }
77
+ text-decoration: none;
78
+ }
61
79
  a:hover {
62
- text-decoration: underline; }
80
+ text-decoration: underline;
81
+ }
63
82
 
64
83
  code {
65
84
  font-family: Monaco, Menlo, Mensch, Consolas, Monotype, mono;
66
- font-style: normal; }
85
+ font-style: normal;
86
+ }
67
87
 
68
88
  pre, blockquote {
69
89
  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; }
90
+ margin-left: 22.5px;
91
+ margin-right: 45px;
92
+ padding: 7.5px 22.5px;
93
+ padding-left: 16.875px;
94
+ white-space: pre;
95
+ }
96
+ pre p, blockquote p {
97
+ margin: 0;
98
+ line-height: 1.35;
99
+ }
78
100
 
79
101
  img {
80
- display: block; }
102
+ display: block;
103
+ }
81
104
 
82
105
  @media screen {
83
106
  body {
84
- font-size: 18px;
85
- line-height: 23.4px;
86
- background-color: #666666; }
87
-
107
+ font-size: 15px;
108
+ line-height: 22.5px;
109
+ background-color: #666;
110
+ color: #333;
111
+ }
88
112
  #container {
89
113
  display: block;
90
- border: solid 1px #999999;
91
- width: 740px;
92
- padding: 60px;
93
- margin: 11.7px auto;
94
- background-color: white;
114
+ border: solid 1px #999;
115
+ width: 780px;
116
+ padding: 40px 60px;
117
+ margin: 11.25px auto;
118
+ background-color: #fff;
95
119
  box-sizing: border-box;
96
120
  -moz-box-sizing: border-box;
97
- -webkit-box-sizing: border-box; }
98
-
121
+ -webkit-box-sizing: border-box;
122
+ }
99
123
  code {
100
- font-size: 15.75px; }
101
-
124
+ font-size: 13.125px;
125
+ }
102
126
  pre {
103
127
  white-space: pre-wrap;
104
128
  white-space: -moz-pre-wrap;
105
129
  white-space: -o-pre-wrap;
106
- word-wrap: break-word; }
107
- pre code {
108
- font-size: 13.5px; } }
130
+ word-wrap: break-word;
131
+ }
132
+ pre code {
133
+ font-size: 11.25px;
134
+ }
135
+ }
109
136
  @media print {
110
137
  @page {
111
138
  margin-left: 1in;
112
139
  margin-right: 1in;
113
140
  margin-top: 1in;
114
- margin-bottom: 1in; }
115
-
141
+ margin-bottom: 1in;
142
+ }
116
143
  body {
117
144
  font-size: 12pt;
118
145
  line-height: 15.6pt;
119
146
  width: auto;
120
147
  margin: 0;
121
- padding: 0; }
122
-
148
+ padding: 0;
149
+ }
123
150
  code {
124
- font-size: 10.5pt; }
125
-
151
+ font-size: 10.5pt;
152
+ }
126
153
  pre code {
127
- font-size: 9pt; }
128
-
154
+ font-size: 9pt;
155
+ }
129
156
  h1, h2, h3, h4, h5, h6, li, blockquote {
130
- page-break-inside: avoid; }
131
-
157
+ page-break-inside: avoid;
158
+ }
132
159
  p {
133
160
  widows: 3;
134
- orphans: 3; } }
161
+ orphans: 3;
162
+ }
163
+ }
135
164
  body {
136
- font-family: Georgia, "Hoefler Text", Garamond, FreeSerif, serif; }
165
+ text-rendering: optimizeLegibility;
166
+ }
137
167
 
138
168
  h1 {
139
- border-bottom: solid 2px #666666; }
169
+ font-size: 25.5px;
170
+ border-bottom: solid 2px #666;
171
+ }
172
+
173
+ h2 {
174
+ font-size: 19.5px;
175
+ }
140
176
 
141
177
  h3 {
142
- font-style: italic; }
178
+ font-size: 18px;
179
+ font-style: italic;
180
+ }
143
181
 
144
182
  h4 {
145
- font-variant: small-caps; }
183
+ font-variant: small-caps;
184
+ }
146
185
 
147
186
  h5, h6 {
148
- font-weight: bold; }
187
+ font-weight: bold;
188
+ }
149
189
 
150
190
  p + p {
151
- text-indent: 23.4px; }
191
+ text-indent: 22.5px;
192
+ }
152
193
 
153
194
  pre, blockquote {
154
- font-size: 18px;
155
- border-left: solid 2px #dddddd; }
195
+ border-left: solid 2px #ddd;
196
+ background-color: #fdffe8;
197
+ }
156
198
 
157
199
  blockquote {
158
- font-style: italic; }
200
+ font-style: italic;
201
+ }
202
+
203
+ code {
204
+ font-family: "Ubuntu Mono";
205
+ }
@@ -0,0 +1,10 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <%= stylesheet_tag %>
5
+ <style type="text/css"><%= inline_styles %></style>
6
+ </head>
7
+ <body>
8
+ <div id="container"><%= content %></div>
9
+ </body>
10
+ </html>
@@ -0,0 +1,237 @@
1
+ @import url('https://fonts.googleapis.com/css2?family=Alegreya:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&display=swap');
2
+
3
+ :root {
4
+ --screen-font-size: 18px;
5
+ --screen-line-height: calc(var(--screen-font-size) * 1.6);
6
+ --screen-unit: var(--screen-line-height);
7
+
8
+ --print-font-size: 11pt;
9
+ --print-line-height: calc(var(--print-font-size) * 1.4);
10
+ --print-unit: var(--print-line-height);
11
+
12
+ --text-color: #1a1a1a;
13
+ --text-subtle: #666666;
14
+ --link-color: #c7254e;
15
+ --background: #ffffff;
16
+ --border-color: #e5e5e5;
17
+ --code-background: #f8f8f8;
18
+ --quote-background: #fafafa;
19
+ }
20
+
21
+ @import "../base/style.css";
22
+
23
+ body {
24
+ font-family: "Alegreya", Georgia, Times, "Times New Roman", serif;
25
+ color: var(--text-color);
26
+ line-height: 1.6;
27
+ background-color: var(--background);
28
+ font-weight: 400;
29
+ font-feature-settings: "liga" 1, "kern" 1, "onum" 1;
30
+ -webkit-font-smoothing: antialiased;
31
+ -moz-osx-font-smoothing: grayscale;
32
+ }
33
+
34
+ h1, h2, h3, h4, h5, h6 {
35
+ font-family: "Alegreya", Georgia, Times, serif;
36
+ font-weight: 600;
37
+ color: var(--text-color);
38
+ margin-top: calc(var(--screen-unit) * 1.5);
39
+ margin-bottom: calc(var(--screen-unit) * 0.5);
40
+ line-height: 1.2;
41
+ letter-spacing: -0.02em;
42
+ text-rendering: optimizeLegibility;
43
+ }
44
+
45
+ h1 {
46
+ font-size: calc(var(--screen-font-size) * 2.5);
47
+ margin-top: 0;
48
+ margin-bottom: calc(var(--screen-unit) * 1);
49
+ font-weight: 700;
50
+ letter-spacing: -0.03em;
51
+ }
52
+
53
+ h2 {
54
+ font-size: calc(var(--screen-font-size) * 1.8);
55
+ margin-top: calc(var(--screen-unit) * 2);
56
+ border-bottom: 1px solid var(--border-color);
57
+ padding-bottom: calc(var(--screen-unit) * 0.25);
58
+ }
59
+
60
+ h3 {
61
+ font-size: calc(var(--screen-font-size) * 1.4);
62
+ font-weight: 600;
63
+ }
64
+
65
+ h4 {
66
+ font-size: calc(var(--screen-font-size) * 1.2);
67
+ font-weight: 600;
68
+ color: var(--text-subtle);
69
+ }
70
+
71
+ h5, h6 {
72
+ font-size: var(--screen-font-size);
73
+ font-weight: 600;
74
+ color: var(--text-subtle);
75
+ text-transform: uppercase;
76
+ letter-spacing: 0.05em;
77
+ font-size: calc(var(--screen-font-size) * 0.9);
78
+ }
79
+
80
+ p {
81
+ margin: calc(var(--screen-unit) * 0.75) 0;
82
+ text-align: justify;
83
+ hyphens: auto;
84
+ text-rendering: optimizeLegibility;
85
+ }
86
+
87
+ p + p {
88
+ margin-top: calc(var(--screen-unit) * 0.25);
89
+ }
90
+
91
+ blockquote {
92
+ margin: calc(var(--screen-unit) * 1) 0;
93
+ padding: calc(var(--screen-unit) * 0.75) calc(var(--screen-unit) * 1.5);
94
+ border-left: 4px solid var(--link-color);
95
+ background-color: var(--quote-background);
96
+ font-style: italic;
97
+ color: var(--text-subtle);
98
+ border-radius: 0 4px 4px 0;
99
+ }
100
+
101
+ blockquote p:first-child {
102
+ margin-top: 0;
103
+ }
104
+
105
+ blockquote p:last-child {
106
+ margin-bottom: 0;
107
+ }
108
+
109
+ code {
110
+ font-family: "SF Mono", "Monaco", "Cascadia Code", "Roboto Mono", monospace;
111
+ font-size: calc(var(--screen-font-size) * 0.85);
112
+ background-color: var(--code-background);
113
+ color: #d14;
114
+ padding: 0.1em 0.3em;
115
+ border-radius: 3px;
116
+ font-weight: 500;
117
+ }
118
+
119
+ pre {
120
+ background-color: var(--code-background);
121
+ border: 1px solid var(--border-color);
122
+ border-radius: 6px;
123
+ padding: calc(var(--screen-unit) * 1);
124
+ overflow-x: auto;
125
+ margin: calc(var(--screen-unit) * 1) 0;
126
+ line-height: 1.4;
127
+ }
128
+
129
+ pre code {
130
+ background-color: transparent;
131
+ color: var(--text-color);
132
+ padding: 0;
133
+ border-radius: 0;
134
+ font-size: calc(var(--screen-font-size) * 0.8);
135
+ }
136
+
137
+ a:link, a:visited {
138
+ color: var(--link-color);
139
+ text-decoration: none;
140
+ border-bottom: 1px solid transparent;
141
+ transition: border-bottom-color 0.15s ease;
142
+ }
143
+
144
+ a:hover {
145
+ border-bottom-color: var(--link-color);
146
+ }
147
+
148
+ strong {
149
+ font-weight: 600;
150
+ color: var(--text-color);
151
+ }
152
+
153
+ em {
154
+ font-style: italic;
155
+ }
156
+
157
+ ul, ol {
158
+ margin: calc(var(--screen-unit) * 0.75) 0;
159
+ padding-left: calc(var(--screen-unit) * 1.5);
160
+ }
161
+
162
+ li {
163
+ margin: calc(var(--screen-unit) * 0.25) 0;
164
+ }
165
+
166
+ table {
167
+ border-collapse: collapse;
168
+ margin: calc(var(--screen-unit) * 1.5) 0;
169
+ width: 100%;
170
+ border: 1px solid var(--border-color);
171
+ border-radius: 6px;
172
+ overflow: hidden;
173
+ }
174
+
175
+ th, td {
176
+ padding: calc(var(--screen-unit) * 0.5) calc(var(--screen-unit) * 0.75);
177
+ text-align: left;
178
+ border-bottom: 1px solid var(--border-color);
179
+ }
180
+
181
+ th {
182
+ background-color: var(--quote-background);
183
+ font-weight: 600;
184
+ color: var(--text-color);
185
+ font-size: calc(var(--screen-font-size) * 0.9);
186
+ }
187
+
188
+ tr:last-child td {
189
+ border-bottom: none;
190
+ }
191
+
192
+ tr:nth-child(even) {
193
+ background-color: rgba(0, 0, 0, 0.02);
194
+ }
195
+
196
+ hr {
197
+ border: none;
198
+ height: 1px;
199
+ background-color: var(--border-color);
200
+ margin: calc(var(--screen-unit) * 2) 0;
201
+ }
202
+
203
+ #container {
204
+ max-width: 100ch;
205
+ width: auto;
206
+ margin: 2rem auto;
207
+ padding: calc(var(--screen-unit) * 3) calc(var(--screen-unit) * 2);
208
+ background-color: var(--background);
209
+ }
210
+
211
+ @media print {
212
+ :root {
213
+ --screen-font-size: var(--print-font-size);
214
+ --screen-line-height: var(--print-line-height);
215
+ --screen-unit: var(--print-unit);
216
+ }
217
+
218
+ #container {
219
+ margin: 0;
220
+ padding: 0;
221
+ max-width: none;
222
+ }
223
+
224
+ h2 {
225
+ border-bottom: none;
226
+ }
227
+
228
+ a:link, a:visited {
229
+ color: var(--text-color);
230
+ border-bottom: none;
231
+ }
232
+
233
+ blockquote, pre {
234
+ background-color: transparent;
235
+ border-color: #ccc;
236
+ }
237
+ }
@@ -0,0 +1,38 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <title><%= (metadata.is_a?(Hash) && metadata['title']) || File.basename(source_file, '.*').tr('_-', ' ').split.map(&:capitalize).join(' ') %></title>
7
+ <%= stylesheet_tag %>
8
+ <style type="text/css"><%= inline_styles %></style>
9
+ </head>
10
+ <body>
11
+ <div class="garden-container">
12
+ <nav class="garden-nav">
13
+ <div class="garden-nav-header">
14
+ <h3>Garden</h3>
15
+ </div>
16
+ <div class="garden-nav-content">
17
+ <% if files.any? %>
18
+ <ul class="garden-toc">
19
+ <% files.each do |file| %>
20
+ <li class="depth-<%= file[:depth] %>">
21
+ <a href="<%= file[:html_path] %>"
22
+ class="<%= file[:source_path] == Pathname.new(source_file).relative_path_from(Pathname.new(root_directory)).to_s ? 'current' : '' %>">
23
+ <%= file[:title] %>
24
+ </a>
25
+ </li>
26
+ <% end %>
27
+ </ul>
28
+ <% end %>
29
+ </div>
30
+ </nav>
31
+ <main class="garden-main">
32
+ <div class="garden-content">
33
+ <%= content %>
34
+ </div>
35
+ </main>
36
+ </div>
37
+ </body>
38
+ </html>