summaryrefslogtreecommitdiffstats
path: root/src/poem/anthology
diff options
context:
space:
mode:
authorRory Dudley2024-04-04 22:12:14 -0600
committerRory Dudley2024-04-04 22:12:14 -0600
commit1415c8f9b89699000ef8d864ff8f0e1bebca4a5f (patch)
tree64093c0eded6a6f28105dbd743729b4075d32889 /src/poem/anthology
parentbadbba41476cd6fd424042c48681acde82227ba6 (diff)
downloaddwarvish-1415c8f9b89699000ef8d864ff8f0e1bebca4a5f.tar.gz
Handle aliases in read()
Instead of handling aliases in the recite() function, which requires two loops to handle properly with the current implementation, offload checking for aliases to the read() function.
Diffstat (limited to 'src/poem/anthology')
-rw-r--r--src/poem/anthology/alias.rs2
-rw-r--r--src/poem/anthology/source.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/poem/anthology/alias.rs b/src/poem/anthology/alias.rs
index 0183ec2..4c9b7b6 100644
--- a/src/poem/anthology/alias.rs
+++ b/src/poem/anthology/alias.rs
@@ -39,7 +39,7 @@ pub fn incant(verse: &Verse, out: &mut String, aliases: &mut HashMap<String, Str
}
if verse.couplet {
- *out = lines.join("\n");
+ *out = format!("{}\n", lines.join("\n"));
} else {
println!("{}", lines.join("\n"));
}
diff --git a/src/poem/anthology/source.rs b/src/poem/anthology/source.rs
index 77d1330..182fef4 100644
--- a/src/poem/anthology/source.rs
+++ b/src/poem/anthology/source.rs
@@ -34,7 +34,7 @@ pub fn incant(verse: &Verse, out: &mut String, env: &mut Environment) -> i32 {
}
};
- let poem = match Poem::read(poetry) {
+ let poem = match Poem::read(poetry, env) {
Ok(poem) => poem,
Err(e) => {
eprintln!("dwvsh: {}", e.to_string().to_lowercase());