From 912f980baf908a4f579ca1d1c496c50a60e8a285 Mon Sep 17 00:00:00 2001 From: Dustin Knopoff Date: Sat, 15 Jun 2019 10:41:29 -0400 Subject: [PATCH] fixed issue where having descriptors would override parameters --- Cargo.toml | 2 +- src/docs.rs | 27 +++++++++++++++++++++++---- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index eea8895..a0bac22 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bashdoc" -version = "0.5.1" +version = "0.5.2" authors = ["Dustin Knopoff "] description = """ A tool for generating documentation/help menu for user defined bash functions. diff --git a/src/docs.rs b/src/docs.rs index 4494ca9..4def155 100644 --- a/src/docs.rs +++ b/src/docs.rs @@ -182,16 +182,16 @@ mod doc { take_until_and_consume!(delims.comm), take_until_and_consume!("\n") )) - >> desc: opt!(many0!(complete!(map_res!( + >> par: opt!(many0!(complete!(map_res!( preceded!( - take_until_and_consume!(delims.opt), + take_until_and_consume!(delims.params), take_until_and_consume!("\n") ), as_kv )))) - >> par: opt!(many0!(complete!(map_res!( + >> desc: opt!(many0!(complete!(map_res!( preceded!( - take_until_and_consume!(delims.params), + take_until_and_consume!(delims.opt), take_until_and_consume!("\n") ), as_kv @@ -663,4 +663,23 @@ mod tests { ); } } + + #[test] + fn param_and_input() { + let sample = "#\" + # mp() + # Convert from markdown to docx + # @param input: markdown file to convert + # - MSG: the message to pass + #; + "; + let delims = Delimiters::get_delims(); + let x = Extracted { + content: sample.into(), + position: Span::new(CompleteStr(sample)) + }; + + let val = generate_doc_file(&[x], Path::new("/example.txt"), delims); + println!("{:#?}", val); + } }