Adding travis R install and fixed merge

This commit is contained in:
Sebastian DiLorenzo 2016-08-24 12:06:56 +02:00
commit a8ceae0626
11 changed files with 193 additions and 6 deletions

View File

@ -7,6 +7,7 @@
- Closes [#776] (https://github.com/Glavin001/atom-beautify/issues/776) Add support for `collapse-preserve-inline` brace_style for javascript.
- Closes [#786](https://github.com/Glavin001/atom-beautify/issues/786) YAPF configuration files are ignored.
- Fix phpcbf hanging issue by closing stdin. See [#893](https://github.com/Glavin001/atom-beautify/issues/893)
- Add warning notification when parsing `.jsbeautifyrc` as JSON or YAML fails. See [#1106](https://github.com/Glavin001/atom-beautify/issues/1106)
# v0.29.0
- Closes [#447](https://github.com/Glavin001/atom-beautify/issues/447). Improved Handlebars language support

View File

@ -102,7 +102,8 @@ See [all supported options in the documentation at `docs/options.md`](https://g
| TypeScript | `TypeScript` |`.ts` | [`TypeScript Formatter`](https://github.com/vvakame/typescript-formatter) (Default) |
| Vala | `Vala` |`.vala`, `.vapi` | [`Uncrustify`](https://github.com/uncrustify/uncrustify) (Default) |
| Visualforce | `Visualforce` |`.page` | [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) |
| XML | `SLD`, `XML`, `XHTML`, `XSD`, `XSL`, `JSP`, `GSP` |`.sld`, `.xml`, `.xhtml`, `.xsd`, `.xsl`, `.jsp`, `.gsp` | [`JS Beautify`](https://github.com/beautify-web/js-beautify), [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) |
| Vue | `Vue Component` |`.vue` | `Vue Beautifier` (Default) |
| XML | `SLD`, `XML`, `XHTML`, `XSD`, `XSL`, `JSP` |`.sld`, `.xml`, `.xhtml`, `.xsd`, `.xsl`, `.jsp` | [`JS Beautify`](https://github.com/beautify-web/js-beautify), [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) |
| XTemplate | `XTemplate` |`.xtemplate` | [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) |
## Usage

View File

@ -83,7 +83,7 @@ install:
# Ruby & Gem
- cinst ruby -y
- "SET PATH=C:\\Ruby193\\bin;%PATH%"
- "SET PATH=C:\\tools\\ruby23\\bin;%PATH%"
# Rubocop
- gem install rubocop
- where rubocop
@ -98,6 +98,8 @@ install:
- cinst emacs -y
- where emacs
# FIXME: Enable allowEmptyChecksums, until someone fixes the checksum issue of php
- choco feature enable -n allowEmptyChecksums
# PHP
- cinst php -y
- ps: "ls \"C:\\tools\\php\""

View File

@ -0,0 +1,46 @@
<template>
<base-view>
<div slot="page-body" class="row">
Your content here!
</div>
</base-view>
</template>
<script>
export default {
data: function() {
return {
text: 'Hello, world!'
}
}
}
</script>
<style lang="sass">
nav {
ul {
margin:0 padding: 0;
}
li {
display: inline-block;
}
a {
display: block;
}
}
</style>
<style lang="scss">
nav {
ul {
margin: 0;
padding: 0;
}
li {
display: inline-block;
}
a {
display: block;
}
}
</style>

View File

@ -0,0 +1,45 @@
<template>
<base-view>
<div slot="page-body" class="row">
Your content here!
</div>
</base-view>
</template>
<script>
export default {
data: function() {
return {
text: 'Hello, world!'
}
}
}
</script>
<style lang="sass">
nav {
ul {
margin: 0
padding: 0
}
li {
display: inline-block
}
a {
display: block
}
}
</style>
<style lang="scss">
nav {
ul {
margin: 0;
padding: 0;
}
li { display: inline-block; }
a {
display: block;
}
}
</style>

View File

@ -98,6 +98,9 @@
{
"name": "Sebastian DiLorenzo",
"url": "https://github.com/Sebastian-D"
},
"name": "Émile Bergeron",
"url": "https://github.com/emileber"
}
],
"engines": {
@ -114,7 +117,7 @@
"csscomb": "^3.1.7",
"diff": "^2.1.0",
"editorconfig": "^0.13.2",
"event-kit": "^2.0.0",
"event-kit": "^2.1.0",
"expand-home-dir": "0.0.3",
"extend": "^3.0.0",
"gherkin": "2.12.2",
@ -122,7 +125,7 @@
"handlebars": "^4.0.2",
"js-beautify": "^1.6.3",
"jscs": "^3.0.7",
"lodash": "^4.14.1",
"lodash": "^4.14.2",
"loophole": "^1.0.0",
"marko-prettyprint": "^1.1.8",
"node-dir": "^0.1.15",

View File

@ -94,6 +94,11 @@ describe "BeautifyLanguages", ->
# All Languages for configuration
langNames = fs.readdirSync(langsDir)
for lang in langNames
# FIXME: Skip testing ocaml in Windows
if isWindows && lang == 'ocaml'
continue
do (lang) ->
# Generate the path to where al of the tests are
testsDir = path.resolve(langsDir, lang)

View File

@ -66,6 +66,7 @@ module.exports = class Beautifiers extends EventEmitter
'stylish-haskell'
'tidy-markdown'
'typescript-formatter'
'vue-beautifier'
'yapf'
'erl_tidy'
'marko-beautifier'
@ -478,13 +479,23 @@ module.exports = class Beautifiers extends EventEmitter
strip ?= require("strip-json-comments")
externalOptions = JSON.parse(strip(contents))
catch e
jsonError = e.message
logger.debug "Failed parsing config as JSON: " + configPath
# Attempt as YAML
try
yaml ?= require("yaml-front-matter")
externalOptions = yaml.safeLoad(contents)
catch e
title = "Atom Beautify failed to parse config as JSON or YAML"
detail = """
Parsing '.jsbeautifyrc' at #{configPath}
JSON: #{jsonError}
YAML: #{e.message}
"""
atom?.notifications.addWarning(title, {
detail
dismissable : true
})
logger.debug "Failed parsing config as YAML and JSON: " + configPath
externalOptions = {}
else

View File

@ -0,0 +1,49 @@
"use strict"
Beautifier = require('./beautifier')
prettydiff = require("prettydiff")
_ = require('lodash')
module.exports = class VueBeautifier extends Beautifier
name: "Vue Beautifier"
options:
Vue: true
beautify: (text, language, options) ->
return new @Promise((resolve, reject) ->
regexp = /(<(template|script|style)[^>]*>)((\s|\S)*?)<\/\2>/gi
resolve(text.replace(regexp, (match, begin, type, text) ->
lang = /lang\s*=\s*['"](\w+)["']/.exec(begin)?[1]
switch type
when "template"
switch lang
when "pug", "jade"
match.replace(text, "\n" + require("pug-beautify")(text, options) + "\n")
when undefined
match.replace(text, "\n" + require("js-beautify").html(text, options) + "\n")
else
match
when "script"
match.replace(text, "\n" + require("js-beautify")(text, options) + "\n")
when "style"
switch lang
when "sass", "scss"
options = _.merge options,
source: text
lang: "scss"
mode: "beautify"
match.replace(text, prettydiff.api(options)[0])
when "less"
options = _.merge options,
source: text
lang: "less"
mode: "beautify"
match.replace(text, prettydiff.api(options)[0])
when undefined
match.replace(text, "\n" + require("js-beautify").css(text, options) + "\n")
else
match
))
)

View File

@ -65,6 +65,7 @@ module.exports = class Languages
"twig"
"typescript"
"vala"
"vue"
"visualforce"
"xml"
"xtemplate"

23
src/languages/vue.coffee Normal file
View File

@ -0,0 +1,23 @@
module.exports = {
name: "Vue"
namespace: "vue"
fallback: ['html']
###
Supported Grammars
###
grammars: [
"Vue Component"
]
###
Supported extensions
###
extensions: [
"vue"
]
defaultBeautifier: "Vue Beautifier"
}