Perl support (using perltidy) (see Glavin001/atom-beautify#33)
This commit is contained in:
parent
a25ad22a8d
commit
f64d2bae20
|
@ -34,6 +34,7 @@ Or Settings/Preferences ➔ Packages ➔ Search for `atom-beautify`
|
|||
- Requires [python-sqlparse](https://github.com/andialbrecht/sqlparse)
|
||||
- [x] [Markdown](https://github.com/Glavin001/atom-beautify/issues/93#issuecomment-55642483)
|
||||
- Requires [Pandoc](http://johnmacfarlane.net/pandoc/) to be already installed
|
||||
- [X] [Perl](https://github.com/Glavin001/atom-beautify/issues/33)
|
||||
- [x] [PHP](https://github.com/donaldpipowitch/atom-beautify/issues/26)
|
||||
- Requires [PHP_Beautifier](http://pear.php.net/package/PHP_Beautifier) to be already installed.
|
||||
- [x] [Python](https://github.com/donaldpipowitch/atom-beautify/issues/24)
|
||||
|
@ -60,13 +61,6 @@ Or Settings/Preferences ➔ Packages ➔ Search for `atom-beautify`
|
|||
- Requires [Uncrustify](http://sourceforge.net/projects/uncrustify/)
|
||||
- [x] [TypeScript](https://github.com/Glavin001/atom-beautify/issues/49)
|
||||
|
||||
### Road Map
|
||||
|
||||
#### Language support
|
||||
|
||||
- [ ] [Perl](https://github.com/Glavin001/atom-beautify/issues/33)
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Open the [Command Palette](https://github.com/atom/command-palette), and type `Beautify`.
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
###
|
||||
// Requires [perltidy](http://perltidy.sourceforge.net)
|
||||
###
|
||||
|
||||
"use strict"
|
||||
|
||||
getCmd = (inputPath, outputPath, options) ->
|
||||
# console.debug "[perl-beautify] options: " + JSON.stringify(options)
|
||||
args = [
|
||||
'"' + options.perltidy_path + '"'
|
||||
'--standard-output'
|
||||
'--standard-error-output'
|
||||
'--quiet'
|
||||
]
|
||||
if options.perltidy_profile
|
||||
args.push '"--profile=' + options.perltidy_profile + '"'
|
||||
args.push '"' + inputPath + '"'
|
||||
cmd = args.join(' ')
|
||||
# console.debug "[perl-beautify] cmd: " + cmd
|
||||
return cmd
|
||||
|
||||
cliBeautify = require("./cli-beautify")
|
||||
isStdout = true
|
||||
module.exports = cliBeautify(getCmd, isStdout)
|
|
@ -10,6 +10,7 @@ beautifyJS = null
|
|||
beautifyHTML = null
|
||||
beautifyCSS = null
|
||||
beautifySQL = null
|
||||
beautifyPerl = null
|
||||
beautifyPHP = null
|
||||
beautifyPython = null
|
||||
beautifyRuby = null
|
||||
|
@ -38,6 +39,7 @@ module.exports =
|
|||
"html"
|
||||
"css"
|
||||
"sql"
|
||||
"perl"
|
||||
"php"
|
||||
"python"
|
||||
"ruby"
|
||||
|
@ -97,6 +99,10 @@ module.exports =
|
|||
# Markdown
|
||||
markdown_pandoc_path: ""
|
||||
|
||||
# Perl
|
||||
perl_perltidy_path: "perltidy"
|
||||
perl_perltidy_profile: ""
|
||||
|
||||
# PHP
|
||||
php_beautifier_path: ""
|
||||
|
||||
|
@ -183,6 +189,9 @@ module.exports =
|
|||
when "SQL (Rails)", "SQL"
|
||||
beautifySQL ?= require("./langs/sql-beautify")
|
||||
beautifySQL text, self.getOptions("sql", allOptions), beautifyCompleted
|
||||
when "Perl"
|
||||
beautifyPerl ?= require("./langs/perl-beautify")
|
||||
beautifyPerl text, self.getOptions("perl", allOptions), beautifyCompleted
|
||||
when "PHP"
|
||||
beautifyPHP ?= require("./langs/php-beautify")
|
||||
beautifyPHP text, self.getOptions("php", allOptions), beautifyCompleted
|
||||
|
|
Loading…
Reference in New Issue