mint 0.7.4 → 0.8.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.
Files changed (70) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +23 -14
  3. data/LICENSE +22 -0
  4. data/README.md +68 -79
  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/layout.erb +10 -0
  9. data/config/templates/default/style.css +237 -0
  10. data/config/templates/garden/layout.erb +38 -0
  11. data/config/templates/garden/style.css +303 -0
  12. data/config/templates/nord/layout.erb +11 -0
  13. data/config/templates/nord/style.css +339 -0
  14. data/config/templates/nord-dark/layout.erb +11 -0
  15. data/config/templates/nord-dark/style.css +339 -0
  16. data/config/templates/zen/layout.erb +11 -0
  17. data/config/templates/zen/style.css +114 -0
  18. data/lib/mint/command_line.rb +253 -111
  19. data/lib/mint/css.rb +11 -4
  20. data/lib/mint/css_parser.rb +76 -0
  21. data/lib/mint/css_template.rb +37 -0
  22. data/lib/mint/document.rb +203 -43
  23. data/lib/mint/helpers.rb +50 -10
  24. data/lib/mint/layout.rb +2 -3
  25. data/lib/mint/markdown_template.rb +47 -0
  26. data/lib/mint/mint.rb +181 -114
  27. data/lib/mint/plugin.rb +3 -3
  28. data/lib/mint/plugins/epub.rb +1 -2
  29. data/lib/mint/resource.rb +19 -9
  30. data/lib/mint/style.rb +10 -14
  31. data/lib/mint/version.rb +1 -1
  32. data/lib/mint.rb +1 -0
  33. data/man/mint.1 +135 -0
  34. data/spec/cli/README.md +99 -0
  35. data/spec/cli/argument_parsing_spec.rb +237 -0
  36. data/spec/cli/bin_integration_spec.rb +348 -0
  37. data/spec/cli/configuration_management_spec.rb +363 -0
  38. data/spec/cli/full_workflow_integration_spec.rb +527 -0
  39. data/spec/cli/publish_workflow_spec.rb +368 -0
  40. data/spec/cli/template_management_spec.rb +300 -0
  41. data/spec/css_parser_spec.rb +149 -0
  42. data/spec/css_spec.rb +1 -1
  43. data/spec/document_spec.rb +102 -69
  44. data/spec/helpers_spec.rb +42 -42
  45. data/spec/mint_spec.rb +104 -80
  46. data/spec/plugin_spec.rb +141 -143
  47. data/spec/run_cli_tests.rb +95 -0
  48. data/spec/spec_helper.rb +8 -1
  49. data/spec/style_spec.rb +18 -16
  50. data/spec/support/cli_helpers.rb +169 -0
  51. data/spec/support/fixtures/content-2.md +16 -0
  52. data/spec/support/matchers.rb +1 -1
  53. metadata +116 -224
  54. data/config/syntax.yaml +0 -71
  55. data/config/templates/base/style.sass +0 -144
  56. data/config/templates/default/css/style.css +0 -158
  57. data/config/templates/default/layout.haml +0 -8
  58. data/config/templates/default/style.sass +0 -36
  59. data/config/templates/protocol/layout.haml +0 -7
  60. data/config/templates/protocol/style.sass +0 -20
  61. data/config/templates/zen/css/style.css +0 -145
  62. data/config/templates/zen/layout.haml +0 -7
  63. data/config/templates/zen/style.sass +0 -24
  64. data/features/config.feature +0 -21
  65. data/features/plugins/epub.feature +0 -23
  66. data/features/publish.feature +0 -73
  67. data/features/support/env.rb +0 -15
  68. data/features/templates.feature +0 -79
  69. data/spec/command_line_spec.rb +0 -87
  70. data/spec/plugins/epub_spec.rb +0 -242
@@ -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>
@@ -0,0 +1,303 @@
1
+ /* Garden Template - Digital Garden with Navigation */
2
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
3
+
4
+ * {
5
+ margin: 0;
6
+ padding: 0;
7
+ box-sizing: border-box;
8
+ }
9
+
10
+ body {
11
+ font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
12
+ line-height: 1.6;
13
+ color: #1a1a1a;
14
+ background-color: #fafafa;
15
+ font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
16
+ -webkit-font-smoothing: antialiased;
17
+ -moz-osx-font-smoothing: grayscale;
18
+ }
19
+
20
+ .garden-container {
21
+ display: flex;
22
+ min-height: 100vh;
23
+ width: 100%;
24
+ background: white;
25
+ }
26
+
27
+ /* Navigation Sidebar */
28
+ .garden-nav {
29
+ width: 280px;
30
+ background: #fafafa;
31
+ border-right: 1px solid #e5e7eb;
32
+ flex-shrink: 0;
33
+ overflow-y: auto;
34
+ max-height: 100vh;
35
+ position: sticky;
36
+ top: 0;
37
+ }
38
+
39
+ .garden-nav-header {
40
+ padding: 1.5rem 1rem 1rem;
41
+ border-bottom: 1px solid #e5e7eb;
42
+ background: white;
43
+ }
44
+
45
+ .garden-nav-header h3 {
46
+ font-size: 1.1rem;
47
+ font-weight: 600;
48
+ color: #374151;
49
+ letter-spacing: -0.025em;
50
+ }
51
+
52
+ .garden-nav-content {
53
+ padding: 1rem 0;
54
+ }
55
+
56
+ .garden-toc {
57
+ list-style: none;
58
+ padding: 0;
59
+ }
60
+
61
+ .garden-toc li {
62
+ margin: 0;
63
+ }
64
+
65
+ .garden-toc a {
66
+ display: block;
67
+ padding: 0.5rem 1rem;
68
+ color: #6b7280;
69
+ text-decoration: none;
70
+ border-left: 3px solid transparent;
71
+ transition: all 0.15s ease;
72
+ font-size: 0.875rem;
73
+ font-weight: 400;
74
+ }
75
+
76
+ .garden-toc a:hover {
77
+ color: #374151;
78
+ background-color: #f3f4f6;
79
+ border-left-color: #d1d5db;
80
+ }
81
+
82
+ .garden-toc a.current {
83
+ color: #2563eb;
84
+ background-color: #eff6ff;
85
+ border-left-color: #2563eb;
86
+ font-weight: 500;
87
+ }
88
+
89
+ /* Depth-based indentation */
90
+ .garden-toc .depth-0 a {
91
+ padding-left: 1rem;
92
+ font-weight: 500;
93
+ }
94
+
95
+ .garden-toc .depth-1 a {
96
+ padding-left: 1.75rem;
97
+ font-size: 0.8125rem;
98
+ }
99
+
100
+ .garden-toc .depth-2 a {
101
+ padding-left: 2.5rem;
102
+ font-size: 0.75rem;
103
+ }
104
+
105
+ .garden-toc .depth-3 a {
106
+ padding-left: 3.25rem;
107
+ font-size: 0.75rem;
108
+ }
109
+
110
+ /* Main Content Area */
111
+ .garden-main {
112
+ flex: 1;
113
+ overflow-y: auto;
114
+ max-height: 100vh;
115
+ }
116
+
117
+ .garden-content {
118
+ padding: 2rem 3rem;
119
+ max-width: none;
120
+ }
121
+
122
+ /* Typography */
123
+ .garden-content h1 {
124
+ font-size: 2rem;
125
+ font-weight: 700;
126
+ margin-bottom: 1.5rem;
127
+ color: #111827;
128
+ line-height: 1.2;
129
+ letter-spacing: -0.025em;
130
+ }
131
+
132
+ .garden-content h2 {
133
+ font-size: 1.5rem;
134
+ font-weight: 600;
135
+ margin: 2rem 0 1rem;
136
+ color: #1f2937;
137
+ border-bottom: 1px solid #e5e7eb;
138
+ padding-bottom: 0.5rem;
139
+ letter-spacing: -0.025em;
140
+ }
141
+
142
+ .garden-content h3 {
143
+ font-size: 1.25rem;
144
+ font-weight: 600;
145
+ margin: 1.5rem 0 0.75rem;
146
+ color: #374151;
147
+ letter-spacing: -0.025em;
148
+ }
149
+
150
+ .garden-content h4 {
151
+ font-size: 1.125rem;
152
+ font-weight: 600;
153
+ margin: 1.25rem 0 0.5rem;
154
+ color: #4b5563;
155
+ letter-spacing: -0.025em;
156
+ }
157
+
158
+ .garden-content p {
159
+ margin-bottom: 1.25rem;
160
+ color: #374151;
161
+ line-height: 1.7;
162
+ }
163
+
164
+ .garden-content a {
165
+ color: #2563eb;
166
+ text-decoration: none;
167
+ border-bottom: 1px solid transparent;
168
+ transition: border-bottom 0.15s ease;
169
+ }
170
+
171
+ .garden-content a:hover {
172
+ border-bottom-color: #2563eb;
173
+ }
174
+
175
+ /* Lists */
176
+ .garden-content ul,
177
+ .garden-content ol {
178
+ margin: 1rem 0;
179
+ padding-left: 1.75rem;
180
+ }
181
+
182
+ .garden-content li {
183
+ margin: 0.375rem 0;
184
+ color: #374151;
185
+ line-height: 1.6;
186
+ }
187
+
188
+ /* Code */
189
+ .garden-content code {
190
+ background: #f3f4f6;
191
+ padding: 0.125rem 0.375rem;
192
+ border-radius: 4px;
193
+ font-family: 'SF Mono', 'Fira Code', 'Monaco', 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
194
+ font-size: 0.875em;
195
+ color: #dc2626;
196
+ font-weight: 500;
197
+ }
198
+
199
+ .garden-content pre {
200
+ background: #f9fafb;
201
+ padding: 1.5rem;
202
+ border-radius: 8px;
203
+ overflow-x: auto;
204
+ margin: 1.5rem 0;
205
+ border: 1px solid #e5e7eb;
206
+ border-left: 4px solid #2563eb;
207
+ }
208
+
209
+ .garden-content pre code {
210
+ background: none;
211
+ padding: 0;
212
+ color: #374151;
213
+ font-weight: 400;
214
+ }
215
+
216
+ /* Tables */
217
+ .garden-content table {
218
+ width: 100%;
219
+ border-collapse: collapse;
220
+ margin: 1.5rem 0;
221
+ border-radius: 6px;
222
+ overflow: hidden;
223
+ border: 1px solid #e5e7eb;
224
+ }
225
+
226
+ .garden-content th,
227
+ .garden-content td {
228
+ padding: 0.75rem 1rem;
229
+ text-align: left;
230
+ border-bottom: 1px solid #e5e7eb;
231
+ }
232
+
233
+ .garden-content th {
234
+ background: #f9fafb;
235
+ font-weight: 600;
236
+ color: #374151;
237
+ font-size: 0.875rem;
238
+ }
239
+
240
+ /* Blockquotes */
241
+ .garden-content blockquote {
242
+ margin: 1.5rem 0;
243
+ padding: 1rem 1.5rem;
244
+ background: #f9fafb;
245
+ border-left: 4px solid #6b7280;
246
+ border-radius: 0 6px 6px 0;
247
+ }
248
+
249
+ .garden-content blockquote p {
250
+ margin: 0;
251
+ color: #4b5563;
252
+ font-style: italic;
253
+ line-height: 1.6;
254
+ }
255
+
256
+ /* Responsive Design */
257
+ @media (max-width: 768px) {
258
+ .garden-container {
259
+ flex-direction: column;
260
+ }
261
+
262
+ .garden-nav {
263
+ width: 100%;
264
+ position: static;
265
+ max-height: none;
266
+ order: 2;
267
+ }
268
+
269
+ .garden-main {
270
+ order: 1;
271
+ max-height: none;
272
+ }
273
+
274
+ .garden-content {
275
+ padding: 1.5rem;
276
+ }
277
+
278
+ .garden-content h1 {
279
+ font-size: 1.75rem;
280
+ }
281
+
282
+ .garden-content h2 {
283
+ font-size: 1.375rem;
284
+ }
285
+ }
286
+
287
+ @media (max-width: 480px) {
288
+ .garden-content {
289
+ padding: 1rem;
290
+ }
291
+
292
+ .garden-content h1 {
293
+ font-size: 1.5rem;
294
+ }
295
+
296
+ .garden-content h2 {
297
+ font-size: 1.25rem;
298
+ }
299
+
300
+ .garden-nav-content {
301
+ padding: 0.5rem 0;
302
+ }
303
+ }
@@ -0,0 +1,11 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <%= stylesheet_tag %>
7
+ </head>
8
+ <body>
9
+ <main id="container"><%= content %></main>
10
+ </body>
11
+ </html>