You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-7Lines changed: 15 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,20 +8,20 @@ MBeautifier is a lightweight M-Script based Matlab source code formatter usable
8
8
Main features
9
9
-------------
10
10
11
-
- Padding operators with white spaces based on the configuration.
12
-
-Fixing white space padding of keywords
11
+
- Padding operators with white spaces based on the XML configuration file.
12
+
-Correction white space padding of keywords
13
13
- Correction of indentation using the Smart Indent functionality of the Matlab Editor
14
14
- Removal of continuous empty lines (the number can be configured)
15
-
- Optionally inserting missing element separators (commas) in matrix and cell array declarations
16
-
- Different working modes: format the current page of the Matlab editor, format only a selection in the Matlab Editor or format files
15
+
- Optionally inserting missing element separators (commas) in matrix and cell array initializations
16
+
- Different working modes: format the current page of the Matlab editor, format only a selection in the Matlab Editor or format file(s)
17
17
18
18
Deployment and Configuration
19
19
----------------------------
20
20
Add containing directory to the Matlab path, then execute: `MBeautify.setup()`.
21
21
22
22
This command will create the standard configuration of formatting stored in `MBeautifier\resources\settings\MBeautyConfigurationRules.m`.
23
23
24
-
This file is used in run-time to gather the configuration rules, therefore when the configuration has been modified, executing this function again will make the rules active.
24
+
This file is used in run-time to gather the configuration rules, therefore when the configuration XML file has been modified, executing this function again will make the rules active.
25
25
26
26
### Configuration
27
27
@@ -41,7 +41,7 @@ Each `OperatorPaddingRule` represents the formatting rules for one single operat
41
41
<ValueTo> ~= </ValueTo>
42
42
</OperatorPaddingRule>
43
43
44
-
The above example shows the rules for the "not equals" operator. The `ValueFrom` node stores the operator `~=` and the `ValueTo` node stores the expected formatting: the operator should be preceded and followed by a white-space character.
44
+
The above example shows the rule for the "not equals" operator. The `ValueFrom` node stores the operator `~=` and the `ValueTo` node stores the expected format: the operator should be preceded and followed by a white-space character.
45
45
46
46
All of the operator padding rules are collected dynamically, therefore adding a new node to this list then executing the `setup` command will result in that MBeautifier will replace the currently added node also.
47
47
@@ -65,10 +65,18 @@ Currently there are three approaches supported:
65
65
66
66
- Perform formatting on the currently active page of Matlab Editor. Command: `MBeautify.formatCurrentEditorPage()`. By default the file is not saved, but it remains opened modified in the editor. Optionally the formatted file can be saved using the `MBeautify.formatCurrentEditorPage(true)` syntax.
67
67
- Perform formatting on the currently selected text of the active page of Matlab Editor. Command: `MBeautify.formatEditorSelection()`. An optional saving mechanism as above exists also in this case. Useful in case of large files, but in any case `MBeautify.formatCurrentEditorPage()` is suggested.
68
-
- Perfrom formatting on a file. Command: `MBeautify.formatFile(file)`. Can be used with (1)one argument: the input file is formatted and remains open in the Matlab editor unsaved; (2)two arguments as `MBeautify.formatFile(file, outFile)`: the formatted file is saved to the specified output file if possible. Output can be the same as input.
68
+
- Perform formatting on a file. Command: `MBeautify.formatFile(file)`. Can be used with (1)one argument: the input file is formatted and remains open in the Matlab editor unsaved; (2)two arguments as `MBeautify.formatFile(file, outFile)`: the formatted file is saved to the specified output file if possible. Output can be the same as input.
69
+
- Perform formatting on several files in a directory. Command: `MBeautify.formatFiles(directory, fileFilter)`. The first argument is an absolute path to a directory, the second one is a wildcard expression (used for `dir` command) to filter files in the target directory. The files will be formatted in-place (overwritten).
69
70
70
71
Supported Matlab versions
71
72
-------------------------
72
73
73
74
As MBeautifier uses the built-in Matlab Editor functionality, it supports Matlab versions from R2011a.
74
75
76
+
Planned future versions
77
+
-----------------------
78
+
79
+
As Matlab does not contain any formatter even in R2017 releases, this project will be maintained until at least R2018 (if that release will contain a formatter).
80
+
81
+
As it is planned at the moment, the current release is the last one which is M-Script based, and the next release is planned to be implemented in Java with Matlab interface. This is the first step to make MBeautifier also usable in Octave.
0 commit comments