Skip to content

Commit 0a58f65

Browse files
committed
more examples and better description in readme
1 parent 353136b commit 0a58f65

File tree

1 file changed

+40
-4
lines changed

1 file changed

+40
-4
lines changed

README.md

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
# fprettify
2+
23
[![Build Status](https://travis-ci.org/pseewald/fprettify.svg?branch=master)](https://travis-ci.org/pseewald/fprettify) [![Coverage Status](https://coveralls.io/repos/github/pseewald/fprettify/badge.svg?branch=master)](https://coveralls.io/github/pseewald/fprettify?branch=master) [![Code Health](https://landscape.io/github/pseewald/fprettify/master/landscape.svg?style=flat)](https://landscape.io/github/pseewald/fprettify/master) [![Code Climate](https://codeclimate.com/github/pseewald/fprettify/badges/gpa.svg)](https://codeclimate.com/github/pseewald/fprettify) [![Code Issues](https://www.quantifiedcode.com/api/v1/project/d5bb6eeb81ba41478986898d3d2665e4/badge.svg)](https://www.quantifiedcode.com/app/project/d5bb6eeb81ba41478986898d3d2665e4)
34

4-
fprettify is an auto-formatter for modern Fortran code that imposes strict whitespace formatting.
5+
fprettify is an auto-formatter for modern Fortran code that imposes strict whitespace formatting, written in Python.
56

67

78
## Features
89

910
* Auto-indentation.
1011
* 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.
11-
* All operators are surrounded by exactly one whitespace character, except for arithmetic operators.
12+
* Consistent amount of whitespace around operators and delimiters.
1213
* Removal of extraneous whitespace and consecutive blank lines.
1314
* Works only for modern Fortran (Fortran 90 upwards).
15+
* Tested for editor integration.
1416
* By default, fprettify causes changes in the amount of whitespace only and thus preserves revision history.
17+
* Feature missing? Please create an issue.
1518

1619

1720
## Requirements
@@ -21,7 +24,35 @@ Python 2.7 or Python 3.x
2124

2225
## Examples
2326

24-
Compare `examples/*before.f90` (original Fortran files) with `examples/*after.f90` (reformatted Fortran files) to see what fprettify does.
27+
Compare `examples/*before.f90` (original Fortran files) with `examples/*after.f90` (reformatted Fortran files) to see what fprettify does. A quick demonstration:
28+
29+
``` Fortran
30+
program demo
31+
integer :: endif,if,else
32+
endif=3; if=2
33+
if(endif==2)then
34+
endif=5
35+
else=if+4*(endif+&
36+
2**10)
37+
else if(endif==3)then
38+
print*,endif
39+
endif
40+
end program
41+
```
42+
⇩⇩⇩⇩⇩⇩⇩⇩⇩⇩
43+
``` Fortran
44+
program demo
45+
integer :: endif, if, else
46+
endif = 3; if = 2
47+
if (endif == 2) then
48+
endif = 5
49+
else = if + 4*(endif + &
50+
2**10)
51+
else if (endif == 3) then
52+
print *, endif
53+
endif
54+
end program
55+
```
2556

2657

2758
## Installation
@@ -43,7 +74,12 @@ The default indent is 3. If you prefer something else, use `--indent=<n>` argume
4374

4475
For editor integration, use
4576
```
46-
fprettify --no-report-errors
77+
fprettify --silent
78+
```
79+
80+
For instance, with Vim, use fprettify with `gq` by putting the following commands in your `.vimrc`:
81+
```vim
82+
autocmd Filetype fortran setlocal formatprg=fprettify\ --silent
4783
```
4884

4985
For more information, read

0 commit comments

Comments
 (0)