Crate to generate files in ROFF format (Rust)

Related tags

Command-line roffman
Overview

roffman

Build Status Docs

A crate to generate roff man pages.

Usage

Add the following to the Cargo.toml:

[dependencies]
roffman = "0.3"

Example

use roffman::{Roff, RoffNode, RoffNode, Roffable, SectionNumber, SynopsisOpt};

fn main() {
    let roff = Roff::new("roffman", SectionNumber::Miscellaneous)
    .date("August 2021")
    .section(
       "BASIC USAGE",
       [
           RoffNode::paragraph([
               "This is how you create a basic paragraph using roffman.",
           ]),
           RoffNode::indented_paragraph(
               [
                   "This line should be slightly indented to the ".roff(),
                   "right.".roff().bold(),
               ],
               Some(4),
               Some("optional-title")
           ),
           RoffNode::synopsis(
                    "roffman-command",
                    [
                    "This is the description of this command. It will be displayed right next to".roff(), " it".roff().italic()
]                     ,
                    [
                    SynopsisOpt::new("--opt").description(["some simple opt"]),
                    SynopsisOpt::new("--opt-with-arg").argument("ARG").description(["opt with an argument"]),
                    SynopsisOpt::new("--bold")
           ]),
           RoffNode::paragraph(["Example:".roff().bold()]),
           RoffNode::example([
               r#"
impl Roffable for u8 {
    fn roff(&self) -> RoffText {
        self.to_string().roff()
    }
}"#,
            ]),
           RoffNode::url("GitHub", "https://github.com/vv9k/roffman"),
           RoffNode::text("\nvv9k"),
           RoffNode::trademark_sign(),
            
        ],
    );

    let rendered = roff.to_string().unwrap();
    println!("{}", rendered);

}

Output:

.TH roffman 7 "August 2021"
.SH "BASIC USAGE"
.P
This is how you create a basic paragraph using roffman.
.IP optional\-title 4
This line should be slightly indented to the \fBright.\fR
.SY roffman\-command
This is the description of this command. It will be displayed right next to\fI it\fR

.OP \-\-opt
some simple opt

.OP \-\-opt\-with\-arg ARG
opt with an argument

.OP \-\-bold

.YS
.P
\fBExample:\fR
.EX

impl Roffable for u8 {
    fn roff(&self) \-> RoffText {
        self.to_string().roff()
    }
}
.EE
.UR https://github.com/vv9k/roffman
GitHub
.UE

vv9k\*(Tm

which will look something like this:

roffman(7)                                         Miscellaneous Information Manual                                  roffman(7)

BASIC USAGE
       This is how you create a basic paragraph using roffman.

           This line should be slightly indented to the right.

       roffman-command This is the description of this command. It will be displayed right next to it

                       [--opt] some simple opt

                       [--opt-with-arg ARG] opt with an argument

                       [--bold]

       Example:

       impl Roffable for u8 {
           fn roff(&self) -> RoffText {
               self.to_string().roff()
           }
       }
       GitHub ⟨https://github.com/vv9k/roffman⟩

       vv9k™

                                                              August 2021                                             roffman(7)

License

MIT

You might also like...
Rust implementation of TARA archive format, used in Tanki Online.

Tanki Online archive format Rust implementation of .tara archive format, developed by Alternativa Platform, used in Tanki Online. License Licensed und

Maniplate `&'static str` (e.g., `concat!`, `format!`) in Rust without pain!

static_str_ops The static_str_ops crate solves a longstanding issue about how to perform non-const string operations, e.g., format!(), concat!(), etc.

Command-line tool to generate Rust code for Google Cloud Spanner

nene nene is a command-line tool to generate Rust code for Google Cloud Spanner. nene uses database schema to generate code by using Information Schem

Generate PHP code from Rust using a fluent API 🐘 🦀
Generate PHP code from Rust using a fluent API 🐘 🦀

PHP-Codegen Generate PHP code from Rust using a fluent API 🐘 🦀 Rust PHP Usage To bring this crate into your repository, either add php_codegen to yo

wait what? generate your entire infra from rust macros

infra as macro translate rust structs to terraform at compile time // your infra is a macro static DB: Postgres = Postgres16! { host: "env.host",

⚗️ Superfast CLI interface for the conventional commits commit format
⚗️ Superfast CLI interface for the conventional commits commit format

resin ⚗️ Superfast CLI interface for the conventional commits commit format ❓ What is resin? resin is a CLI (command-line interface) tool that makes i

⚗️ Superfast CLI interface for the conventional commits commit format
⚗️ Superfast CLI interface for the conventional commits commit format

resin ⚗️ Superfast CLI interface for the conventional commits commit format ❓ What is resin? resin is a CLI (command-line interface) tool that makes i

CLI tool that make it easier to perform multiple lighthouse runs towards a single target and output the result in a plotable format.

Lighthouse Aggregator CLI tool that make it easier to perform multiple lighthouse runs towards a single target and output the result in a "plotable" f

Single File Assets is a file storage format for images

SFA (Rust) Single File Assets is a file storage format for images. The packed images are not guaranteed to be of same format because the format while

Owner
Wojciech Kępka
Wojciech Kępka
Given a set of kmers (fasta format) and a set of sequences (fasta format), this tool will extract the sequences containing the kmers.

Kmer2sequences Description Given a set of kmers (fasta / fastq [.gz] format) and a set of sequences (fasta / fastq [.gz] format), this tool will extra

Pierre Peterlongo 22 Sep 16, 2023
Coffee is a loader for ELF (Executable and Linkable Format) object files written in Rust

Coffee is a loader for ELF (Executable and Linkable Format) object files written in Rust. It provides a mechanism to load and parse ELF files similar to COFFLoader, but specifically designed for ELF files used in Unix-like systems.

Sndav Bai 13 Jun 22, 2023
Generate HTML source files from rust functions!

Htmlificator This crate provides an element struct which can be displayed as HTML. License This crate is licensed under the MIT license Credit This cr

Isotoxal 2 Nov 7, 2022
CLI application to run clang-format on a set of files specified using globs in a JSON configuration file.

run_clang_format CLI application for running clang-format for an existing .clang-format file on a set of files, specified using globs in a .json confi

martin 6 Dec 16, 2022
My own image file format created for fun! Install the "hif_opener.exe" to open hif files. clone the repo and compile to make your own hif file

Why am i creating this? I wanted to create my own image format since I was 12 years old using Windows 7, tryna modify GTA San Andreas. That day, when

hiftie 3 Dec 17, 2023
Cargo-about - 📜 Cargo plugin to generate list of all licenses for a crate 🦀

?? cargo-about Cargo plugin for generating a license listing for all dependencies of a crate See the book ?? for in-depth documentation. Please Note:

Embark 281 Jan 1, 2023
This crate provides a set of functions to generate SQL statements for various PostgreSQL schema objects

This crate provides a set of functions to generate SQL statements for various PostgreSQL schema objects, such as tables, views, materialized views, functions, triggers, and indexes. The generated SQL statements can be useful for schema introspection, documentation, or migration purposes.

Tyr Chen 11 Apr 4, 2023
git-cliff can generate changelog files from the Git history by utilizing conventional commits as well as regex-powered custom parsers.⛰️

git-cliff can generate changelog files from the Git history by utilizing conventional commits as well as regex-powered custom parsers. The changelog template can be customized with a configuration file to match the desired format.

Orhun Parmaksız 5k Jan 9, 2023
A tool that allow you to run SQL-like query on local files instead of database files using the GitQL SDK.

FileQL - File Query Language FileQL is a tool that allow you to run SQL-like query on local files instead of database files using the GitQL SDK. Sampl

Amr Hesham 39 Mar 12, 2024
auto-rust is an experimental project that aims to automatically generate Rust code with LLM (Large Language Models) during compilation, utilizing procedural macros.

Auto Rust auto-rust is an experimental project that aims to automatically generate Rust code with LLM (Large Language Models) during compilation, util

Minsky 6 May 14, 2023