Crate r4d

source · []
Expand description

R4d(rad)

R4d is a text oriented macro processor that tries to solve inconveniences of well-known m4 macro processor.

R4d is provided as both binary and library. Binary includes all features of optional dependencies. Library doesn’t provide any features by default so you can set them manually.

Features

- evalexpr  : eval related macros
- chrono    : time related macros
- textwrap  : "wrap" macro
- cindex    : Query related macros
- full      : all features above

- debug     : Enable debug method
- color     : Enable color prompt
- hook      : Enable hook macro
- signature : Enable signature option

Simple usage

Binary

rad input_file.txt
printf '...text...' | rad -o out_file.txt

Library

use r4d::{Processor, RadResult};
use std::path::Path;

let mut processor = Processor::new()
    .purge(true)
    .write_to_file(Path::new("cache.txt"))
    .expect("Failed to open a file");

processor.process_file(Path::new("input.txt"))
    .expect("Failed to process file");
processor.print_result().expect("Failed to print result");

Detailed r4d usage is illustrated in github page or in Processor

Macros

Trim macro to trim a text

Structs

Builder struct for extension macros
Central macro logic processor

Enums

Authorization type
Comment type
Diffing behaviour
Hygiene variant
Types of a macros
R4d’s error type
Output that storage creates
Type variant or warning
State enum value about direction of processed text

Traits

Triat for storage interaction

Type Definitions

Genenric result type for every rad operations
Result alias for storage operation