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文本处理

Download history 39223/week @ 2024-04-27 31098/week @ 2024-05-04 37004/week @ 2024-05-11 37388/week @ 2024-05-18 43281/week @ 2024-05-25 42760/week @ 2024-06-01 39614/week @ 2024-06-08 39770/week @ 2024-06-15 37493/week @ 2024-06-22 38005/week @ 2024-06-29 36311/week @ 2024-07-06 36584/week @ 2024-07-13 39005/week @ 2024-07-20 48130/week @ 2024-07-27 40302/week @ 2024-08-03 35492/week @ 2024-08-10

167,980 每月下载量
用于 302 个 crate (14 个直接使用)

MIT/Apache

25KB
260

roff-rs

Documentation License crates.io

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.0 许可证定义,您提交的任何有意包含在作品中的贡献都将作为上述双重许可,而无需附加条款或条件。

无运行时依赖