summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Huss <eric@huss.org>2020-11-10 14:06:09 -0800
committerGitHub <noreply@github.com>2020-11-10 14:06:09 -0800
commit58f66a146ddb964763fe94277531cfe6c1ed9fe7 (patch)
tree2510c8d125d9c47ab34e69a4ba4c3889dfa31c88 /src
parent643d5ecc5c080061ae19da4374044561a484aef3 (diff)
parent1450070f7377910af4a80374858e3436b7e14059 (diff)
Merge pull request #1375 from dtolnay/playground
Fix stray spacing after #playground code
Diffstat (limited to 'src')
-rw-r--r--src/preprocess/links.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/preprocess/links.rs b/src/preprocess/links.rs
index 8cd95824..0e2eefbc 100644
--- a/src/preprocess/links.rs
+++ b/src/preprocess/links.rs
@@ -335,7 +335,7 @@ impl<'a> Link<'a> {
LinkType::Playground(ref pat, ref attrs) => {
let target = base.join(pat);
- let contents = fs::read_to_string(&target).with_context(|| {
+ let mut contents = fs::read_to_string(&target).with_context(|| {
format!(
"Could not read file for link {} ({})",
self.link_text,
@@ -343,8 +343,11 @@ impl<'a> Link<'a> {
)
})?;
let ftype = if !attrs.is_empty() { "rust," } else { "rust" };
+ if !contents.ends_with('\n') {
+ contents.push('\n');
+ }
Ok(format!(
- "```{}{}\n{}\n```\n",
+ "```{}{}\n{}```\n",
ftype,
attrs.join(","),
contents