~autumnull/flatiron

e6d324c401fc4e67ca2acde308393731f2f875fb — Autumn! 2 years ago 55942b5
Added simple executable
4 files changed, 19 insertions(+), 6 deletions(-)

M Cargo.toml
M README.textile
M src/main.rs
M tests/integrated.rs
M Cargo.toml => Cargo.toml +0 -1
@@ 5,7 5,6 @@ edition = "2021"

[profile.release]
opt-level = 'z'     # Optimize for size.
lto = true          # Enable Link Time Optimization
codegen-units = 1   # Reduce number of codegen units to increase optimizations.

[dependencies]

M README.textile => README.textile +6 -0
@@ 19,6 19,12 @@ __"It should do what it says on the iron!"__
* _Opinionated_ -- A flatiron that knows how to center images! How? don't ask me!
* _Better than that other guy's_ -- No wait you don't get it, the rust makes it _safer_ to use!

h2. Usage

The flatiron can be warmed on a stove pipe:

bc. $ cat sample.textile | flatiron

h2. Contributing

Find any "lice (bugs)":https://en.wikipedia.org/wiki/Clothes_iron#Hygiene ? I always appreciate "offers to fix up my flatiron":https://github.com/autumnull/flatiron/pulls !

M src/main.rs => src/main.rs +6 -3
@@ 1,9 1,12 @@
use flatiron::convert;
use std::fs;
use std::io::Read;

fn main() {
    let textile = fs::read_to_string("samples/textism.textile")
        .expect("Something went wrong while reading the file");
    let mut textile = String::new();
    let mut stdin = std::io::stdin();
    if let Err(_) = stdin.read_to_string(&mut textile) {
        eprintln!("Something went wrong while reading stdin.")
    }
    let html = convert(textile);
    print!("{}", html);
}

M tests/integrated.rs => tests/integrated.rs +7 -2
@@ 1,8 1,13 @@
use flatiron::convert;
use std::fs;

#[test]
fn sample() {
    let textile = String::from(include_str!("../samples/textism.textile"));
    let textile = fs::read_to_string("samples/textism.textile")
        .expect("Something went wrong while reading the textile file");
    let target_html = fs::read_to_string("samples/textism.html")
        .expect("Something went wrong while reading the HTML file");

    let html = convert(textile);
    assert_eq!(html, include_str!("../samples/textism.html"))
    assert_eq!(target_html, html)
}