mint 0.8.1 → 0.10.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 (83) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -26
  3. data/README.md +117 -37
  4. data/bin/mint +2 -81
  5. data/config/templates/base/navigation.css +136 -0
  6. data/config/templates/base/print.css +152 -0
  7. data/config/templates/{reset.css → base/reset.css} +1 -1
  8. data/config/templates/base/style.css +117 -137
  9. data/config/templates/base/utilities.css +136 -0
  10. data/config/templates/base/variables.css +124 -0
  11. data/config/templates/basic/style.css +151 -0
  12. data/config/templates/default/layout.erb +33 -3
  13. data/config/templates/default/style.css +95 -164
  14. data/config/templates/magazine/style.css +383 -0
  15. data/config/templates/nord/style.css +105 -220
  16. data/config/templates/nord-dark/style.css +82 -263
  17. data/lib/mint/commandline/parse.rb +144 -0
  18. data/lib/mint/commandline/publish.rb +46 -0
  19. data/lib/mint/commandline/run.rb +30 -0
  20. data/lib/mint/config.rb +162 -0
  21. data/lib/mint/{css.rb → css_dsl.rb} +9 -9
  22. data/lib/mint/css_parser.rb +45 -25
  23. data/lib/mint/document.rb +250 -365
  24. data/lib/mint/document_tree.rb +163 -0
  25. data/lib/mint/exceptions.rb +2 -3
  26. data/lib/mint/helpers.rb +23 -180
  27. data/lib/mint/layout.rb +26 -9
  28. data/lib/mint/renderers/css_renderer.rb +32 -0
  29. data/lib/mint/renderers/erb_renderer.rb +11 -0
  30. data/lib/mint/renderers/markdown_renderer.rb +45 -0
  31. data/lib/mint/style.rb +21 -31
  32. data/lib/mint/template.rb +30 -0
  33. data/lib/mint/version.rb +1 -1
  34. data/lib/mint/workspace.rb +171 -0
  35. data/lib/mint.rb +44 -12
  36. data/man/mint.1 +85 -44
  37. data/spec/cli/README.md +2 -2
  38. data/spec/cli/argument_parsing_spec.rb +89 -147
  39. data/spec/cli/bin_integration_spec.rb +23 -243
  40. data/spec/cli/full_workflow_integration_spec.rb +99 -442
  41. data/spec/cli/original_style_integration_spec.rb +58 -0
  42. data/spec/cli/publish_workflow_spec.rb +72 -70
  43. data/spec/commandline_path_integration_spec.rb +230 -0
  44. data/spec/config_file_integration_spec.rb +362 -0
  45. data/spec/{css_spec.rb → css_dsl_spec.rb} +7 -3
  46. data/spec/css_parser_spec.rb +59 -1
  47. data/spec/document_spec.rb +37 -242
  48. data/spec/flattened_path_spec.rb +150 -0
  49. data/spec/layout_spec.rb +42 -3
  50. data/spec/mint_spec.rb +22 -217
  51. data/spec/path_handling_spec.rb +237 -0
  52. data/spec/run_cli_tests.rb +1 -1
  53. data/spec/spec_helper.rb +3 -10
  54. data/spec/style_spec.rb +31 -56
  55. data/spec/support/cli_helpers.rb +7 -10
  56. data/spec/support/matchers.rb +1 -1
  57. data/spec/template_spec.rb +31 -0
  58. data/spec/workspace_spec.rb +177 -0
  59. metadata +75 -89
  60. data/bin/mint-epub +0 -20
  61. data/config/templates/garden/layout.erb +0 -38
  62. data/config/templates/garden/style.css +0 -303
  63. data/config/templates/nord/layout.erb +0 -11
  64. data/config/templates/nord-dark/layout.erb +0 -11
  65. data/config/templates/zen/layout.erb +0 -11
  66. data/config/templates/zen/style.css +0 -114
  67. data/lib/mint/command_line.rb +0 -360
  68. data/lib/mint/css_template.rb +0 -37
  69. data/lib/mint/markdown_template.rb +0 -47
  70. data/lib/mint/mint.rb +0 -313
  71. data/lib/mint/plugin.rb +0 -136
  72. data/lib/mint/plugins/epub.rb +0 -293
  73. data/lib/mint/resource.rb +0 -101
  74. data/plugins/templates/epub/layouts/container.haml +0 -5
  75. data/plugins/templates/epub/layouts/content.haml +0 -35
  76. data/plugins/templates/epub/layouts/layout.haml +0 -6
  77. data/plugins/templates/epub/layouts/title.haml +0 -11
  78. data/plugins/templates/epub/layouts/toc.haml +0 -26
  79. data/spec/cli/configuration_management_spec.rb +0 -363
  80. data/spec/cli/template_management_spec.rb +0 -300
  81. data/spec/helpers_spec.rb +0 -249
  82. data/spec/plugin_spec.rb +0 -449
  83. data/spec/resource_spec.rb +0 -135
@@ -0,0 +1,151 @@
1
+ @import url('https://fonts.googleapis.com/css2?family=Crimson+Text:ital,wght@0,400;0,600;0,700;1,400;1,600;1,700&display=swap');
2
+
3
+ /* Import base system */
4
+ @import "../base/style.css";
5
+ @import "../base/navigation.css";
6
+ @import "../base/utilities.css";
7
+
8
+ /* Basic template theme variables */
9
+ :root {
10
+ /* Typography settings - uses golden ratio scaling */
11
+ --base-font-size: 21px;
12
+ --base-line-height: 1.4;
13
+ --scale-ratio: 1.3; /* Golden ratio for more dramatic scale */
14
+
15
+ /* Print settings */
16
+ --print-font-size: 10pt;
17
+ --print-line-height: calc(var(--print-font-size) * 1.618);
18
+
19
+ /* Minimal color palette */
20
+ --color-text: #2c2c2c;
21
+ --color-text-subtle: #666666;
22
+ --color-text-muted: #8a8a8a;
23
+ --color-background: #fcfcfc;
24
+ --color-surface: #fcfcfc;
25
+ --color-surface-subtle: #f8f9fa;
26
+ --color-border: #cccccc;
27
+ --color-accent: #007acc;
28
+ --color-accent-hover: #005fa3;
29
+ --color-accent-subtle: rgba(0, 122, 204, 0.1);
30
+
31
+ /* Component colors - minimal styling */
32
+ --color-code-bg: rgba(0, 0, 0, 0.04);
33
+ --color-code-text: var(--color-text);
34
+ --color-pre-bg: rgba(0, 0, 0, 0.02);
35
+ --color-pre-text: var(--color-text);
36
+ --color-quote-bg: transparent;
37
+ --color-quote-text: var(--color-text-muted);
38
+ --color-quote-border: var(--color-border);
39
+
40
+ /* Navigation colors */
41
+ --color-nav-bg: #f8f9fa;
42
+ --color-nav-text: var(--color-text);
43
+ --color-nav-text-hover: var(--color-text);
44
+ --color-nav-text-active: var(--color-accent);
45
+ --color-nav-bg-hover: #f0f0f0;
46
+ --color-nav-bg-active: #f0f8ff;
47
+ --color-nav-border: var(--color-border);
48
+ --color-nav-border-active: var(--color-accent);
49
+
50
+ /* Table colors - minimal */
51
+ --color-table-bg: var(--color-surface);
52
+ --color-table-header-bg: transparent;
53
+ --color-table-border: var(--color-border);
54
+ --color-table-stripe: transparent;
55
+ --color-table-hover: transparent;
56
+
57
+ /* Layout */
58
+ --container-max-width: 50rem;
59
+ --container-padding: var(--space-lg) var(--space-2xl);
60
+ --navigation-gap: 4rem;
61
+ }
62
+
63
+ /* Typography */
64
+ body {
65
+ font-family: 'Crimson Text', serif;
66
+ font-optical-sizing: auto;
67
+ font-weight: 350;
68
+ font-style: normal;
69
+ background-color: var(--color-background);
70
+ color: var(--color-text);
71
+ text-rendering: optimizeLegibility;
72
+ }
73
+
74
+ h1, h2, h3, h4, h5, h6 {
75
+ font-weight: 300;
76
+ color: var(--color-text);
77
+ }
78
+
79
+ h2 {
80
+ border-bottom: 1px solid var(--color-border);
81
+ padding-bottom: var(--space-xs);
82
+ }
83
+
84
+ /* Enhanced typography with golden ratio spacing */
85
+ p {
86
+ hyphens: auto;
87
+ }
88
+
89
+ /* Container layouts */
90
+ #container {
91
+ max-width: var(--container-max-width);
92
+ margin: 0 auto;
93
+ padding: var(--container-padding);
94
+ }
95
+
96
+ /* Container adjustments when navigation is present */
97
+ body:has(#navigation) #container,
98
+ body.has-navigation #container {
99
+ max-width: var(--container-max-width);
100
+ margin-right: auto;
101
+ margin-top: 0;
102
+ margin-bottom: 0;
103
+ }
104
+
105
+ /* Enhanced code styling */
106
+ code {
107
+ font-family: Monaco, "Roboto Mono", "Ubuntu Mono", Consolas, "Courier New", monospace;
108
+ font-weight: 400;
109
+ line-height: calc(var(--base-line-height) * 1.1);
110
+ }
111
+
112
+ /* Simplified table styling */
113
+ th {
114
+ font-weight: 400;
115
+ font-style: italic;
116
+ border-bottom: 1px solid var(--color-border);
117
+ }
118
+
119
+ td {
120
+ border: none;
121
+ }
122
+
123
+ /* Navigation font size adjustments - more compact but readable */
124
+ #navigation h3 {
125
+ font-size: calc(var(--base-font-size) * 1.1);
126
+ margin-bottom: calc(var(--space-base) * 0.75);
127
+ }
128
+
129
+ #navigation a {
130
+ font-size: calc(var(--base-font-size) * 0.75);
131
+ padding: calc(var(--space-sm) * 0.4) var(--space-sm);
132
+ }
133
+
134
+ #navigation .directory-name {
135
+ font-size: calc(var(--base-font-size) * 0.8);
136
+ padding: calc(var(--space-sm) * 0.4) var(--space-sm);
137
+ }
138
+
139
+ /* Responsive design */
140
+ @media (max-width: 960px) {
141
+ #navigation {
142
+ border-bottom: 1px solid var(--color-border);
143
+ }
144
+
145
+ body:has(#navigation) #container,
146
+ body.has-navigation #container,
147
+ #container {
148
+ max-width: var(--container-max-width);
149
+ padding: var(--space-xl) var(--space-xl);
150
+ }
151
+ }
@@ -1,10 +1,40 @@
1
1
  <!DOCTYPE html>
2
- <html>
2
+ <html lang="en">
3
3
  <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <title><%= title %></title>
4
7
  <%= stylesheet_tag %>
5
- <style type="text/css"><%= inline_styles %></style>
6
8
  </head>
7
9
  <body>
8
- <div id="container"><%= content %></div>
10
+ <% if show_navigation && files&.any? %>
11
+ <nav id="navigation">
12
+ <% if navigation_title %>
13
+ <h3><%= navigation_title %></h3>
14
+ <% end %>
15
+ <ul>
16
+ <% files.each do |item| %>
17
+ <% if item[:is_directory] %>
18
+ <li class="depth-<%= item[:depth] || 0 %> directory">
19
+ <span class="directory-name"><%= item[:title] %></span>
20
+ </li>
21
+ <% else %>
22
+ <li class="depth-<%= item[:depth] || 0 %>">
23
+ <a href="<%= item[:html_path] %>"
24
+ class="<%= item[:source_path] == current_path ? 'current' : '' %>">
25
+ <%= item[:title] %>
26
+ </a>
27
+ </li>
28
+ <% end %>
29
+ <% end %>
30
+ </ul>
31
+ </nav>
32
+ <% end %>
33
+ <main id="container">
34
+ <% if insert_title_heading && title %>
35
+ <h1><%= title %></h1>
36
+ <% end %>
37
+ <%= content %>
38
+ </main>
9
39
  </body>
10
40
  </html>
@@ -1,30 +1,67 @@
1
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
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);
3
+ /* Import base system */
4
+ @import "../base/style.css";
5
+ @import "../base/navigation.css";
6
+ @import "../base/utilities.css";
7
7
 
8
+ /* Default template theme variables */
9
+ :root {
10
+ /* Typography settings for this theme */
11
+ --base-font-size: 21px;
12
+ --base-line-height: 1.4;
13
+ --scale-ratio: 1.25;
14
+
15
+ /* Print settings */
8
16
  --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;
17
+ --print-line-height: 1.4;
18
+
19
+ /* Theme colors */
20
+ --color-text: #1a1a1a;
21
+ --color-text-subtle: #666666;
22
+ --color-text-muted: #8a8a8a;
23
+ --color-background: #ffffff;
24
+ --color-surface: #ffffff;
25
+ --color-surface-subtle: #f8f9fa;
26
+ --color-border: #e5e5e5;
27
+ --color-accent: #c7254e;
28
+ --color-accent-hover: #a91e42;
29
+ --color-accent-subtle: rgba(199, 37, 78, 0.1);
30
+
31
+ /* Component colors */
32
+ --color-code-bg: #f8f8f8;
33
+ --color-code-text: #d14;
34
+ --color-pre-bg: #f8f8f8;
35
+ --color-pre-text: var(--color-text);
36
+ --color-quote-bg: #fafafa;
37
+ --color-quote-text: var(--color-text-subtle);
38
+ --color-quote-border: var(--color-accent);
39
+
40
+ /* Navigation colors */
41
+ --color-nav-bg: #f8f9fa;
42
+ --color-nav-text: var(--color-text-subtle);
43
+ --color-nav-text-hover: var(--color-text);
44
+ --color-nav-text-active: var(--color-accent);
45
+ --color-nav-bg-hover: #f0f0f0;
46
+ --color-nav-bg-active: #fdf2f8;
47
+ --color-nav-border: var(--color-border);
48
+ --color-nav-border-active: var(--color-accent);
49
+
50
+ /* Table colors */
51
+ --color-table-bg: var(--color-surface);
52
+ --color-table-header-bg: #fafafa;
53
+ --color-table-stripe: rgba(0, 0, 0, 0.02);
54
+ --color-table-hover: rgba(0, 0, 0, 0.04);
55
+
56
+ /* Layout */
57
+ --container-max-width: 85ch;
19
58
  }
20
59
 
21
- @import "../base/style.css";
22
-
60
+ /* Typography */
23
61
  body {
24
62
  font-family: "Alegreya", Georgia, Times, "Times New Roman", serif;
25
- color: var(--text-color);
26
- line-height: 1.6;
27
- background-color: var(--background);
63
+ background-color: var(--color-background);
64
+ color: var(--color-text);
28
65
  font-weight: 400;
29
66
  font-feature-settings: "liga" 1, "kern" 1, "onum" 1;
30
67
  -webkit-font-smoothing: antialiased;
@@ -34,70 +71,57 @@ body {
34
71
  h1, h2, h3, h4, h5, h6 {
35
72
  font-family: "Alegreya", Georgia, Times, serif;
36
73
  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;
74
+ color: var(--color-text);
42
75
  text-rendering: optimizeLegibility;
43
76
  }
44
77
 
45
78
  h1 {
46
- font-size: calc(var(--screen-font-size) * 2.5);
47
- margin-top: 0;
48
- margin-bottom: calc(var(--screen-unit) * 1);
49
79
  font-weight: 700;
50
- letter-spacing: -0.03em;
51
80
  }
52
81
 
53
82
  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);
83
+ border-bottom: 1px solid var(--color-border);
84
+ padding-bottom: var(--space-xs);
58
85
  }
59
86
 
60
87
  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);
88
+ font-weight: 400;
69
89
  }
70
90
 
71
91
  h5, h6 {
72
- font-size: var(--screen-font-size);
73
- font-weight: 600;
74
- color: var(--text-subtle);
92
+ color: var(--color-text-subtle);
75
93
  text-transform: uppercase;
76
- letter-spacing: 0.05em;
77
- font-size: calc(var(--screen-font-size) * 0.9);
78
94
  }
79
95
 
96
+ /* Enhanced typography */
80
97
  p {
81
- margin: calc(var(--screen-unit) * 0.75) 0;
82
98
  text-align: justify;
83
99
  hyphens: auto;
84
100
  text-rendering: optimizeLegibility;
85
101
  }
86
102
 
87
103
  p + p {
88
- margin-top: calc(var(--screen-unit) * 0.25);
104
+ margin-top: var(--space-xs);
105
+ }
106
+
107
+ /* Container layouts */
108
+ #container {
109
+ max-width: var(--container-max-width);
110
+ margin: var(--space-xl) auto;
111
+ padding: var(--container-padding);
112
+ background-color: var(--color-background);
89
113
  }
90
114
 
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;
115
+ /* Container adjustments when navigation is present */
116
+ body:has(#navigation) #container,
117
+ body.has-navigation #container {
118
+ max-width: calc(var(--container-max-width) - var(--navigation-width));
119
+ margin-right: auto;
120
+ margin-top: var(--space-xl);
121
+ margin-bottom: var(--space-xl);
99
122
  }
100
123
 
124
+ /* Enhanced blockquotes */
101
125
  blockquote p:first-child {
102
126
  margin-top: 0;
103
127
  }
@@ -106,130 +130,37 @@ blockquote p:last-child {
106
130
  margin-bottom: 0;
107
131
  }
108
132
 
133
+ /* Enhanced code styling */
109
134
  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
135
  font-weight: 500;
117
136
  }
118
137
 
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
138
  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);
139
+ color: var(--color-text);
140
+ font-weight: normal;
151
141
  }
152
142
 
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);
143
+ /* Responsive design */
144
+ @media (max-width: 960px) {
145
+ #navigation {
146
+ border-bottom: 1px solid var(--color-border);
216
147
  }
217
148
 
149
+ body:has(#navigation) #container,
150
+ body.has-navigation #container,
218
151
  #container {
219
- margin: 0;
220
- padding: 0;
221
- max-width: none;
152
+ max-width: var(--container-max-width);
153
+ background-color: transparent;
154
+ margin: var(--space-base) auto;
222
155
  }
223
-
156
+ }
157
+
158
+ /* Print styles - inherits from base/print.css but can add theme-specific overrides */
159
+ @media print {
224
160
  h2 {
225
161
  border-bottom: none;
226
162
  }
227
163
 
228
- a:link, a:visited {
229
- color: var(--text-color);
230
- border-bottom: none;
231
- }
232
-
233
164
  blockquote, pre {
234
165
  background-color: transparent;
235
166
  border-color: #ccc;