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`
|
||||
|
||||
**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`
|
||||
|
||||
|
@ -958,11 +958,42 @@ List of tags (defaults to inline) that should not be reformatted (Supported by J
|
|||
"html": {
|
||||
"unformatted": [
|
||||
"a",
|
||||
"span",
|
||||
"img",
|
||||
"bdo",
|
||||
"em",
|
||||
"strong",
|
||||
"dfn",
|
||||
"code",
|
||||
"samp",
|
||||
"kbd",
|
||||
"var",
|
||||
"cite",
|
||||
"abbr",
|
||||
"acronym",
|
||||
"q",
|
||||
"sub",
|
||||
"sup",
|
||||
"b",
|
||||
"tt",
|
||||
"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`
|
||||
|
||||
**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`
|
||||
|
||||
|
@ -5110,11 +5141,42 @@ List of tags (defaults to inline) that should not be reformatted (Supported by J
|
|||
"html": {
|
||||
"unformatted": [
|
||||
"a",
|
||||
"span",
|
||||
"img",
|
||||
"bdo",
|
||||
"em",
|
||||
"strong",
|
||||
"dfn",
|
||||
"code",
|
||||
"samp",
|
||||
"kbd",
|
||||
"var",
|
||||
"cite",
|
||||
"abbr",
|
||||
"acronym",
|
||||
"q",
|
||||
"sub",
|
||||
"sup",
|
||||
"b",
|
||||
"tt",
|
||||
"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
|
||||
max_preserve_newlines: 1
|
||||
preserve_newlines: true
|
||||
unformatted:
|
||||
- "a"
|
||||
- "sub"
|
||||
- "sup"
|
||||
- "b"
|
||||
- "i"
|
||||
- "u"
|
||||
wrap_line_length: 0
|
||||
css:
|
||||
indent_char: " "
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
"indent_size": 6,
|
||||
"max_preserve_newlines": 1,
|
||||
"preserve_newlines": true,
|
||||
"unformatted": ["a", "sub", "sup", "b", "i", "u"],
|
||||
"wrap_line_length": 0
|
||||
},
|
||||
"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>
|
||||
<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
|
||||
<%= @date.strftime('%A, %d %B %Y') %></title>
|
||||
</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}}
|
||||
{{#first}}
|
||||
<li>
|
||||
<strong>{{name}}</strong>
|
||||
</li>
|
||||
<li><strong>{{name}}</strong></li>
|
||||
{{/first}}
|
||||
{{#link}}
|
||||
<li><a href="{{url}}">{{name}}</a></li>
|
||||
|
|
|
@ -12,8 +12,7 @@
|
|||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<h1>My Webpage</h1>
|
||||
{{ a_variable }}
|
||||
<h1>My Webpage</h1> {{ a_variable }}
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -3,9 +3,9 @@
|
|||
<!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="/">
|
||||
<html>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<apex:page standardController="Contact">
|
||||
|
||||
<apex:sectionHeader subtitle="{!contact.account.name}" title="{!contact.firstname}"/>
|
||||
<apex:sectionHeader title="{!contact.firstname}" subtitle="{!contact.account.name}"/>
|
||||
|
||||
</apex:page>
|
|
@ -1,6 +1,6 @@
|
|||
<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:pageBlock title="Contact">
|
||||
|
@ -9,7 +9,7 @@
|
|||
<apex:inputfield value="{!contact.lastname}"/>
|
||||
<apex:inputfield value="{!contact.salutation}"/>
|
||||
<apex:inputfield value="{!contact.birthdate}"/>
|
||||
<apex:commandButton action="{!save}" value="Save"/>
|
||||
<apex:commandButton value="Save" action="{!save}"/>
|
||||
</apex:pageBlockSection>
|
||||
</apex:pageBlock>
|
||||
</apex:form>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<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:pageBlockSection title="Details">
|
||||
|
|
|
@ -84,13 +84,13 @@
|
|||
"extend": "^3.0.0",
|
||||
"gherkin": "2.12.2",
|
||||
"handlebars": "^4.0.2",
|
||||
"js-beautify": "^1.5.7",
|
||||
"js-beautify": "^1.5.10",
|
||||
"jscs": "^2.1.1",
|
||||
"lodash": "3.10.1",
|
||||
"loophole": "^1.0.0",
|
||||
"node-dir": "^0.1.8",
|
||||
"node-uuid": "^1.4.3",
|
||||
"prettydiff": "^1.16.5",
|
||||
"prettydiff": "^1.16.8",
|
||||
"season": "^5.3.0",
|
||||
"space-pen": "^5.1.1",
|
||||
"strip-json-comments": "^1.0.2",
|
||||
|
|
|
@ -156,6 +156,7 @@ describe "BeautifyLanguages", ->
|
|||
|
||||
beautifyCompleted = false
|
||||
completionFun = (text) ->
|
||||
try
|
||||
expect(text instanceof Error).not.toEqual(true, text)
|
||||
return beautifyCompleted = true if text instanceof Error
|
||||
# logger.verbose(expectedTestPath, text) if ext is ".less"
|
||||
|
@ -193,14 +194,21 @@ describe "BeautifyLanguages", ->
|
|||
newStr, oldHeader, newHeader)
|
||||
# Get options
|
||||
opts = beautifier.getOptionsForLanguage(allOptions, language)
|
||||
selectedBeautifier = beautifier.getBeautifierForLanguage(language)
|
||||
if selectedBeautifier?
|
||||
opts = beautifier.transformOptions(selectedBeautifier, language.name, opts)
|
||||
|
||||
# Show error message with debug information
|
||||
expect(text).toEqual(expectedContents, \
|
||||
"Beautifier output does not match expected \
|
||||
"Beautifier '#{selectedBeautifier?.name}' output does not match expected \
|
||||
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 ->
|
||||
try
|
||||
|
|
|
@ -301,6 +301,16 @@ module.exports = class Beautifiers extends EventEmitter
|
|||
_.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) ->
|
||||
# Get language
|
||||
fileExtension = path.extname(filePath)
|
||||
|
@ -415,7 +425,6 @@ module.exports = class Beautifiers extends EventEmitter
|
|||
return resolve( null )
|
||||
|
||||
# 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")
|
||||
legacyBeautifyOnSave = atom.config.get("atom-beautify.beautifyOnSave")
|
||||
|
||||
|
@ -430,22 +439,17 @@ module.exports = class Beautifiers extends EventEmitter
|
|||
|
||||
# Get Beautifier
|
||||
logger.verbose(grammar, language)
|
||||
beautifiers = @getBeautifiers(language.name)
|
||||
|
||||
logger.verbose("language options: #{JSON.stringify(options, null, 4)}")
|
||||
logger.verbose('beautifiers', _.map(beautifiers, 'name'))
|
||||
|
||||
logger.verbose(language.name, filePath, options, allOptions)
|
||||
|
||||
# Check if unsupported language
|
||||
if beautifiers.length < 1
|
||||
beautifier = @getBeautifierForLanguage(language)
|
||||
if not beautifier?
|
||||
unsupportedGrammar = true
|
||||
logger.verbose('Beautifier for language not found')
|
||||
else
|
||||
# Select beautifier from language config preferences
|
||||
beautifier = _.find(beautifiers, (beautifier) ->
|
||||
beautifier.name is preferredBeautifierName
|
||||
) or beautifiers[0]
|
||||
logger.verbose('beautifier', beautifier.name)
|
||||
|
||||
# Apply language-specific option transformations
|
||||
|
@ -521,7 +525,6 @@ module.exports = class Beautifiers extends EventEmitter
|
|||
|
||||
)
|
||||
|
||||
|
||||
findFileResults : {}
|
||||
|
||||
|
||||
|
|
|
@ -344,11 +344,8 @@ debug = () ->
|
|||
|
||||
# Beautifier
|
||||
beautifiers = beautifier.getBeautifiers(language.name)
|
||||
preferredBeautifierName = atom.config.get("atom-beautify.language_#{language.namespace}_default_beautifier")
|
||||
addInfo('Supported Beautifiers', _.map(beautifiers, 'name').join(', '))
|
||||
selectedBeautifier = _.find(beautifiers, (beautifier) ->
|
||||
beautifier.name is preferredBeautifierName
|
||||
) or beautifiers[0]
|
||||
selectedBeautifier = beautifier.getBeautifierForLanguage(language)
|
||||
addInfo('Selected Beautifier', selectedBeautifier.name)
|
||||
|
||||
# Get current editor's text
|
||||
|
|
|
@ -74,7 +74,9 @@ module.exports = {
|
|||
description: "Number of line-breaks to be preserved in one chunk"
|
||||
unformatted:
|
||||
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:
|
||||
type: 'string'
|
||||
description: "List of tags (defaults to inline) that should not be reformatted"
|
||||
|
|
Loading…
Reference in New Issue