mint 0.8.0 → 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 (87) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -26
  3. data/README.md +138 -95
  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 +96 -0
  23. data/lib/mint/document.rb +251 -348
  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 +88 -47
  37. data/spec/cli/README.md +13 -13
  38. data/spec/cli/argument_parsing_spec.rb +103 -131
  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 +207 -0
  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 +78 -93
  60. data/bin/mint-epub +0 -20
  61. data/config/templates/default/css/style.css +0 -205
  62. data/config/templates/garden/layout.erb +0 -38
  63. data/config/templates/garden/style.css +0 -303
  64. data/config/templates/newspaper/layout.erb +0 -16
  65. data/config/templates/nord/layout.erb +0 -11
  66. data/config/templates/nord-dark/layout.erb +0 -11
  67. data/config/templates/protocol/layout.erb +0 -9
  68. data/config/templates/protocol/style.css +0 -25
  69. data/config/templates/zen/layout.erb +0 -11
  70. data/config/templates/zen/style.css +0 -114
  71. data/lib/mint/command_line.rb +0 -360
  72. data/lib/mint/css_template.rb +0 -37
  73. data/lib/mint/markdown_template.rb +0 -47
  74. data/lib/mint/mint.rb +0 -313
  75. data/lib/mint/plugin.rb +0 -136
  76. data/lib/mint/plugins/epub.rb +0 -293
  77. data/lib/mint/resource.rb +0 -101
  78. data/plugins/templates/epub/layouts/container.haml +0 -5
  79. data/plugins/templates/epub/layouts/content.haml +0 -35
  80. data/plugins/templates/epub/layouts/layout.haml +0 -6
  81. data/plugins/templates/epub/layouts/title.haml +0 -11
  82. data/plugins/templates/epub/layouts/toc.haml +0 -26
  83. data/spec/cli/configuration_management_spec.rb +0 -363
  84. data/spec/cli/template_management_spec.rb +0 -300
  85. data/spec/helpers_spec.rb +0 -249
  86. data/spec/plugin_spec.rb +0 -449
  87. data/spec/resource_spec.rb +0 -135
@@ -0,0 +1,152 @@
1
+ /* Print Styles
2
+ * Shared print styles that all templates inherit
3
+ * Templates can override specific aspects while maintaining consistency
4
+ */
5
+
6
+ @media print {
7
+ /* Reset font sizes to print-optimized values */
8
+ :root {
9
+ --base-font-size: var(--print-font-size);
10
+ --base-line-height: var(--print-line-height);
11
+ --base-unit: calc(var(--print-font-size) * var(--print-line-height));
12
+ }
13
+
14
+ /* Force print-friendly colors */
15
+ body {
16
+ background-color: white !important;
17
+ color: #000 !important;
18
+ font-size: var(--print-font-size) !important;
19
+ line-height: var(--print-line-height) !important;
20
+ }
21
+
22
+ /* Hide navigation completely */
23
+ #navigation {
24
+ display: none !important;
25
+ }
26
+
27
+ /* Reset container for print */
28
+ #container,
29
+ body:has(#navigation) #container,
30
+ body.has-navigation #container {
31
+ margin: 0 !important;
32
+ padding: 0 !important;
33
+ max-width: none !important;
34
+ background-color: white !important;
35
+ box-shadow: none !important;
36
+ border: none !important;
37
+ border-radius: 0 !important;
38
+ }
39
+
40
+ /* Page break control */
41
+ h1, h2, h3, h4, h5, h6 {
42
+ page-break-after: avoid;
43
+ page-break-inside: avoid;
44
+ color: #000 !important;
45
+ }
46
+
47
+ /* Keep content together */
48
+ pre, blockquote, img, table, figure {
49
+ page-break-inside: avoid;
50
+ }
51
+
52
+ /* Orphans and widows control */
53
+ p, li, td, th {
54
+ widows: 3;
55
+ orphans: 3;
56
+ }
57
+
58
+ /* Links should be readable in print */
59
+ a {
60
+ color: #000 !important;
61
+ text-decoration: underline !important;
62
+ border-bottom: none !important;
63
+ }
64
+
65
+ /* Show URL after links (optional - can be overridden) */
66
+ a[href^="http"]:after {
67
+ content: " (" attr(href) ")";
68
+ font-size: 0.8em;
69
+ color: #666;
70
+ }
71
+
72
+ /* Code blocks */
73
+ code {
74
+ background-color: #f5f5f5 !important;
75
+ border: 1px solid #ddd !important;
76
+ border-radius: 0 !important;
77
+ color: #000 !important;
78
+ padding: 0.1em 0.3em !important;
79
+ }
80
+
81
+ pre {
82
+ background-color: #f8f8f8 !important;
83
+ border: 1px solid #ddd !important;
84
+ border-radius: 0 !important;
85
+ color: #000 !important;
86
+ white-space: pre-wrap !important;
87
+ word-wrap: break-word !important;
88
+ }
89
+
90
+ pre code {
91
+ background-color: transparent !important;
92
+ border: none !important;
93
+ padding: 0 !important;
94
+ }
95
+
96
+ /* Tables */
97
+ table {
98
+ background-color: white !important;
99
+ border-collapse: collapse !important;
100
+ width: 100% !important;
101
+ }
102
+
103
+ th, td {
104
+ border: 1px solid #000 !important;
105
+ padding: 0.3em 0.5em !important;
106
+ color: #000 !important;
107
+ background-color: transparent !important;
108
+ }
109
+
110
+ th {
111
+ background-color: #f0f0f0 !important;
112
+ font-weight: bold !important;
113
+ }
114
+
115
+ /* Blockquotes */
116
+ blockquote {
117
+ border-left: 3px solid #000 !important;
118
+ background-color: transparent !important;
119
+ color: #333 !important;
120
+ font-style: italic !important;
121
+ margin: 1em 0 !important;
122
+ padding: 0.5em 0 0.5em 1em !important;
123
+ }
124
+
125
+ /* Images */
126
+ img {
127
+ max-width: 100% !important;
128
+ height: auto !important;
129
+ display: block !important;
130
+ margin: 0.5em 0 !important;
131
+ }
132
+
133
+ /* Page margins and size */
134
+ @page {
135
+ margin: var(--print-margin);
136
+ size: letter;
137
+ }
138
+
139
+ /* First page special handling */
140
+ @page :first {
141
+ margin-top: calc(var(--print-margin) * 1.5);
142
+ }
143
+
144
+ /* Footnotes area if needed */
145
+ @page {
146
+ @bottom-right {
147
+ content: counter(page);
148
+ font-size: 0.8em;
149
+ color: #666;
150
+ }
151
+ }
152
+ }
@@ -1,4 +1,4 @@
1
- html, body, div, span, object, iframe,
1
+ html, body, div, span, object, iframe,
2
2
  h1, h2, h3, h4, h5, h6, p, blockquote, pre,
3
3
  abbr, address, cite, code,
4
4
  del, dfn, em, img, ins, kbd, q, samp,
@@ -1,187 +1,167 @@
1
- @import '../reset.css';
1
+ @import './reset.css';
2
+ @import './variables.css';
2
3
 
3
4
  body {
4
- font-family: var(--body-font-family), Georgia, serif;
5
- }
6
-
7
- h1, h2 {
8
- line-height: 1.3;
9
- }
10
-
11
- h2, h3, h4, h5, h6 {
12
- line-height: var(--screen-line-height);
5
+ line-height: var(--base-line-height);
6
+ font-size: var(--base-font-size);
13
7
  }
14
8
 
15
9
  h1, h2, h3, h4, h5, h6 {
16
- font-family: var(--header-font-family);
17
- font-weight: normal;
10
+ margin-top: var(--space-md);
11
+ margin-bottom: var(--space-sm);
12
+ line-height: var(--base-line-height);
18
13
  }
19
14
 
20
15
  h1 {
21
- font-size: calc(var(--screen-font-size) * 1.5);
22
- margin-top: var(--screen-unit);
23
- margin-bottom: var(--screen-unit);
16
+ font-size: var(--font-size-2xl);
17
+ margin-top: 0;
18
+ margin-bottom: var(--space-base);
24
19
  }
25
20
 
26
21
  h2 {
27
- font-size: calc(var(--screen-font-size) * 1.2);
28
- margin-top: calc(var(--screen-unit) * 3 / 2);
29
- margin-bottom: calc(var(--screen-unit) * 1 / 2);
22
+ font-size: var(--font-size-xl);
30
23
  }
31
24
 
32
25
  h3 {
33
- font-size: calc(var(--screen-font-size) * 1.1);
34
- margin-top: calc(var(--screen-unit) * 7 / 4);
35
- margin-bottom: calc(var(--screen-unit) * 1 / 4);
26
+ font-size: var(--font-size-lg);
36
27
  }
37
28
 
38
29
  h4 {
39
- font-size: calc(var(--screen-font-size) * 1.05);
40
- margin-top: calc(var(--screen-unit) * 7 / 8);
41
- margin-bottom: calc(var(--screen-unit) * 1 / 8);
30
+ font-size: var(--font-size-base);
42
31
  }
43
32
 
44
33
  h5, h6 {
45
- font-size: var(--screen-font-size);
46
- margin-top: calc(var(--screen-unit) * 7 / 8);
47
- margin-bottom: calc(var(--screen-unit) * 1 / 8);
48
- }
49
-
50
- ul {
51
- list-style-type: square;
52
- }
53
-
54
- ul ul {
55
- list-style-type: circle;
34
+ font-size: var(--font-size-sm);
56
35
  }
57
36
 
58
37
  ul, ol {
59
- margin: calc(var(--screen-unit) / 4) 0 0 calc(var(--screen-unit) / 2);
60
- padding-left: calc(var(--screen-unit) * 1.2);
38
+ margin: var(--space-base) 0;
39
+ padding-left: var(--space-lg);
61
40
  }
62
41
 
63
- ul li p, ol li p {
64
- text-indent: 0 !important;
42
+ li {
43
+ margin: var(--space-xs) 0;
65
44
  }
66
45
 
67
- ul li + li, ol li + li {
68
- margin-top: calc(var(--screen-unit) / 4);
46
+ ul ul, ol ol, ul ol, ol ul {
47
+ margin: var(--space-xs) 0;
69
48
  }
70
49
 
71
50
  p {
72
- margin: calc(var(--screen-unit) / 2) 0;
73
- }
74
-
75
- ul + p, ol + p, blockquote + p, pre + p {
76
- text-indent: 0;
51
+ margin: var(--space-base) 0;
77
52
  }
78
53
 
79
- a:link, a:visited, a:active {
80
- color: var(--link-color);
54
+ a {
55
+ color: var(--color-accent);
81
56
  text-decoration: none;
57
+ border-bottom: 1px solid transparent;
58
+ transition: var(--transition-fast);
82
59
  }
83
60
 
84
61
  a:hover {
85
- text-decoration: underline;
62
+ color: var(--color-accent-hover);
63
+ border-bottom-color: var(--color-accent-hover);
86
64
  }
87
65
 
88
66
  code {
89
- font-family: Monaco, Menlo, Mensch, Consolas, Monotype, mono;
90
- font-style: normal;
67
+ font-family: 'SF Mono', 'JetBrains Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
68
+ font-size: var(--font-size-xs);
69
+ background-color: var(--color-code-bg);
70
+ color: var(--color-code-text);
71
+ padding: 0.1em 0.3em;
72
+ border-radius: var(--radius-sm);
73
+ border: 1px solid var(--color-code-border);
91
74
  }
92
75
 
93
76
  pre {
94
- display: block;
95
- margin-left: var(--screen-unit);
96
- margin-right: calc(var(--screen-unit) * 2);
97
- padding: calc(var(--screen-unit) / 3) var(--screen-unit);
98
- padding-left: calc(var(--screen-unit) * 3 / 4);
77
+ font-family: 'SF Mono', 'JetBrains Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
78
+ }
79
+
80
+ pre code {
81
+ background-color: transparent;
82
+ border: none;
83
+ padding: 0;
84
+ border-radius: 0;
85
+ font-size: var(--font-size-xs);
86
+ }
87
+
88
+ pre {
89
+ margin: var(--space-base) 0;
90
+ padding: var(--space-base);
91
+ overflow-x: auto;
99
92
  white-space: pre;
93
+ background-color: var(--color-pre-bg);
94
+ color: var(--color-pre-text);
95
+ border: 1px solid var(--color-pre-border);
96
+ border-radius: var(--radius-base);
100
97
  }
101
98
 
102
99
  blockquote {
103
- display: block;
104
- margin-left: var(--screen-unit);
105
- margin-right: calc(var(--screen-unit) * 2);
106
- padding: calc(var(--screen-unit) / 3) var(--screen-unit);
107
- padding-left: calc(var(--screen-unit) * 3 / 4);
100
+ margin: var(--space-base) 0;
101
+ padding: var(--space-sm) var(--space-base);
102
+ margin-left: 0;
103
+ background-color: var(--color-quote-bg);
104
+ color: var(--color-quote-text);
105
+ border-left: 3px solid var(--color-quote-border);
106
+ border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
108
107
  }
109
108
 
110
- pre p, blockquote p {
111
- margin: 0;
112
- line-height: 1.35;
109
+ img {
110
+ max-width: 100%;
111
+ height: auto;
113
112
  }
114
113
 
115
- img {
116
- display: block;
117
- }
118
-
119
- @media screen {
120
- body {
121
- font-size: var(--screen-font-size);
122
- line-height: var(--screen-line-height);
123
- background-color: #666;
124
- color: var(--text-color);
125
- }
126
-
127
- #container {
128
- display: block;
129
- border: solid 1px #999;
130
- width: 780px;
131
- padding: 40px 60px;
132
- margin: calc(var(--screen-unit) / 2) auto;
133
- background-color: #fff;
134
- box-sizing: border-box;
135
- -moz-box-sizing: border-box;
136
- -webkit-box-sizing: border-box;
137
- }
138
-
139
- code {
140
- font-size: calc(var(--screen-font-size) * 7 / 8);
141
- }
142
-
143
- pre {
144
- white-space: pre-wrap;
145
- white-space: -moz-pre-wrap;
146
- white-space: -o-pre-wrap;
147
- word-wrap: break-word;
148
- }
149
-
150
- pre code {
151
- font-size: calc(var(--screen-font-size) * 3 / 4);
152
- }
153
- }
154
-
155
- @media print {
156
- @page {
157
- margin-left: 1in;
158
- margin-right: 1in;
159
- margin-top: 1in;
160
- margin-bottom: 1in;
161
- }
162
-
163
- body {
164
- font-size: var(--print-font-size);
165
- line-height: var(--print-line-height);
166
- width: auto;
167
- margin: 0;
168
- padding: 0;
169
- }
170
-
171
- code {
172
- font-size: calc(var(--print-font-size) * 7 / 8);
173
- }
174
-
175
- pre code {
176
- font-size: calc(var(--print-font-size) * 3 / 4);
177
- }
178
-
179
- h1, h2, h3, h4, h5, h6, li, blockquote {
180
- page-break-inside: avoid;
181
- }
182
-
183
- p {
184
- widows: 3;
185
- orphans: 3;
186
- }
187
- }
114
+ table {
115
+ border-collapse: collapse;
116
+ margin: var(--space-base) 0;
117
+ width: 100%;
118
+ background-color: var(--color-table-bg);
119
+ border: 1px solid var(--color-table-border);
120
+ border-radius: var(--radius-base);
121
+ overflow: hidden;
122
+ }
123
+
124
+ th, td {
125
+ padding: var(--space-sm) var(--space-sm);
126
+ text-align: left;
127
+ border-bottom: 1px solid var(--color-table-border);
128
+ border-left: none;
129
+ border-right: none;
130
+ border-top: none;
131
+ }
132
+
133
+ th {
134
+ background-color: var(--color-table-header-bg);
135
+ color: var(--color-table-header-text);
136
+ font-weight: 500;
137
+ }
138
+
139
+ tr:last-child td {
140
+ border-bottom: none;
141
+ }
142
+
143
+ tr:nth-child(even) {
144
+ background-color: var(--color-table-stripe);
145
+ }
146
+
147
+ tr:hover {
148
+ background-color: var(--color-table-hover);
149
+ }
150
+
151
+ hr {
152
+ margin: var(--space-xl) 0;
153
+ border: none;
154
+ height: 1px;
155
+ background-color: var(--color-border);
156
+ }
157
+
158
+ strong {
159
+ font-weight: bold;
160
+ }
161
+
162
+ em {
163
+ font-style: italic;
164
+ }
165
+
166
+ /* Import print styles - templates can override specific aspects */
167
+ @import './print.css';
@@ -0,0 +1,136 @@
1
+ /* Base Utility Classes & Common Patterns
2
+ * Provides reusable patterns that templates can apply
3
+ */
4
+
5
+ /* Typography Utilities */
6
+ .heading-scale h1 {
7
+ font-size: var(--font-size-2xl);
8
+ margin-top: 0;
9
+ margin-bottom: var(--space-base);
10
+ }
11
+
12
+ .heading-scale h2 {
13
+ font-size: var(--font-size-xl);
14
+ margin-top: var(--space-xl);
15
+ margin-bottom: var(--space-sm);
16
+ }
17
+
18
+ .heading-scale h3 {
19
+ font-size: var(--font-size-lg);
20
+ margin-top: var(--space-lg);
21
+ margin-bottom: var(--space-sm);
22
+ }
23
+
24
+ .heading-scale h4 {
25
+ font-size: var(--font-size-base);
26
+ margin-top: var(--space-base);
27
+ margin-bottom: var(--space-xs);
28
+ }
29
+
30
+ .heading-scale h5,
31
+ .heading-scale h6 {
32
+ font-size: var(--font-size-sm);
33
+ margin-top: var(--space-base);
34
+ margin-bottom: var(--space-xs);
35
+ }
36
+
37
+ /* Navigation Container Utilities */
38
+ .nav-container {
39
+ margin-left: var(--navigation-width);
40
+ padding-left: var(--navigation-gap);
41
+ }
42
+
43
+ .nav-container-mobile {
44
+ margin-left: auto;
45
+ padding-left: var(--container-padding);
46
+ }
47
+
48
+ /* Common Container Patterns */
49
+ .container-default {
50
+ max-width: var(--container-max-width);
51
+ margin: var(--space-xl) auto;
52
+ padding: var(--container-padding);
53
+ }
54
+
55
+ .container-with-nav {
56
+ max-width: calc(var(--container-max-width) - var(--navigation-width));
57
+ margin-right: auto;
58
+ margin-top: var(--space-xl);
59
+ margin-bottom: var(--space-xl);
60
+ padding: var(--container-padding);
61
+ }
62
+
63
+ /* Layout Utilities */
64
+ .flow > * + * {
65
+ margin-top: var(--space-base);
66
+ }
67
+
68
+ .flow-sm > * + * {
69
+ margin-top: var(--space-sm);
70
+ }
71
+
72
+ .flow-lg > * + * {
73
+ margin-top: var(--space-lg);
74
+ }
75
+
76
+ /* Visual Utilities */
77
+ .surface {
78
+ background-color: var(--color-surface);
79
+ border: 1px solid var(--color-border);
80
+ border-radius: var(--radius-base);
81
+ }
82
+
83
+ .surface-subtle {
84
+ background-color: var(--color-surface-subtle);
85
+ }
86
+
87
+ .surface-elevated {
88
+ background-color: var(--color-surface);
89
+ box-shadow: var(--shadow-lg);
90
+ border: 1px solid var(--color-border);
91
+ border-radius: var(--radius-lg);
92
+ }
93
+
94
+ /* Text Utilities */
95
+ .text-subtle {
96
+ color: var(--color-text-subtle);
97
+ }
98
+
99
+ .text-muted {
100
+ color: var(--color-text-muted);
101
+ }
102
+
103
+ .text-accent {
104
+ color: var(--color-accent);
105
+ }
106
+
107
+ /* Responsive Utilities */
108
+ .hide-mobile {
109
+ display: block;
110
+ }
111
+
112
+ .show-mobile {
113
+ display: none;
114
+ }
115
+
116
+ @media (max-width: 960px) {
117
+ .hide-mobile {
118
+ display: none;
119
+ }
120
+
121
+ .show-mobile {
122
+ display: block;
123
+ }
124
+
125
+ /* Reset navigation containers on mobile */
126
+ .nav-container {
127
+ margin-left: auto;
128
+ padding-left: var(--container-padding);
129
+ }
130
+
131
+ .container-with-nav {
132
+ max-width: var(--container-max-width);
133
+ margin: var(--space-base) auto;
134
+ padding: var(--container-padding);
135
+ }
136
+ }