From: Matt Corallo Date: Tue, 25 Apr 2023 20:20:13 +0000 (+0000) Subject: Handle use of `#[doc]` in the original source X-Git-Tag: v0.0.115.0^2~5 X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-c-bindings;a=commitdiff_plain;h=aab29c474f02e0b291d305db2a1cac35eff8af81 Handle use of `#[doc]` in the original source --- diff --git a/c-bindings-gen/src/blocks.rs b/c-bindings-gen/src/blocks.rs index 28f3002..e419fe0 100644 --- a/c-bindings-gen/src/blocks.rs +++ b/c-bindings-gen/src/blocks.rs @@ -442,7 +442,7 @@ fn writeln_docs_impl<'a, W: std::io::Write, I>(w: &mut W, attrs: &[syn::Attribut match token_iter.next().unwrap() { TokenTree::Literal(lit) => { // Drop the first and last chars from lit as they are always " - let doc = format!("{}", lit); + let doc = format!("{}", lit).trim().replace("\n", &format!("\n{}//!", prefix)); writeln!(w, "{}//!{}", prefix, &doc[1..doc.len() - 1]).unwrap(); }, _ => unimplemented!(), @@ -452,7 +452,7 @@ fn writeln_docs_impl<'a, W: std::io::Write, I>(w: &mut W, attrs: &[syn::Attribut match token_iter.next().unwrap() { TokenTree::Literal(lit) => { // Drop the first and last chars from lit as they are always " - let doc = format!("{}", lit); + let doc = format!("{}", lit).trim().replace("\n", &format!("\n{}///", prefix)); writeln!(w, "{}///{}", prefix, &doc[1..doc.len() - 1]).unwrap(); }, _ => unimplemented!(),