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
@@ -1,144 +0,0 @@
1
- @import '../reset.css'
2
-
3
- body
4
- font-family: Georgia, serif
5
-
6
- h1, h2
7
- line-height: 1.3
8
-
9
- h2, h3, h4, h5, h6
10
- line-height: $screen_line_height
11
-
12
- h1, h2, h3, h4, h5, h6
13
- font-weight: normal
14
-
15
- h1
16
- font-size: $screen_font_size * 1.5
17
- margin-top: $screen_unit
18
- margin-bottom: $screen_unit
19
-
20
- h2
21
- font-size: $screen_font_size * 1.2
22
- margin-top: $screen_unit
23
- margin-bottom: $screen_unit
24
-
25
- h3
26
- font-size: $screen_font_size * 1.1
27
- margin-top: $screen_unit * 3/2
28
- margin-bottom: $screen_unit * 1/2
29
-
30
- h4
31
- font-size: $screen_font_size * 1.05
32
- margin-top: $screen_unit * 7/4
33
- margin-bottom: $screen_unit * 1/4
34
-
35
- h5, h6
36
- font-size: $screen_font_size * 1
37
- margin-top: $screen_unit * 7/8
38
- margin-bottom: $screen_unit * 1/8
39
-
40
- ul
41
- list-style-type: square
42
-
43
- ul
44
- list-style-type: circle
45
-
46
- ul, ol
47
- margin: ($screen_unit / 4) 0 0 ($screen_unit / 2)
48
- padding-left: $screen_unit * 1.2
49
-
50
- li
51
- p
52
- text-indent: 0 !important
53
-
54
- li+li
55
- margin-top: $screen_unit / 4
56
-
57
- p
58
- margin: ($screen_unit / 2) 0
59
-
60
- ul+p, ol+p, blockquote+p, pre+p
61
- text-indent: 0
62
-
63
- a
64
- &:link, &:visited, &:active
65
- color: $link_color
66
- text-decoration: none
67
- &:hover
68
- text-decoration: underline
69
-
70
- code
71
- font-family: Monaco, Menlo, Mensch, Consolas, Monotype, mono
72
- font-style: normal
73
-
74
- pre, blockquote
75
- display: block
76
- margin-left: $screen_unit
77
- margin-right: $screen_unit * 2
78
- padding: $screen_unit / 3 $screen_unit
79
- padding-left: $screen_unit * 3/4
80
- white-space: pre
81
-
82
- p
83
- margin: 0
84
- line-height: 1.35
85
-
86
- img
87
- display: block
88
-
89
- @media screen
90
- body
91
- font-size: $screen_font_size
92
- line-height: $screen_line_height
93
- background-color: #666
94
-
95
- #container
96
- display: block
97
- border: solid 1px #999
98
- width: 740px
99
- padding: 60px
100
- margin: ($screen_unit / 2) auto
101
- background-color: #fff
102
- box-sizing: border-box
103
- -moz-box-sizing: border-box
104
- -webkit-box-sizing: border-box
105
-
106
- code
107
- font-size: $screen_font_size * 7/8
108
-
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
-
115
- code
116
- font-size: $screen_font_size * 3/4
117
-
118
- @media print
119
- @page
120
- margin-left: 1in
121
- margin-right: 1in
122
- margin-top: 1in
123
- margin-bottom: 1in
124
-
125
- body
126
- font-size: $print_font_size
127
- line-height: $print_line_height
128
- width: auto
129
- margin: 0
130
- padding: 0
131
-
132
- code
133
- font-size: $print_font_size * 7/8
134
-
135
- pre
136
- code
137
- font-size: $print_font_size * 3/4
138
-
139
- h1, h2, h3, h4, h5, h6, li, blockquote
140
- page-break-inside: avoid
141
-
142
- p
143
- widows: 3
144
- orphans: 3
@@ -1,158 +0,0 @@
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; }
@@ -1,8 +0,0 @@
1
- !!!
2
- %html
3
- %head
4
- %link(rel='stylesheet' href=stylesheet)
5
- %style(type="text/css")= inline_styles
6
-
7
- %body
8
- #container= content
@@ -1,36 +0,0 @@
1
- $screen_font_size: 18px
2
- $screen_line_height: $screen_font_size * 1.3
3
- $screen_unit: $screen_line_height
4
-
5
- $print_font_size: 12pt
6
- $print_line_height: $print_font_size * 1.3
7
- $print_unit: $print_line_height
8
-
9
- $link_color: #cb0018
10
-
11
- @import ../base/style
12
-
13
- body
14
- font-family: Georgia, 'Hoefler Text', Garamond, FreeSerif, serif
15
-
16
- h1
17
- border-bottom: solid 2px #666
18
-
19
- h3
20
- font-style: italic
21
-
22
- h4
23
- font-variant: small-caps
24
-
25
- h5, h6
26
- font-weight: bold
27
-
28
- p+p
29
- text-indent: $screen_unit
30
-
31
- pre, blockquote
32
- font-size: $screen_font_size
33
- border-left: solid 2px #ddd
34
-
35
- blockquote
36
- font-style: italic
@@ -1,7 +0,0 @@
1
- !!!
2
- %html
3
- %head
4
- %link{ :rel => 'stylesheet', :href => stylesheet }
5
-
6
- %body
7
- #container= content
@@ -1,20 +0,0 @@
1
- $screen_font_size: 16px
2
- $screen_line_height: $screen_font_size * 1.3
3
- $screen_unit: $screen_line_height
4
-
5
- $print_font_size: 12pt
6
- $print_line_height: $print_font_size * 1.3
7
- $print_unit: $print_line_height
8
-
9
- $link_color: #cb0018
10
-
11
- @import ../base/style
12
-
13
- body
14
- font-family: ScalaSansPro, "Helvetica Neue"
15
-
16
- p+h2, p+h3, p+h4, p+h5, p+h6
17
- margin-top: $screen_unit * 1.5
18
-
19
- p
20
- line-height: 1.25
@@ -1,145 +0,0 @@
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: 18.2px; }
10
-
11
- h1, h2, h3, h4, h5, h6 {
12
- font-weight: normal; }
13
-
14
- h1 {
15
- font-size: 21px;
16
- margin-top: 18.2px;
17
- margin-bottom: 18.2px; }
18
-
19
- h2 {
20
- font-size: 16.8px;
21
- margin-top: 18.2px;
22
- margin-bottom: 18.2px; }
23
-
24
- h3 {
25
- font-size: 15.4px;
26
- margin-top: 27.3px;
27
- margin-bottom: 9.1px; }
28
-
29
- h4 {
30
- font-size: 14.7px;
31
- margin-top: 31.85px;
32
- margin-bottom: 4.55px; }
33
-
34
- h5, h6 {
35
- font-size: 14px;
36
- margin-top: 15.925px;
37
- margin-bottom: 2.275px; }
38
-
39
- ul {
40
- list-style-type: square; }
41
- ul ul {
42
- list-style-type: circle; }
43
-
44
- ul, ol {
45
- margin: 4.55px 0 0 9.1px;
46
- padding-left: 21.84px; }
47
- ul li p, ol li p {
48
- text-indent: 0 !important; }
49
- ul li + li, ol li + li {
50
- margin-top: 4.55px; }
51
-
52
- p {
53
- margin: 9.1px 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: 18.2px;
71
- margin-right: 36.4px;
72
- padding: 6.06667px 18.2px;
73
- padding-left: 13.65px;
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: 14px;
85
- line-height: 18.2px;
86
- background-color: #666666; }
87
-
88
- #container {
89
- display: block;
90
- border: solid 1px #999999;
91
- width: 740px;
92
- padding: 60px;
93
- margin: 9.1px 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: 12.25px; }
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: 10.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: 10pt;
118
- line-height: 13pt;
119
- width: auto;
120
- margin: 0;
121
- padding: 0; }
122
-
123
- code {
124
- font-size: 8.75pt; }
125
-
126
- pre code {
127
- font-size: 7.5pt; }
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: "Helvetica Neue", sans;
137
- color: #444444;
138
- line-height: 1.5; }
139
-
140
- code, pre code {
141
- font-size: 13.125px; }
142
-
143
- #container {
144
- padding-right: 15%;
145
- padding-left: 15%; }
@@ -1,7 +0,0 @@
1
- !!!
2
- %html
3
- %head
4
- %link{ :rel => 'stylesheet', :href => stylesheet }
5
-
6
- %body
7
- #container= content
@@ -1,24 +0,0 @@
1
- $screen_font_size: 14px
2
- $screen_line_height: $screen_font_size * 1.3
3
- $screen_unit: $screen_line_height
4
-
5
- $print_font_size: 10pt
6
-
7
- $print_line_height: $print_font_size * 1.3
8
- $print_unit: $print_line_height
9
-
10
- $link_color: #cb0018
11
-
12
- @import ../base/style
13
-
14
- body
15
- font-family: "Helvetica Neue", sans
16
- color: #444
17
- line-height: 1.5
18
-
19
- code, pre code
20
- font-size: $screen_font_size * 15/16
21
-
22
- #container
23
- padding-right: 15%
24
- padding-left: 15%
@@ -1,21 +0,0 @@
1
- Feature: Change and view stored configuration
2
- As a writer
3
- I want to configure sensible defaults for different project scopes
4
- So that I do not have to repeatedly configure my tool
5
-
6
- Background:
7
- Given a directory named ".mint"
8
- And a file named ".mint/defaults.yaml" with:
9
- """
10
- layout: zen
11
- """
12
-
13
- Scenario: View aggregated configuration
14
- When I run `mint config`
15
- Then the output should contain "layout: zen"
16
-
17
- Scenario: Configure a local default
18
- When I run `mint set layout default`
19
- And I run `mint config`
20
- Then the output should contain "layout: default"
21
- And the output should not contain "layout: zen"
@@ -1,23 +0,0 @@
1
- Feature: Publish ePub document
2
- As a writer
3
- I want to create an ePub document at the command line from plain text
4
- So that I can publish books from style-free text
5
-
6
- Background:
7
- Given a file named "content.md" with:
8
- """
9
- Chapter 1
10
- =========
11
-
12
- This is a test. It is theoretically formatted in
13
- the Markdown templating language.
14
-
15
- Chapter 2
16
- =========
17
-
18
- This is a second chapter.
19
- """
20
-
21
- Scenario: Publish document with defaults
22
- When I run `mint-epub publish content.md`
23
- Then a file named "content.epub" should exist
@@ -1,73 +0,0 @@
1
- Feature: Publish document with varying options at the command line
2
- As a writer
3
- I want to create a document at the command line from plain text
4
- So that I can view a typeset version in a web browser
5
-
6
- Background:
7
- Given a file named "content.md" with:
8
- """
9
- Header
10
- ======
11
-
12
- This is a test. It is theoretically formatted in
13
- the Markdown templating language.
14
- """
15
-
16
- And a file named "style.sass" with:
17
- """
18
- p
19
- margin: 0
20
- """
21
-
22
- And a file named "layout.haml" with:
23
- """
24
- %html
25
- %head
26
- %link(rel='stylesheet' href=stylesheet)
27
-
28
- %body
29
- #container= content
30
- """
31
-
32
- Scenario: Publish document with defaults
33
- When I run `mint publish content.md`
34
- Then a file named "content.md" should exist
35
- And a file named "content.html" should exist
36
-
37
- Scenario Outline: Publish document with named template, layout & style
38
- When I run `mint publish <template> <layout> <style> content.md`
39
- Then a file named "content.html" should exist
40
- And the file "content.html" should contain "This is a test"
41
- And a file named "<style file>" should exist
42
- And the file "content.html" should match /templates.*style.css/
43
- And the file "content.html" should contain "<style file>"
44
-
45
- Examples:
46
- | template | layout | style | style file |
47
- | | | | ../../config/templates/default/css/style.css |
48
- | -t zen | | | ../../config/templates/zen/css/style.css |
49
- | | -l zen | -s zen | ../../config/templates/zen/css/style.css |
50
-
51
- Scenario: Publish document with non-existent template
52
- When I run `mint publish -t nonexistent content.md`
53
- Then the stderr should contain "Template 'nonexistent' does not exist."
54
-
55
- Scenario: Publish document in directory
56
- When I run `mint publish content.md -d compiled`
57
- Then a file named "compiled/content.html" should exist
58
-
59
- Scenario: Publish document in subdirectory
60
- When I run `mint publish content.md -d compiled/chapter-1`
61
- Then a file named "compiled/chapter-1/content.html" should exist
62
-
63
- Scenario: Publish document with default style and explicit style destination
64
- When I run `mint publish content.md -n styles`
65
- Then a file named "styles/style.css" should exist
66
-
67
- Scenario: Publish document with hand-crafted style and explicit style destination
68
- When I run `mint publish content.md -n styles -s style.sass`
69
- Then a file named "styles/style.css" should exist
70
-
71
- Scenario: Publish document with hand-crafted layout
72
- When I run `mint publish content.md -l layout.haml`
73
- Then the file "content.html" should match /id=['"]container['"]/
@@ -1,15 +0,0 @@
1
- require "aruba/cucumber"
2
-
3
- Before do
4
- @aruba_timeout_seconds = 5
5
- @original_path, ENV["PATH"] = ENV["PATH"], "../../bin:#{ENV['PATH']}"
6
- @original_rubylib, ENV["RUBYLIB"] = ENV["RUBYLIB"], "../../lib"
7
- ENV["MINT_NO_PIPE"] = "true"
8
- end
9
-
10
- After do
11
- ENV["PATH"] = @original_path
12
- ENV["RUBYLIB"] = @original_rubylib
13
- ENV["MINT_NO_PIPE"] = nil
14
- FileUtils.rm_rf "tmp/aruba"
15
- end