Skip to content

Commit 369708e

Browse files
committed
docs: update shields and README format
1 parent f5061b5 commit 369708e

File tree

1 file changed

+38
-30
lines changed

1 file changed

+38
-30
lines changed

README.md

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,40 @@
11
# fprettify
22

3-
[![Build Status](https://travis-ci.com/pseewald/fprettify.svg?branch=master)](https://travis-ci.com/pseewald/fprettify) [![Coverage Status](https://coveralls.io/repos/github/pseewald/fprettify/badge.svg?branch=master)](https://coveralls.io/github/pseewald/fprettify?branch=master) [![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](http://www.gnu.org/licenses/gpl-3.0) [![PyPI version](https://badge.fury.io/py/fprettify.svg)](https://badge.fury.io/py/fprettify)
3+
[![CI](https://github.com/pseewald/fprettify/actions/workflows/test.yml/badge.svg)](https://github.com/pseewald/fprettify/actions/workflows/test.yml)
4+
[![Coverage Status](https://coveralls.io/repos/github/pseewald/fprettify/badge.svg?branch=master)](https://coveralls.io/github/pseewald/fprettify?branch=master)
5+
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](http://www.gnu.org/licenses/gpl-3.0)
6+
![PyPI](https://img.shields.io/pypi/v/fprettify)
47

58
fprettify is an auto-formatter for modern Fortran code that imposes strict whitespace formatting, written in Python.
69

710
**NOTE:** I'm looking for help to maintain this repository, see [#127](https://github.com/pseewald/fprettify/issues/127).
811

9-
1012
## Features
1113

12-
* Auto-indentation.
13-
* Line continuations are aligned with the previous opening delimiter `(`, `[` or `(/` or with an assignment operator `=` or `=>`. If none of the above is present, a default hanging indent is applied.
14-
* Consistent amount of whitespace around operators and delimiters.
15-
* Removal of extraneous whitespace and consecutive blank lines.
16-
* Change letter case (upper case / lower case conventions) of intrinsics
17-
* Tested for editor integration.
18-
* By default, fprettify causes whitespace changes only and thus preserves revision history.
19-
* fprettify can handle cpp and [fypp](https://github.com/aradi/fypp) preprocessor directives.
20-
14+
- Auto-indentation.
15+
- Line continuations are aligned with the previous opening delimiter `(`, `[` or `(/` or with an assignment operator `=` or `=>`. If none of the above is present, a default hanging indent is applied.
16+
- Consistent amount of whitespace around operators and delimiters.
17+
- Removal of extraneous whitespace and consecutive blank lines.
18+
- Change letter case (upper case / lower case conventions) of intrinsics
19+
- Tested for editor integration.
20+
- By default, fprettify causes whitespace changes only and thus preserves revision history.
21+
- fprettify can handle cpp and [fypp](https://github.com/aradi/fypp) preprocessor directives.
2122

2223
## Limitations
2324

24-
* Works only for modern Fortran (Fortran 90 upwards).
25-
* Feature missing? Please create an issue.
26-
25+
- Works only for modern Fortran (Fortran 90 upwards).
26+
- Feature missing? Please create an issue.
2727

2828
## Requirements
2929

30-
* Python 3 (Python 2.7 no longer supported)
31-
* [ConfigArgParse](https://pypi.org/project/ConfigArgParse): optional, enables use of config file
32-
30+
- Python 3 (Python 2.7 no longer supported)
31+
- [ConfigArgParse](https://pypi.org/project/ConfigArgParse): optional, enables use of config file
3332

3433
## Examples
3534

3635
Compare `examples/*before.f90` (original Fortran files) with `examples/*after.f90` (reformatted Fortran files) to see what fprettify does. A quick demonstration:
3736

38-
``` Fortran
37+
```Fortran
3938
program demo
4039
integer :: endif,if,elseif
4140
integer,DIMENSION(2) :: function
@@ -50,8 +49,10 @@ print*,endif
5049
endif
5150
end program
5251
```
52+
5353
⇩⇩⇩⇩⇩⇩⇩⇩⇩⇩ `fprettify` ⇩⇩⇩⇩⇩⇩⇩⇩⇩⇩
54-
``` Fortran
54+
55+
```Fortran
5556
program demo
5657
integer :: endif, if, elseif
5758
integer, DIMENSION(2) :: function
@@ -67,65 +68,74 @@ program demo
6768
end program
6869
```
6970

70-
7171
## Installation
7272

7373
The latest release can be installed using pip:
74-
```
74+
75+
```sh
7576
pip install --upgrade fprettify
7677
```
7778

7879
Installation from source requires Python Setuptools:
79-
```
80+
81+
```sh
8082
./setup.py install
8183
```
8284

8385
For local installation, use `--user` option.
8486

85-
8687
## Command line tool
8788

8889
Autoformat file1, file2, ... inplace by
89-
```
90+
91+
```sh
9092
fprettify file1, file2, ...
9193
```
94+
9295
The default indent is 3. If you prefer something else, use `--indent n` argument.
9396

9497
In order to apply fprettify recursively to an entire Fortran project instead of a single file, use the `-r` option.
9598

9699
For more options, read
97-
```
100+
101+
```sh
98102
fprettify -h
99103
```
100104

101-
102105
## Editor integration
103106

104107
For editor integration, use
105-
```
108+
109+
```sh
106110
fprettify --silent
107111
```
112+
108113
For instance, with Vim, use fprettify with `gq` by putting the following commands in your `.vimrc`:
114+
109115
```vim
110116
autocmd Filetype fortran setlocal formatprg=fprettify\ --silent
111117
```
112118

113-
114119
## Deactivation and manual formatting (experimental feature)
115120

116121
fprettify can be deactivated for selected lines: a single line followed by an inline comment starting with `!&` is not auto-formatted and consecutive lines that are enclosed between two comment lines `!&<` and `!&>` are not auto-formatted. This is useful for cases where manual alignment is preferred over auto-formatting. Furthermore, deactivation is necessary when non-standard Fortran syntax (such as advanced usage of preprocessor directives) prevents proper formatting. As an example, consider the following snippet of fprettify formatted code:
122+
117123
```fortran
118124
A = [-1, 10, 0, &
119125
0, 1000, 0, &
120126
0, -1, 1]
121127
```
128+
122129
In order to manually align the columns, fprettify needs to be deactivated by
130+
123131
```fortran
124132
A = [-1, 10, 0, & !&
125133
0, 1000, 0, & !&
126134
0, -1, 1] !&
127135
```
136+
128137
or, equivalently by
138+
129139
```fortran
130140
!&<
131141
A = [-1, 10, 0, &
@@ -134,10 +144,8 @@ A = [-1, 10, 0, &
134144
!&>
135145
```
136146

137-
138147
## Contributing / Testing
139148

140149
The testing mechanism allows you to easily test fprettify with any Fortran project of your choice. Simply clone or copy your entire project into `fortran_tests/before` and run `python setup.py test`. The directory `fortran_tests/after` contains the test output (reformatted Fortran files). If testing fails, please submit an issue!
141150

142-
143151
[![Code Climate](https://codeclimate.com/github/pseewald/fprettify/badges/gpa.svg)](https://codeclimate.com/github/pseewald/fprettify)

0 commit comments

Comments
 (0)