summaryrefslogtreecommitdiffstats
path: root/build.rs
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2018-11-06 06:57:16 -0500
committerAndrew Gallant <jamslam@gmail.com>2018-11-06 06:57:16 -0500
commitb41e5963279d5a7c633514d4a6afcb480c6c6915 (patch)
tree9c344801b0832147c6468496066a3e9904f0b6c9 /build.rs
parentfb622666206089cf7092ae116612898ac358c91c (diff)
doc: escape braces in AsciiDoc
This commit fixes a bug where AsciiDoc would drop any line containing a '{foo}' because it interpreted it as an undefined attribute reference: > Simple attribute references take the form {<name>}. If the attribute name > is defined its text value is substituted otherwise the line containing the > reference is dropped from the output. See: https://www.methods.co.nz/asciidoc/chunked/ch30.html We fix this by simply replacing all occurrences of '{' and '}' with their escaped forms: '&#123;' and '&#125;'. Fixes #1101
Diffstat (limited to 'build.rs')
-rw-r--r--build.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/build.rs b/build.rs
index b7f26f17..7f92f3c2 100644
--- a/build.rs
+++ b/build.rs
@@ -168,7 +168,12 @@ fn formatted_arg(arg: &RGArg) -> io::Result<String> {
}
fn formatted_doc_txt(arg: &RGArg) -> io::Result<String> {
- let paragraphs: Vec<&str> = arg.doc_long.split("\n\n").collect();
+ let paragraphs: Vec<String> = arg.doc_long
+ .replace("{", "&#123;")
+ .replace("}", r"&#125;")
+ .split("\n\n")
+ .map(|s| s.to_string())
+ .collect();
if paragraphs.is_empty() {
return Err(ioerr(format!("missing docs for --{}", arg.name)));
}