~gbmor/rustwtxt

9d8a7b7c2103e5ed0a1909a91c81b615238ea487 — Ben Morrison 1 year, 10 months ago 9c000cf 0.1.3
changed metadata parse section:
if both metadata heading and keyword aren't in the file, return err
3 files changed, 3 insertions(+), 3 deletions(-)

M Cargo.lock
M Cargo.toml
M src/parse.rs
M Cargo.lock => Cargo.lock +1 -1
@@ 109,7 109,7 @@ dependencies = [

[[package]]
name = "rustwtxt"
version = "0.1.1"
version = "0.1.2"
dependencies = [
 "http_req 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
 "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",

M Cargo.toml => Cargo.toml +1 -1
@@ 1,6 1,6 @@
[package]
name = "rustwtxt"
version = "0.1.2"
version = "0.1.3"
authors = ["Ben Morrison <ben@gbmor.dev>"]
edition = "2018"
description = "Library that makes working with twtxt.txt files easier."

M src/parse.rs => src/parse.rs +1 -1
@@ 18,7 18,7 @@ type StringErr<'a, T> = std::result::Result<T, &'a str>;
/// let out = parse::metadata(&twtxt, "nick");
/// ```
pub fn metadata<'a, 'b>(twtxt: &'a str, keyword: &'b str) -> StringErr<'a, &'a str> {
    if !twtxt.contains("== Metadata ==") || !twtxt.contains(keyword) {
    if !twtxt.contains("== Metadata ==") && !twtxt.contains(keyword) {
        return Err("File contains no metadata section, or the keyword is missing");
    }