Skip to content

Commit ddfa24f

Browse files
committed
docs(readme): improve text; adopt SemBr
1 parent 09100c4 commit ddfa24f

File tree

1 file changed

+60
-32
lines changed

1 file changed

+60
-32
lines changed

README.md

Lines changed: 60 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
# csv2html
22

3-
This command line utility converts [CSV files](http://en.wikipedia.org/wiki/Comma-separated_values) to HTML tables and complete HTML documents. It requires Rust 1.65 or later to build and Python 3.7 or later to test. By default it uses the first row of the CSV file as the [header](https://developer.mozilla.org/en/docs/Web/HTML/Element/th) of the HTML table.
3+
This command-line utility converts [CSV files](http://en.wikipedia.org/wiki/Comma-separated_values) to HTML tables and complete HTML documents.
4+
It requires Rust 1.65 or later to build and Python 3.7 or later to test.
5+
By default, it uses the first row of the CSV file as the [header](https://developer.mozilla.org/en/docs/Web/HTML/Element/th) of the HTML table.
46

5-
The older Python version is preserved in the branch [`python`](https://github.com/dbohdan/csv2html/tree/python).
7+
The original Python version of csv2html is preserved in the branch [`python`](https://github.com/dbohdan/csv2html/tree/python).
68

79

810
## Installation
911

10-
Prebuilt Linux and Windows binaries are available. They are attached to releases on the [Releases](https://github.com/dbohdan/csv2html/releases) page.
12+
Prebuilt Linux and Windows binaries are available.
13+
They are attached to releases on the ["Releases"](https://github.com/dbohdan/csv2html/releases) page.
1114

1215
### Installing with Cargo
1316

@@ -17,32 +20,37 @@ cargo install csv2html
1720

1821
### Building on Debian and Ubuntu
1922

20-
Follow the instructions to build a static Linux binary of `csv2html` from source on recent Debian and Ubuntu.
23+
Follow the instructions to build a static Linux binary of csv2html from the source code on recent Debian and Ubuntu.
2124

22-
1\. Install [Rustup](https://rustup.rs/). Through Rustup add the stable MUSL target for your CPU.
25+
1\. Install [Rustup](https://rustup.rs/).
26+
Through Rustup add the stable musl libc target for your CPU.
2327

2428
```sh
2529
rustup target add x86_64-unknown-linux-musl
2630
```
2731

28-
2\. Install the build and testing dependencies.
32+
2\. Install the build and test dependencies.
2933

3034
```sh
3135
sudo apt install build-essential musl-tools python3
3236
```
3337

34-
3\. Clone this repository. Build the binary.
38+
3\. Clone this repository.
39+
Build the binary.
3540

36-
git clone https://github.com/dbohdan/csv2html
37-
cd csv2html
38-
make test
39-
make release-linux
41+
```sh
42+
git clone https://github.com/dbohdan/csv2html
43+
cd csv2html
44+
make test
45+
make release-linux
46+
```
4047

4148
### Cross-compiling for Windows
4249

43-
Follow the instructions to build a 32-bit Windows binary of `csv2html` on recent Debian and Ubuntu.
50+
Follow the instructions to build a 32-bit Windows binary of csv2html on recent Debian and Ubuntu.
4451

45-
1\. Install [Rustup](https://rustup.rs/). Through Rustup add the i686 GNU ABI Windows target.
52+
1\. Install [Rustup](https://rustup.rs/).
53+
Through Rustup add the i686 GNU ABI Windows target.
4654

4755
```sh
4856
rustup target add i686-pc-windows-gnu
@@ -54,21 +62,24 @@ rustup target add i686-pc-windows-gnu
5462
sudo apt install build-essential mingw-w64
5563
```
5664

57-
3\. Configure Cargo for cross-compilation. Put the following in `~/.cargo/config`.
65+
3\. Configure Cargo for cross-compilation.
66+
Add the following in `~/.cargo/config`.
5867

5968
```toml
6069
[target.i686-pc-windows-gnu]
6170
linker = "/usr/bin/i686-w64-mingw32-gcc"
6271
```
6372

64-
4\. Clone this repository. Build the binary.
65-
66-
git clone https://github.com/dbohdan/csv2html
67-
cd csv2html
68-
make release-windows
73+
4\. Clone this repository.
74+
Build the binary.
6975

76+
```
77+
git clone https://github.com/dbohdan/csv2html
78+
cd csv2html
79+
make release-windows
80+
```
7081

71-
## Command line arguments
82+
## Command-line arguments
7283

7384
```none
7485
Convert CSV files to HTML tables
@@ -85,38 +96,55 @@ Options:
8596
-s, --start <N> Skip the first N-1 rows; start at row N
8697
-r, --renumber Replace the first column with row numbers
8798
-n, --no-header Do not use the first row of the input as the header
88-
-c, --complete-document Output a complete HTML document instead of only a table
89-
--table <ATTRS> HTML attributes for the tag <table> (e.g., --table 'foo="bar" baz' results in the output <table foo="bar" baz>...</table>); it is up to the user to ensure the result is valid HTML
99+
-c, --complete-document Output a complete HTML document instead of only a
100+
table
101+
--table <ATTRS> HTML attributes for the tag <table> (e.g., --table
102+
'foo="bar" baz' results in the output <table foo="bar" baz>...</table>); it is
103+
up to the user to ensure the result is valid HTML
90104
--tr <ATTRS> Attributes for <tr>
91105
--th <ATTRS> Attributes for <th>
92106
--td <ATTRS> Attributes for <td>
93107
-h, --help Print help
94108
-V, --version Print version
95109
```
96110

97-
98111
## Use examples
99112

100-
The following command reads the data from `test/test.csv` and writes the corresponding HTML table to `test.html`:
113+
The following command reads the data in `test/test.csv` and writes an HTML table that corresponds to the data to `test.html`:
101114

102-
csv2html -o test.html tests/test.csv
115+
```sh
116+
csv2html -o test.html tests/test.csv
117+
```
103118

104-
The next command takes semicolon-delimited data from `pub.csv`, starting with row 267. The first column of the table is replaced with the row number starting at 1 (except in the header row, which is untouched). The output is redirected to the file `pub.html`.
119+
The following command takes semicolon-delimited data from `pub.csv`, starting with row 267.
120+
The first column of the table is replaced with the row number starting at 1 (except in the header row, which is untouched).
121+
The output is redirected to the file `pub.html`.
105122

106-
csv2html pub.csv -d \; -r -s 267 > pub.html
123+
```sh
124+
csv2html pub.csv -d \; -r -s 267 > pub.html
125+
```
107126

108-
Same as above, but this time the output is a full HTML document instead of just the markup for the table:
127+
The same as above, but the output is a full HTML document instead of just the markup for the table:
109128

110-
csv2html pub.csv -d \; -r -s 267 -c > pub.html
129+
```sh
130+
csv2html pub.csv -d \; -r -s 267 -c > pub.html
131+
```
111132

112133
If the input file is tab-delimited, use `\t` as the deliminter argument.
113134

114-
csv2html --delimiter '\t' tests/test.tsv
135+
```sh
136+
# POSIX.
137+
csv2html --delimiter '\t' tests/test.tsv
138+
```
115139

116-
csv2html-win32.exe --delimiter \t tests/test.tsv
140+
```batch
141+
rem Windows.
142+
csv2html-win32.exe --delimiter \t tests/test.tsv
143+
```
117144

118145
`\t` is the only [backslash escape sequence](https://en.wikipedia.org/wiki/Escape_sequences_in_C) that is implemented.
119146

120147
## License
121148

122-
Three-clause ("new" or "revised") BSD. See the file `LICENSE`.
149+
Three-clause ("new" or "revised") BSD.
150+
See the file `LICENSE`.

0 commit comments

Comments
 (0)