4 个版本
0.2.2 | 2024 年 7 月 25 日 |
---|---|
0.2.1 | 2021 年 12 月 23 日 |
0.2.0 | 2021 年 12 月 23 日 |
0.1.0 | 2018 年 5 月 28 日 |
#30 在 文本处理
167,980 每月下载量
用于 302 个 crate (14 个直接使用)
25KB
260 行
roff-rs
Roff 生成库。
示例
use roff::{bold, italic, roman, Roff};
fn main() {
let page = Roff::new()
.control("TH", ["CORRUPT", "1"])
.control("SH", ["NAME"])
.text([roman("corrupt - modify files by randomly changing bits")])
.control("SH", ["SYNOPSIS"])
.text([bold("corrupt"), roman(" ["), bold("-n"), roman(" "), italic("BITS"), roman("] ["),
bold("--bits"), roman(" "), italic("BITS"), roman("] "), italic("FILE"), roman("..."),
])
.control("SH", ["DESCRIPTION"])
.text([bold("corrupt"), roman(" modifies files by toggling a randomly chosen bit.")])
.control("SH", ["OPTIONS"])
.control("TP", [])
.text([bold("-n"), roman(", "), bold("--bits"), roman("="), italic("BITS")])
.text([roman("Set the number of bits to modify. Default is one bit.")]);
.render();
print!("{}", page);
输出内容
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.TH CORRUPT 1
.SH NAME
corrupt \- modify files by randomly changing bits
.SH SYNOPSIS
\fBcorrupt\fR [\fB\-n\fR \fIBITS\fR] [\fB\-\-bits\fR \fIBITS\fR] \fIFILE\fR...
.SH DESCRIPTION
\fBcorrupt\fR modifies files by toggling a randomly chosen bit.
.SH OPTIONS
.TP
\fB\-n\fR, \fB\-\-bits\fR=\fIBITS\fR
Set the number of bits to modify. Default is one bit.
如下所示,将被 man(1)
命令显示
CORRUPT(1) General Commands Manual CORRUPT(1)
NAME
corrupt - modify files by randomly changing bits
SYNOPSIS
corrupt [-n BITS] [--bits BITS] FILE...
DESCRIPTION
corrupt modifies files by toggling a randomly chosen bit.
OPTIONS
-n, --bits=BITS
Set the number of bits to modify. Default is one bit.
CORRUPT(1)
许可证
许可协议为以下之一
- Apache 许可协议第 2 版 (LICENSE-APACHE 或 https://apache.ac.cn/licenses/LICENSE-2.0)
- MIT 许可协议 (LICENSE-MIT 或 http://opensource.org/licenses/MIT)
任选其一。
贡献
除非您明确声明,否则根据 Apache-2.0 许可证定义,您提交的任何有意包含在作品中的贡献都将作为上述双重许可,而无需附加条款或条件。