deleting r-beautifier folder, changing name of r-beautifier.r to formatR.r, changing name to formatR in index.coffee, generating docs.

This commit is contained in:
Sebastian DiLorenzo 2016-09-02 11:15:30 +02:00
parent c7208806c3
commit f748204e55
6 changed files with 131 additions and 30 deletions

View File

@ -94,7 +94,7 @@ See [all supported options in the documentation at `docs/options.md`](https://g
| PHP | `PHP` |`.php`, `.module`, `.inc` | [`PHP-CS-Fixer`](http://php.net/manual/en/install.php) (Default), [`PHPCBF`](http://php.net/manual/en/install.php) | | PHP | `PHP` |`.php`, `.module`, `.inc` | [`PHP-CS-Fixer`](http://php.net/manual/en/install.php) (Default), [`PHPCBF`](http://php.net/manual/en/install.php) |
| Puppet | `Puppet` |`.pp` | [`puppet-lint`](http://puppet-lint.com/) (Default) | | Puppet | `Puppet` |`.pp` | [`puppet-lint`](http://puppet-lint.com/) (Default) |
| Python | `Python` |`.py` | [`autopep8`](https://github.com/hhatto/autopep8) (Default), [`yapf`](https://github.com/google/yapf) | | Python | `Python` |`.py` | [`autopep8`](https://github.com/hhatto/autopep8) (Default), [`yapf`](https://github.com/google/yapf) |
| R | `R` |`.r`, `.R` | [`R beautifier`](https://github.com/yihui/formatR) (Default) | | R | `R` |`.r`, `.R` | [`formatR`](https://github.com/yihui/formatR) (Default) |
| Riot.js | `Riot.js`, `HTML (Riot Tag)` |`.tag` | [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) | | Riot.js | `Riot.js`, `HTML (Riot Tag)` |`.tag` | [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) |
| Ruby | `Ruby`, `Ruby on Rails` |`.rb` | [`Rubocop`](https://github.com/bbatsov/rubocop) (Default), [`Ruby Beautify`](https://github.com/erniebrodeur/ruby-beautify) | | Ruby | `Ruby`, `Ruby on Rails` |`.rb` | [`Rubocop`](https://github.com/bbatsov/rubocop) (Default), [`Ruby Beautify`](https://github.com/erniebrodeur/ruby-beautify) |
| Rust | `Rust` |`.rs`, `.rlib` | [`rustfmt`](https://github.com/nrc/rustfmt) (Default) | | Rust | `Rust` |`.rs`, `.rlib` | [`rustfmt`](https://github.com/nrc/rustfmt) (Default) |

View File

@ -8242,6 +8242,102 @@ sort imports (requires isort installed) (Supported by autopep8)
} }
``` ```
#### [R](#r)
**Supported Beautifiers**: [`formatR`](#formatr)
| Option | formatR |
| --- | --- |
| `disabled` | :white_check_mark: |
| `default_beautifier` | :white_check_mark: |
| `beautify_on_save` | :white_check_mark: |
| `indent_size` | :white_check_mark: |
**Description**:
Options for language R
##### [Disable Beautifying Language](#disable-beautifying-language)
**Important**: This option is only configurable from within Atom Beautify's setting panel.
**Type**: `boolean`
**Description**:
Disable R Beautification
**How to Configure**
1. You can open the [Settings View](https://github.com/atom/settings-view) by navigating to
*Edit > Preferences (Linux)*, *Atom > Preferences (OS X)*, or *File > Preferences (Windows)*.
2. Go into *Packages* and search for "*Atom Beautify*" package.
3. Find the option "*Disable Beautifying Language*" and change it to your desired configuration.
##### [Default Beautifier](#default-beautifier)
**Important**: This option is only configurable from within Atom Beautify's setting panel.
**Default**: `formatR`
**Type**: `string`
**Enum**: `formatR`
**Description**:
Default Beautifier to be used for R
**How to Configure**
1. You can open the [Settings View](https://github.com/atom/settings-view) by navigating to
*Edit > Preferences (Linux)*, *Atom > Preferences (OS X)*, or *File > Preferences (Windows)*.
2. Go into *Packages* and search for "*Atom Beautify*" package.
3. Find the option "*Default Beautifier*" and change it to your desired configuration.
##### [Beautify On Save](#beautify-on-save)
**Important**: This option is only configurable from within Atom Beautify's setting panel.
**Type**: `boolean`
**Description**:
Automatically beautify R files on save
**How to Configure**
1. You can open the [Settings View](https://github.com/atom/settings-view) by navigating to
*Edit > Preferences (Linux)*, *Atom > Preferences (OS X)*, or *File > Preferences (Windows)*.
2. Go into *Packages* and search for "*Atom Beautify*" package.
3. Find the option "*Beautify On Save*" and change it to your desired configuration.
##### [Indent size](#indent-size)
**Namespace**: `r`
**Key**: `indent_size`
**Default**: `4`
**Type**: `integer`
**Supported Beautifiers**: [`formatR`](#formatr)
**Description**:
Indentation size/length (Supported by formatR)
**Example `.jsbeautifyrc` Configuration**
```json
{
"r": {
"indent_size": 4
}
}
```
#### [Riot.js](#riot.js) #### [Riot.js](#riot.js)
**Supported Beautifiers**: [`Pretty Diff`](#pretty-diff) **Supported Beautifiers**: [`Pretty Diff`](#pretty-diff)
@ -16338,6 +16434,35 @@ Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by C
``` ```
### formatR
##### [Indent size](#indent-size)
**Namespace**: `r`
**Key**: `indent_size`
**Default**: `4`
**Type**: `integer`
**Supported Beautifiers**: [`formatR`](#formatr)
**Description**:
Indentation size/length (Supported by formatR)
**Example `.jsbeautifyrc` Configuration**
```json
{
"r": {
"indent_size": 4
}
}
```
### rustfmt ### rustfmt
##### [Rustfmt path](#rustfmt-path) ##### [Rustfmt path](#rustfmt-path)

View File

@ -270,7 +270,8 @@
"r beautifier", "r beautifier",
"vue", "vue",
"vue beautifier", "vue beautifier",
"sassconvert" "sassconvert",
"formatr"
], ],
"devDependencies": { "devDependencies": {
"coffeelint": "^1.10.1", "coffeelint": "^1.10.1",
@ -283,4 +284,4 @@
"lint": "coffeelint src/ spec/", "lint": "coffeelint src/ spec/",
"code-docs": "codo && open docs/code/index.html" "code-docs": "codo && open docs/code/index.html"
} }
} }

View File

@ -7,7 +7,7 @@ path = require("path")
Beautifier = require('../beautifier') Beautifier = require('../beautifier')
module.exports = class R extends Beautifier module.exports = class R extends Beautifier
name: "R beautifier" name: "formatR"
link: "https://github.com/yihui/formatR" link: "https://github.com/yihui/formatR"
options: { options: {
@ -15,7 +15,7 @@ module.exports = class R extends Beautifier
} }
beautify: (text, language, options) -> beautify: (text, language, options) ->
r_beautifier = path.resolve(__dirname, "r-beautifier.r") r_beautifier = path.resolve(__dirname, "formatR.r")
@run("Rscript", [ @run("Rscript", [
r_beautifier, r_beautifier,
options.indent_size, options.indent_size,

View File

@ -1,25 +0,0 @@
###
Requires [formatR](https://github.com/yihui/formatR)
###
path = require("path")
"use strict"
Beautifier = require('../beautifier')
module.exports = class R extends Beautifier
name: "formatR"
link: "https://github.com/yihui/formatR"
options: {
R: true
}
beautify: (text, language, options) ->
r_beautifier = path.resolve(__dirname, "r-beautifier.r")
@run("Rscript", [
r_beautifier,
options.indent_size,
@tempFile("input", text),
'>',
@tempFile("input", text)
])