Debian Codegraph @

README.md

raw symbols SCIP
1 # roff-rs
2
3 [![Documentation](https://img.shields.io/badge/docs-master-blue.svg)][Documentation]
4 ![License](https://img.shields.io/crates/l/roff.svg)
5 [![crates.io](https://img.shields.io/crates/v/roff.svg)][Crates.io]
6
7 [Crates.io]: https://crates.io/crates/roff
8 [Documentation]: https://docs.rs/roff/
9
10 [Roff](http://man7.org/linux/man-pages/man7/roff.7.html) generation library.
11
12 ## Examples
13
14 ```rust
15 use roff::{bold, italic, roman, Roff};
16
17 fn main() {
18 let page = Roff::new()
19 .control("TH", ["CORRUPT", "1"])
20 .control("SH", ["NAME"])
21 .text([roman("corrupt - modify files by randomly changing bits")])
22 .control("SH", ["SYNOPSIS"])
23 .text([bold("corrupt"), roman(" ["), bold("-n"), roman(" "), italic("BITS"), roman("] ["),
24 bold("--bits"), roman(" "), italic("BITS"), roman("] "), italic("FILE"), roman("..."),
25 ])
26 .control("SH", ["DESCRIPTION"])
27 .text([bold("corrupt"), roman(" modifies files by toggling a randomly chosen bit.")])
28 .control("SH", ["OPTIONS"])
29 .control("TP", [])
30 .text([bold("-n"), roman(", "), bold("--bits"), roman("="), italic("BITS")])
31 .text([roman("Set the number of bits to modify. Default is one bit.")])
32 .render();
33 print!("{}", page);
34 }
35 ```
36
37 Which outputs:
38 ```troff
39 .ie \n(.g .ds Aq \(aq
40 .el .ds Aq '
41 .TH CORRUPT 1
42 .SH NAME
43 corrupt \- modify files by randomly changing bits
44 .SH SYNOPSIS
45 \fBcorrupt\fR [\fB\-n\fR \fIBITS\fR] [\fB\-\-bits\fR \fIBITS\fR] \fIFILE\fR...
46 .SH DESCRIPTION
47 \fBcorrupt\fR modifies files by toggling a randomly chosen bit.
48 .SH OPTIONS
49 .TP
50 \fB\-n\fR, \fB\-\-bits\fR=\fIBITS\fR
51 Set the number of bits to modify. Default is one bit.
52 ```
53
54 Which will be shown by the `man(1)` command as:
55
56 ```txt
57 CORRUPT(1) General Commands Manual CORRUPT(1)
58
59 NAME
60 corrupt - modify files by randomly changing bits
61
62 SYNOPSIS
63 corrupt [-n BITS] [--bits BITS] FILE...
64
65 DESCRIPTION
66 corrupt modifies files by toggling a randomly chosen bit.
67
68 OPTIONS
69 -n, --bits=BITS
70 Set the number of bits to modify. Default is one bit.
71
72 CORRUPT(1)
73 ```
74
75 ## License
76
77 Licensed under either of
78
79 * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or <https://www.apache.org/licenses/LICENSE-2.0>)
80 * MIT license ([LICENSE-MIT](LICENSE-MIT) or <https://opensource.org/license/mit>)
81
82 at your option.
83
84 ### Contribution
85
86 Unless you explicitly state otherwise, any contribution intentionally
87 submitted for inclusion in the work by you, as defined in the Apache-2.0
88 license, shall be dual-licensed as above, without any additional terms or
89 conditions.