Fixes #736. Change unformatted option default value to match js-beautify
This commit is contained in:
parent
9914fc35ab
commit
99299e5d30
|
@ -941,7 +941,7 @@ Number of line-breaks to be preserved in one chunk (Supported by JS Beautify)
|
||||||
|
|
||||||
**Key**: `unformatted`
|
**Key**: `unformatted`
|
||||||
|
|
||||||
**Default**: `a,sub,sup,b,i,u`
|
**Default**: `a,span,img,bdo,em,strong,dfn,code,samp,kbd,var,cite,abbr,acronym,q,sub,sup,tt,i,b,big,small,u,s,strike,font,ins,del,pre,address,dt,h1,h2,h3,h4,h5,h6`
|
||||||
|
|
||||||
**Type**: `array`
|
**Type**: `array`
|
||||||
|
|
||||||
|
@ -958,11 +958,42 @@ List of tags (defaults to inline) that should not be reformatted (Supported by J
|
||||||
"html": {
|
"html": {
|
||||||
"unformatted": [
|
"unformatted": [
|
||||||
"a",
|
"a",
|
||||||
|
"span",
|
||||||
|
"img",
|
||||||
|
"bdo",
|
||||||
|
"em",
|
||||||
|
"strong",
|
||||||
|
"dfn",
|
||||||
|
"code",
|
||||||
|
"samp",
|
||||||
|
"kbd",
|
||||||
|
"var",
|
||||||
|
"cite",
|
||||||
|
"abbr",
|
||||||
|
"acronym",
|
||||||
|
"q",
|
||||||
"sub",
|
"sub",
|
||||||
"sup",
|
"sup",
|
||||||
"b",
|
"tt",
|
||||||
"i",
|
"i",
|
||||||
"u"
|
"b",
|
||||||
|
"big",
|
||||||
|
"small",
|
||||||
|
"u",
|
||||||
|
"s",
|
||||||
|
"strike",
|
||||||
|
"font",
|
||||||
|
"ins",
|
||||||
|
"del",
|
||||||
|
"pre",
|
||||||
|
"address",
|
||||||
|
"dt",
|
||||||
|
"h1",
|
||||||
|
"h2",
|
||||||
|
"h3",
|
||||||
|
"h4",
|
||||||
|
"h5",
|
||||||
|
"h6"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5093,7 +5124,7 @@ Number of line-breaks to be preserved in one chunk (Supported by JS Beautify)
|
||||||
|
|
||||||
**Key**: `unformatted`
|
**Key**: `unformatted`
|
||||||
|
|
||||||
**Default**: `a,sub,sup,b,i,u`
|
**Default**: `a,span,img,bdo,em,strong,dfn,code,samp,kbd,var,cite,abbr,acronym,q,sub,sup,tt,i,b,big,small,u,s,strike,font,ins,del,pre,address,dt,h1,h2,h3,h4,h5,h6`
|
||||||
|
|
||||||
**Type**: `array`
|
**Type**: `array`
|
||||||
|
|
||||||
|
@ -5110,11 +5141,42 @@ List of tags (defaults to inline) that should not be reformatted (Supported by J
|
||||||
"html": {
|
"html": {
|
||||||
"unformatted": [
|
"unformatted": [
|
||||||
"a",
|
"a",
|
||||||
|
"span",
|
||||||
|
"img",
|
||||||
|
"bdo",
|
||||||
|
"em",
|
||||||
|
"strong",
|
||||||
|
"dfn",
|
||||||
|
"code",
|
||||||
|
"samp",
|
||||||
|
"kbd",
|
||||||
|
"var",
|
||||||
|
"cite",
|
||||||
|
"abbr",
|
||||||
|
"acronym",
|
||||||
|
"q",
|
||||||
"sub",
|
"sub",
|
||||||
"sup",
|
"sup",
|
||||||
"b",
|
"tt",
|
||||||
"i",
|
"i",
|
||||||
"u"
|
"b",
|
||||||
|
"big",
|
||||||
|
"small",
|
||||||
|
"u",
|
||||||
|
"s",
|
||||||
|
"strike",
|
||||||
|
"font",
|
||||||
|
"ins",
|
||||||
|
"del",
|
||||||
|
"pre",
|
||||||
|
"address",
|
||||||
|
"dt",
|
||||||
|
"h1",
|
||||||
|
"h2",
|
||||||
|
"h3",
|
||||||
|
"h4",
|
||||||
|
"h5",
|
||||||
|
"h6"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,13 +6,6 @@
|
||||||
indent_size: 2
|
indent_size: 2
|
||||||
max_preserve_newlines: 1
|
max_preserve_newlines: 1
|
||||||
preserve_newlines: true
|
preserve_newlines: true
|
||||||
unformatted:
|
|
||||||
- "a"
|
|
||||||
- "sub"
|
|
||||||
- "sup"
|
|
||||||
- "b"
|
|
||||||
- "i"
|
|
||||||
- "u"
|
|
||||||
wrap_line_length: 0
|
wrap_line_length: 0
|
||||||
css:
|
css:
|
||||||
indent_char: " "
|
indent_char: " "
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
"indent_size": 6,
|
"indent_size": 6,
|
||||||
"max_preserve_newlines": 1,
|
"max_preserve_newlines": 1,
|
||||||
"preserve_newlines": true,
|
"preserve_newlines": true,
|
||||||
"unformatted": ["a", "sub", "sup", "b", "i", "u"],
|
|
||||||
"wrap_line_length": 0
|
"wrap_line_length": 0
|
||||||
},
|
},
|
||||||
"css": {
|
"css": {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<DOCTYPE "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" PUBLIC html>
|
<DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
|
||||||
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||||
<title>Shopping List for
|
<title>Shopping List for
|
||||||
<%= @date.strftime('%A, %d %B %Y') %></title>
|
<%= @date.strftime('%A, %d %B %Y') %></title>
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en-us" xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<title>Test</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<ul>
|
||||||
|
<li><code>foo:bar</code></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</html>
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE html><html lang="en-us" xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<title>Test</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<ul>
|
||||||
|
<li><code>foo:bar</code></li>
|
||||||
|
</ul>
|
||||||
|
</html>
|
|
@ -4,9 +4,7 @@
|
||||||
|
|
||||||
{{#items}}
|
{{#items}}
|
||||||
{{#first}}
|
{{#first}}
|
||||||
<li>
|
<li><strong>{{name}}</strong></li>
|
||||||
<strong>{{name}}</strong>
|
|
||||||
</li>
|
|
||||||
{{/first}}
|
{{/first}}
|
||||||
{{#link}}
|
{{#link}}
|
||||||
<li><a href="{{url}}">{{name}}</a></li>
|
<li><a href="{{url}}">{{name}}</a></li>
|
||||||
|
|
|
@ -12,8 +12,7 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h1>My Webpage</h1>
|
<h1>My Webpage</h1> {{ a_variable }}
|
||||||
{{ a_variable }}
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
|
@ -3,9 +3,9 @@
|
||||||
<!ENTITY nbsp "<xsl:text disable-output-escaping='yes'>&nbsp;</xsl:text>">
|
<!ENTITY nbsp "<xsl:text disable-output-escaping='yes'>&nbsp;</xsl:text>">
|
||||||
]>
|
]>
|
||||||
|
|
||||||
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
|
||||||
|
|
||||||
<xsl:output doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" encoding="utf-8" indent="yes" method="html"/>
|
<xsl:output method="html" indent="yes" encoding="utf-8" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>
|
||||||
|
|
||||||
<xsl:template match="/">
|
<xsl:template match="/">
|
||||||
<html>
|
<html>
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
"Window": {
|
"Window" : {
|
||||||
exitOnClose: true,
|
exitOnClose: true,
|
||||||
backgroundColor: "#fff",
|
backgroundColor: "#fff",
|
||||||
title: "Kochgut"
|
title: "Kochgut"
|
||||||
}
|
}
|
||||||
|
|
||||||
"Label": {
|
"Label" : {
|
||||||
width: Ti.UI.SIZE,
|
width: Ti.UI.SIZE,
|
||||||
height: Ti.UI.SIZE,
|
height: Ti.UI.SIZE,
|
||||||
color: "#555",
|
color: "#555",
|
||||||
touchEnabled: false
|
touchEnabled: false
|
||||||
}
|
}
|
||||||
|
|
||||||
"Button": {
|
"Button" : {
|
||||||
backgroundColor: "#03a9f4",
|
backgroundColor: "#03a9f4",
|
||||||
color: "#fff",
|
color: "#fff",
|
||||||
borderRadius: 2
|
borderRadius: 2
|
||||||
}
|
}
|
||||||
|
|
||||||
"#menu": {
|
"#menu" : {
|
||||||
backgroundImage: "/images/bg.png"
|
backgroundImage: "/images/bg.png"
|
||||||
}
|
}
|
||||||
|
|
||||||
".button": {
|
".button" : {
|
||||||
backgroundColor: "#03a9f4",
|
backgroundColor: "#03a9f4",
|
||||||
color: "#fff",
|
color: "#fff",
|
||||||
borderRadius: 2,
|
borderRadius: 2,
|
||||||
|
@ -31,13 +31,13 @@
|
||||||
bottom: 16
|
bottom: 16
|
||||||
}
|
}
|
||||||
|
|
||||||
".lbl_button": {
|
".lbl_button" : {
|
||||||
left: 20,
|
left: 20,
|
||||||
right: 20,
|
right: 20,
|
||||||
color: "#fff"
|
color: "#fff"
|
||||||
}
|
}
|
||||||
|
|
||||||
".headline": {
|
".headline" : {
|
||||||
color: "#aaa",
|
color: "#aaa",
|
||||||
left: 16,
|
left: 16,
|
||||||
height: 48,
|
height: 48,
|
||||||
|
@ -46,40 +46,40 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
".grid": {
|
".grid" : {
|
||||||
left: 2,
|
left: 2,
|
||||||
right: 2,
|
right: 2,
|
||||||
layout: "horizontal",
|
layout: "horizontal",
|
||||||
height: Ti.UI.SIZE
|
height: Ti.UI.SIZE
|
||||||
}
|
}
|
||||||
|
|
||||||
".card [platform=tablet]": {
|
".card [platform=tablet]" : {
|
||||||
width: "33%",
|
width: "33%",
|
||||||
height: 150,
|
height: 150,
|
||||||
bottom: 2
|
bottom: 2
|
||||||
}
|
}
|
||||||
|
|
||||||
".card": {
|
".card" : {
|
||||||
width: "50%",
|
width: "50%",
|
||||||
height: 150,
|
height: 150,
|
||||||
bottom: 2
|
bottom: 2
|
||||||
}
|
}
|
||||||
|
|
||||||
".padding": {
|
".padding" : {
|
||||||
right: 2,
|
right: 2,
|
||||||
left: 0,
|
left: 0,
|
||||||
top: 0,
|
top: 0,
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
backgroundImage: "/images/essen.jpg"
|
backgroundImage: "/images/essen.jpg"
|
||||||
}
|
}
|
||||||
".card_overlay": {
|
".card_overlay" : {
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
height: 48
|
height: 48
|
||||||
}
|
}
|
||||||
|
|
||||||
".card_overlay_bg": {
|
".card_overlay_bg" : {
|
||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
|
@ -88,7 +88,7 @@
|
||||||
opacity: 0.3
|
opacity: 0.3
|
||||||
}
|
}
|
||||||
|
|
||||||
".card_lbl": {
|
".card_lbl" : {
|
||||||
color: "#fff",
|
color: "#fff",
|
||||||
left: 16,
|
left: 16,
|
||||||
font: {
|
font: {
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
".container": {
|
".container" : {
|
||||||
backgroundImage: 'images/bgbg-builder.png',
|
backgroundImage: 'images/bgbg-builder.png',
|
||||||
width: 1024,
|
width: 1024,
|
||||||
height: 752,
|
height: 752,
|
||||||
top: 0,
|
top: 0,
|
||||||
left: 0
|
left: 0
|
||||||
},
|
},
|
||||||
"#blackArrow": {
|
"#blackArrow" : {
|
||||||
touchEnabled: false,
|
touchEnabled: false,
|
||||||
backgroundImage: 'images/arrow-builder.png',
|
backgroundImage: 'images/arrow-builder.png',
|
||||||
width: 15,
|
width: 15,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<apex:page standardController="Contact">
|
<apex:page standardController="Contact">
|
||||||
|
|
||||||
<apex:sectionHeader subtitle="{!contact.account.name}" title="{!contact.firstname}"/>
|
<apex:sectionHeader title="{!contact.firstname}" subtitle="{!contact.account.name}"/>
|
||||||
|
|
||||||
</apex:page>
|
</apex:page>
|
|
@ -1,6 +1,6 @@
|
||||||
<apex:page standardController="Contact">
|
<apex:page standardController="Contact">
|
||||||
|
|
||||||
<apex:sectionHeader subtitle="{!contact.account.name}" title="{!contact.firstname}"/>
|
<apex:sectionHeader title="{!contact.firstname}" subtitle="{!contact.account.name}"/>
|
||||||
|
|
||||||
<apex:form >
|
<apex:form >
|
||||||
<apex:pageBlock title="Contact">
|
<apex:pageBlock title="Contact">
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
<apex:inputfield value="{!contact.lastname}"/>
|
<apex:inputfield value="{!contact.lastname}"/>
|
||||||
<apex:inputfield value="{!contact.salutation}"/>
|
<apex:inputfield value="{!contact.salutation}"/>
|
||||||
<apex:inputfield value="{!contact.birthdate}"/>
|
<apex:inputfield value="{!contact.birthdate}"/>
|
||||||
<apex:commandButton action="{!save}" value="Save"/>
|
<apex:commandButton value="Save" action="{!save}"/>
|
||||||
</apex:pageBlockSection>
|
</apex:pageBlockSection>
|
||||||
</apex:pageBlock>
|
</apex:pageBlock>
|
||||||
</apex:form>
|
</apex:form>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<apex:page standardController="Contact">
|
<apex:page standardController="Contact">
|
||||||
|
|
||||||
<apex:sectionHeader subtitle="{!contact.account.name}" title="{!contact.firstname}"/>
|
<apex:sectionHeader title="{!contact.firstname}" subtitle="{!contact.account.name}"/>
|
||||||
|
|
||||||
<apex:pageBlock title="Contact">
|
<apex:pageBlock title="Contact">
|
||||||
<apex:pageBlockSection title="Details">
|
<apex:pageBlockSection title="Details">
|
||||||
|
|
|
@ -84,13 +84,13 @@
|
||||||
"extend": "^3.0.0",
|
"extend": "^3.0.0",
|
||||||
"gherkin": "2.12.2",
|
"gherkin": "2.12.2",
|
||||||
"handlebars": "^4.0.2",
|
"handlebars": "^4.0.2",
|
||||||
"js-beautify": "^1.5.7",
|
"js-beautify": "^1.5.10",
|
||||||
"jscs": "^2.1.1",
|
"jscs": "^2.1.1",
|
||||||
"lodash": "3.10.1",
|
"lodash": "3.10.1",
|
||||||
"loophole": "^1.0.0",
|
"loophole": "^1.0.0",
|
||||||
"node-dir": "^0.1.8",
|
"node-dir": "^0.1.8",
|
||||||
"node-uuid": "^1.4.3",
|
"node-uuid": "^1.4.3",
|
||||||
"prettydiff": "^1.16.5",
|
"prettydiff": "^1.16.8",
|
||||||
"season": "^5.3.0",
|
"season": "^5.3.0",
|
||||||
"space-pen": "^5.1.1",
|
"space-pen": "^5.1.1",
|
||||||
"strip-json-comments": "^1.0.2",
|
"strip-json-comments": "^1.0.2",
|
||||||
|
|
|
@ -156,51 +156,59 @@ describe "BeautifyLanguages", ->
|
||||||
|
|
||||||
beautifyCompleted = false
|
beautifyCompleted = false
|
||||||
completionFun = (text) ->
|
completionFun = (text) ->
|
||||||
expect(text instanceof Error).not.toEqual(true, text)
|
try
|
||||||
return beautifyCompleted = true if text instanceof Error
|
expect(text instanceof Error).not.toEqual(true, text)
|
||||||
# logger.verbose(expectedTestPath, text) if ext is ".less"
|
return beautifyCompleted = true if text instanceof Error
|
||||||
# if text instanceof Error
|
# logger.verbose(expectedTestPath, text) if ext is ".less"
|
||||||
# return beautifyCompleted = text # text == Error
|
# if text instanceof Error
|
||||||
|
# return beautifyCompleted = text # text == Error
|
||||||
|
|
||||||
expect(text).not.toEqual(null, "Language or Beautifier not found")
|
expect(text).not.toEqual(null, "Language or Beautifier not found")
|
||||||
return beautifyCompleted = true if text is null
|
return beautifyCompleted = true if text is null
|
||||||
|
|
||||||
expect(typeof text).toEqual("string", "Text: #{text}")
|
expect(typeof text).toEqual("string", "Text: #{text}")
|
||||||
return beautifyCompleted = true if typeof text isnt "string"
|
return beautifyCompleted = true if typeof text isnt "string"
|
||||||
|
|
||||||
# Replace Newlines
|
# Replace Newlines
|
||||||
text = text.replace(/(?:\r\n|\r|\n)/g, '⏎\n')
|
text = text.replace(/(?:\r\n|\r|\n)/g, '⏎\n')
|
||||||
expectedContents = expectedContents\
|
expectedContents = expectedContents\
|
||||||
.replace(/(?:\r\n|\r|\n)/g, '⏎\n')
|
.replace(/(?:\r\n|\r|\n)/g, '⏎\n')
|
||||||
# Replace tabs
|
# Replace tabs
|
||||||
text = text.replace(/(?:\t)/g, '↹')
|
text = text.replace(/(?:\t)/g, '↹')
|
||||||
expectedContents = expectedContents\
|
expectedContents = expectedContents\
|
||||||
.replace(/(?:\t)/g, '↹')
|
.replace(/(?:\t)/g, '↹')
|
||||||
# Replace spaces
|
# Replace spaces
|
||||||
text = text.replace(/(?:\ )/g, '␣')
|
text = text.replace(/(?:\ )/g, '␣')
|
||||||
expectedContents = expectedContents\
|
expectedContents = expectedContents\
|
||||||
.replace(/(?:\ )/g, '␣')
|
.replace(/(?:\ )/g, '␣')
|
||||||
|
|
||||||
# Check for beautification errors
|
# Check for beautification errors
|
||||||
if text isnt expectedContents
|
if text isnt expectedContents
|
||||||
# console.warn(allOptions, text, expectedContents)
|
# console.warn(allOptions, text, expectedContents)
|
||||||
fileName = expectedTestPath
|
fileName = expectedTestPath
|
||||||
oldStr=text
|
oldStr=text
|
||||||
newStr=expectedContents
|
newStr=expectedContents
|
||||||
oldHeader="beautified"
|
oldHeader="beautified"
|
||||||
newHeader="expected"
|
newHeader="expected"
|
||||||
diff = JsDiff.createPatch(fileName, oldStr, \
|
diff = JsDiff.createPatch(fileName, oldStr, \
|
||||||
newStr, oldHeader, newHeader)
|
newStr, oldHeader, newHeader)
|
||||||
# Get options
|
# Get options
|
||||||
opts = beautifier.getOptionsForLanguage(allOptions, language)
|
opts = beautifier.getOptionsForLanguage(allOptions, language)
|
||||||
# Show error message with debug information
|
selectedBeautifier = beautifier.getBeautifierForLanguage(language)
|
||||||
expect(text).toEqual(expectedContents, \
|
if selectedBeautifier?
|
||||||
"Beautifier output does not match expected \
|
opts = beautifier.transformOptions(selectedBeautifier, language.name, opts)
|
||||||
output:\n#{diff}\n\n\
|
|
||||||
With options:\n\
|
# Show error message with debug information
|
||||||
#{JSON.stringify(opts, undefined, 4)}")
|
expect(text).toEqual(expectedContents, \
|
||||||
# All done!
|
"Beautifier '#{selectedBeautifier?.name}' output does not match expected \
|
||||||
beautifyCompleted = true
|
output:\n#{diff}\n\n\
|
||||||
|
With options:\n\
|
||||||
|
#{JSON.stringify(opts, undefined, 4)}")
|
||||||
|
# All done!
|
||||||
|
beautifyCompleted = true
|
||||||
|
catch e
|
||||||
|
console.error(e)
|
||||||
|
beautifyCompleted = e
|
||||||
|
|
||||||
runs ->
|
runs ->
|
||||||
try
|
try
|
||||||
|
|
|
@ -301,6 +301,16 @@ module.exports = class Beautifiers extends EventEmitter
|
||||||
_.contains(beautifier.languages, language)
|
_.contains(beautifier.languages, language)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
getBeautifierForLanguage : (language) ->
|
||||||
|
beautifiers = @getBeautifiers(language.name)
|
||||||
|
logger.verbose('beautifiers', _.map(beautifiers, 'name'))
|
||||||
|
# Select beautifier from language config preferences
|
||||||
|
preferredBeautifierName = atom.config.get("atom-beautify.language_#{language.namespace}_default_beautifier")
|
||||||
|
beautifier = _.find(beautifiers, (beautifier) ->
|
||||||
|
beautifier.name is preferredBeautifierName
|
||||||
|
) or beautifiers[0]
|
||||||
|
return beautifier
|
||||||
|
|
||||||
getLanguage : (grammar, filePath) ->
|
getLanguage : (grammar, filePath) ->
|
||||||
# Get language
|
# Get language
|
||||||
fileExtension = path.extname(filePath)
|
fileExtension = path.extname(filePath)
|
||||||
|
@ -415,7 +425,6 @@ module.exports = class Beautifiers extends EventEmitter
|
||||||
return resolve( null )
|
return resolve( null )
|
||||||
|
|
||||||
# Get more language config
|
# Get more language config
|
||||||
preferredBeautifierName = atom.config.get("atom-beautify.language_#{language.namespace}_default_beautifier")
|
|
||||||
beautifyOnSave = atom.config.get("atom-beautify.language_#{language.namespace}_beautify_on_save")
|
beautifyOnSave = atom.config.get("atom-beautify.language_#{language.namespace}_beautify_on_save")
|
||||||
legacyBeautifyOnSave = atom.config.get("atom-beautify.beautifyOnSave")
|
legacyBeautifyOnSave = atom.config.get("atom-beautify.beautifyOnSave")
|
||||||
|
|
||||||
|
@ -430,22 +439,17 @@ module.exports = class Beautifiers extends EventEmitter
|
||||||
|
|
||||||
# Get Beautifier
|
# Get Beautifier
|
||||||
logger.verbose(grammar, language)
|
logger.verbose(grammar, language)
|
||||||
beautifiers = @getBeautifiers(language.name)
|
|
||||||
|
|
||||||
logger.verbose("language options: #{JSON.stringify(options, null, 4)}")
|
logger.verbose("language options: #{JSON.stringify(options, null, 4)}")
|
||||||
logger.verbose('beautifiers', _.map(beautifiers, 'name'))
|
|
||||||
|
|
||||||
logger.verbose(language.name, filePath, options, allOptions)
|
logger.verbose(language.name, filePath, options, allOptions)
|
||||||
|
|
||||||
# Check if unsupported language
|
# Check if unsupported language
|
||||||
if beautifiers.length < 1
|
beautifier = @getBeautifierForLanguage(language)
|
||||||
|
if not beautifier?
|
||||||
unsupportedGrammar = true
|
unsupportedGrammar = true
|
||||||
logger.verbose('Beautifier for language not found')
|
logger.verbose('Beautifier for language not found')
|
||||||
else
|
else
|
||||||
# Select beautifier from language config preferences
|
|
||||||
beautifier = _.find(beautifiers, (beautifier) ->
|
|
||||||
beautifier.name is preferredBeautifierName
|
|
||||||
) or beautifiers[0]
|
|
||||||
logger.verbose('beautifier', beautifier.name)
|
logger.verbose('beautifier', beautifier.name)
|
||||||
|
|
||||||
# Apply language-specific option transformations
|
# Apply language-specific option transformations
|
||||||
|
@ -521,7 +525,6 @@ module.exports = class Beautifiers extends EventEmitter
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
findFileResults : {}
|
findFileResults : {}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -344,11 +344,8 @@ debug = () ->
|
||||||
|
|
||||||
# Beautifier
|
# Beautifier
|
||||||
beautifiers = beautifier.getBeautifiers(language.name)
|
beautifiers = beautifier.getBeautifiers(language.name)
|
||||||
preferredBeautifierName = atom.config.get("atom-beautify.language_#{language.namespace}_default_beautifier")
|
|
||||||
addInfo('Supported Beautifiers', _.map(beautifiers, 'name').join(', '))
|
addInfo('Supported Beautifiers', _.map(beautifiers, 'name').join(', '))
|
||||||
selectedBeautifier = _.find(beautifiers, (beautifier) ->
|
selectedBeautifier = beautifier.getBeautifierForLanguage(language)
|
||||||
beautifier.name is preferredBeautifierName
|
|
||||||
) or beautifiers[0]
|
|
||||||
addInfo('Selected Beautifier', selectedBeautifier.name)
|
addInfo('Selected Beautifier', selectedBeautifier.name)
|
||||||
|
|
||||||
# Get current editor's text
|
# Get current editor's text
|
||||||
|
|
|
@ -74,7 +74,9 @@ module.exports = {
|
||||||
description: "Number of line-breaks to be preserved in one chunk"
|
description: "Number of line-breaks to be preserved in one chunk"
|
||||||
unformatted:
|
unformatted:
|
||||||
type: 'array'
|
type: 'array'
|
||||||
default: ['a', 'sub', 'sup', 'b', 'i', 'u']
|
default: ['a', 'span', 'img', 'bdo', 'em', 'strong', 'dfn', 'code', 'samp', 'kbd',
|
||||||
|
'var', 'cite', 'abbr', 'acronym', 'q', 'sub', 'sup', 'tt', 'i', 'b', 'big', 'small', 'u', 's', 'strike',
|
||||||
|
'font', 'ins', 'del', 'pre', 'address', 'dt', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6']
|
||||||
items:
|
items:
|
||||||
type: 'string'
|
type: 'string'
|
||||||
description: "List of tags (defaults to inline) that should not be reformatted"
|
description: "List of tags (defaults to inline) that should not be reformatted"
|
||||||
|
|
Loading…
Reference in New Issue