coffeehaml 0.7.6 → 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.
- package/README.md +5 -1
- package/dist/ast.js +43 -1
- package/dist/cli.js +0 -0
- package/dist/emitter.js +59 -3
- package/dist/expressions.js +152 -21
- package/dist/lexer.js +123 -4
- package/dist/parser.js +27 -2
- package/dist/prettier/options.js +2 -2
- package/dist/prettier/printer.js +86 -39
- package/docs/grammar.md +66 -0
- package/package.json +3 -3
- package/dist/coffeescript-formatter.js +0 -309
- package/dist/options.js +0 -232
- package/dist/printer.js +0 -583
package/dist/options.js
DELETED
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
// Generated by CoffeeScript 2.7.0
|
|
2
|
-
// options.coffee — CoffeeHaml Prettier formatting options
|
|
3
|
-
export var CAT = {
|
|
4
|
-
STRUCTURE: 'CoffeeHaml: Structure',
|
|
5
|
-
ATTRIBUTES: 'CoffeeHaml: Attributes',
|
|
6
|
-
COFFEESCRIPT: 'CoffeeHaml: CoffeeScript',
|
|
7
|
-
WHITESPACE: 'CoffeeHaml: Whitespace',
|
|
8
|
-
CONTROL_FLOW: 'CoffeeHaml: Control Flow',
|
|
9
|
-
COMMENTS: 'CoffeeHaml: Comments'
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export var options = {
|
|
13
|
-
tagCase: {
|
|
14
|
-
category: CAT.STRUCTURE,
|
|
15
|
-
type: 'choice',
|
|
16
|
-
description: 'Normalize HTML tag casing. Component tags (%MyComponent) never affected.',
|
|
17
|
-
choices: [
|
|
18
|
-
{
|
|
19
|
-
value: 'preserve',
|
|
20
|
-
description: 'Leave tag case as written'
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
value: 'lowercase',
|
|
24
|
-
description: '%DIV to %div (HTML tags only)'
|
|
25
|
-
}
|
|
26
|
-
]
|
|
27
|
-
},
|
|
28
|
-
implicitDivExpansion: {
|
|
29
|
-
category: CAT.STRUCTURE,
|
|
30
|
-
type: 'boolean',
|
|
31
|
-
description: 'Expand .class to %div.class (anti-idiomatic in HAML).'
|
|
32
|
-
},
|
|
33
|
-
maxChainLength: {
|
|
34
|
-
category: CAT.STRUCTURE,
|
|
35
|
-
type: 'int',
|
|
36
|
-
description: 'Max .class chain length before breaking into indented hierarchy. 0 = always break.'
|
|
37
|
-
},
|
|
38
|
-
inlineThreshold: {
|
|
39
|
-
category: CAT.STRUCTURE,
|
|
40
|
-
type: 'int',
|
|
41
|
-
description: 'Try single-line if estimated width <= this. -1 = never inline children.'
|
|
42
|
-
},
|
|
43
|
-
voidElementStyle: {
|
|
44
|
-
category: CAT.STRUCTURE,
|
|
45
|
-
type: 'choice',
|
|
46
|
-
description: 'How void elements (%br, %img, etc.) are formatted.',
|
|
47
|
-
choices: [
|
|
48
|
-
{
|
|
49
|
-
value: 'self-closing',
|
|
50
|
-
description: 'Self-closing (no children)'
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
value: 'explicit',
|
|
54
|
-
description: 'Preserve %br/ syntax, otherwise self-close'
|
|
55
|
-
}
|
|
56
|
-
]
|
|
57
|
-
},
|
|
58
|
-
attributeStyle: {
|
|
59
|
-
category: CAT.ATTRIBUTES,
|
|
60
|
-
type: 'choice',
|
|
61
|
-
description: 'Enforce attribute syntax: {braces}, (parens), bare, or preserve.',
|
|
62
|
-
choices: [
|
|
63
|
-
{
|
|
64
|
-
value: 'preserve',
|
|
65
|
-
description: 'Keep as written'
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
value: 'braces',
|
|
69
|
-
description: 'Convert to {CoffeeScript} style'
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
value: 'parens',
|
|
73
|
-
description: 'Convert to HTML (parens) style'
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
value: 'bare',
|
|
77
|
-
description: 'Convert to bare HAML style'
|
|
78
|
-
}
|
|
79
|
-
]
|
|
80
|
-
},
|
|
81
|
-
attributeMultilineThreshold: {
|
|
82
|
-
category: CAT.ATTRIBUTES,
|
|
83
|
-
type: 'int',
|
|
84
|
-
description: 'Break attributes across lines when count >= this. 0 = always multiline.'
|
|
85
|
-
},
|
|
86
|
-
attributeSort: {
|
|
87
|
-
category: CAT.ATTRIBUTES,
|
|
88
|
-
type: 'choice',
|
|
89
|
-
description: 'Sort attribute keys (spread attributes always last).',
|
|
90
|
-
choices: [
|
|
91
|
-
{
|
|
92
|
-
value: 'none',
|
|
93
|
-
description: 'Preserve author order'
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
value: 'alphabetical',
|
|
97
|
-
description: 'Sort A to Z'
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
value: 'idiomatic',
|
|
101
|
-
description: 'id first, class second, rest A to Z'
|
|
102
|
-
}
|
|
103
|
-
]
|
|
104
|
-
},
|
|
105
|
-
quoteStyle: {
|
|
106
|
-
category: CAT.ATTRIBUTES,
|
|
107
|
-
type: 'choice',
|
|
108
|
-
description: 'Quote style for bare/HAML attributes.',
|
|
109
|
-
choices: [
|
|
110
|
-
{
|
|
111
|
-
value: 'preserve',
|
|
112
|
-
description: 'Keep as written'
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
value: 'double',
|
|
116
|
-
description: 'Force double quotes'
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
value: 'single',
|
|
120
|
-
description: 'Force single quotes'
|
|
121
|
-
}
|
|
122
|
-
]
|
|
123
|
-
},
|
|
124
|
-
coffeeScriptFormat: {
|
|
125
|
-
category: CAT.COFFEESCRIPT,
|
|
126
|
-
type: 'boolean',
|
|
127
|
-
description: 'Format CoffeeScript expressions using prettier/plugins/coffeescript.'
|
|
128
|
-
},
|
|
129
|
-
methodChainAlign: {
|
|
130
|
-
category: CAT.COFFEESCRIPT,
|
|
131
|
-
type: 'boolean',
|
|
132
|
-
description: 'Align .method chains on newlines for = expressions.'
|
|
133
|
-
},
|
|
134
|
-
blankLineHandling: {
|
|
135
|
-
category: CAT.WHITESPACE,
|
|
136
|
-
type: 'choice',
|
|
137
|
-
description: 'How blank lines between sibling elements are treated.',
|
|
138
|
-
choices: [
|
|
139
|
-
{
|
|
140
|
-
value: 'preserve',
|
|
141
|
-
description: 'Keep single; collapse multiples'
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
value: 'collapse',
|
|
145
|
-
description: 'Remove all blank lines between siblings'
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
value: 'respect',
|
|
149
|
-
description: 'Keep exactly as written'
|
|
150
|
-
}
|
|
151
|
-
]
|
|
152
|
-
},
|
|
153
|
-
trailingWhitespace: {
|
|
154
|
-
category: CAT.WHITESPACE,
|
|
155
|
-
type: 'choice',
|
|
156
|
-
description: 'Handle trailing whitespace.',
|
|
157
|
-
choices: [
|
|
158
|
-
{
|
|
159
|
-
value: 'remove',
|
|
160
|
-
description: 'Strip trailing whitespace'
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
value: 'preserve',
|
|
164
|
-
description: 'Leave as written'
|
|
165
|
-
}
|
|
166
|
-
]
|
|
167
|
-
},
|
|
168
|
-
continuationStyle: {
|
|
169
|
-
category: CAT.CONTROL_FLOW,
|
|
170
|
-
type: 'choice',
|
|
171
|
-
description: 'How \\ continuations are formatted.',
|
|
172
|
-
choices: [
|
|
173
|
-
{
|
|
174
|
-
value: 'preserve',
|
|
175
|
-
description: 'Keep as written'
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
value: 'indent',
|
|
179
|
-
description: 'Always use indented continuation'
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
value: 'backslash',
|
|
183
|
-
description: 'Always use \\ continuation'
|
|
184
|
-
}
|
|
185
|
-
]
|
|
186
|
-
},
|
|
187
|
-
controlFlowInline: {
|
|
188
|
-
category: CAT.CONTROL_FLOW,
|
|
189
|
-
type: 'boolean',
|
|
190
|
-
description: 'Allow - if x then .ok one-liners (anti-Prettier by default).'
|
|
191
|
-
},
|
|
192
|
-
statementMerging: {
|
|
193
|
-
category: CAT.CONTROL_FLOW,
|
|
194
|
-
type: 'choice',
|
|
195
|
-
description: 'Merge consecutive - lines into a single indented block. Only childless statements.',
|
|
196
|
-
choices: [
|
|
197
|
-
{
|
|
198
|
-
value: 'preserve',
|
|
199
|
-
description: 'Keep each - line separate'
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
value: 'merge',
|
|
203
|
-
description: 'Merge consecutive childless statements into one indented block'
|
|
204
|
-
}
|
|
205
|
-
]
|
|
206
|
-
},
|
|
207
|
-
commentFormat: {
|
|
208
|
-
category: CAT.COMMENTS,
|
|
209
|
-
type: 'boolean',
|
|
210
|
-
description: 'Reflow/word-wrap comment text (experimental).'
|
|
211
|
-
}
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
export var defaultOptions = {
|
|
215
|
-
tagCase: 'preserve',
|
|
216
|
-
implicitDivExpansion: false,
|
|
217
|
-
maxChainLength: 4,
|
|
218
|
-
inlineThreshold: -1,
|
|
219
|
-
voidElementStyle: 'self-closing',
|
|
220
|
-
attributeStyle: 'preserve',
|
|
221
|
-
attributeMultilineThreshold: 1,
|
|
222
|
-
attributeSort: 'none',
|
|
223
|
-
quoteStyle: 'preserve',
|
|
224
|
-
coffeeScriptFormat: true,
|
|
225
|
-
methodChainAlign: true,
|
|
226
|
-
blankLineHandling: 'preserve',
|
|
227
|
-
trailingWhitespace: 'remove',
|
|
228
|
-
continuationStyle: 'indent',
|
|
229
|
-
controlFlowInline: false,
|
|
230
|
-
statementMerging: 'preserve',
|
|
231
|
-
commentFormat: false
|
|
232
|
-
};
|