summaryrefslogtreecommitdiffstats
path: root/src/poem/recite.rs
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/recite.rs
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/recite.rs')
-rw-r--r--src/poem/recite.rs25
1 files changed, 1 insertions, 24 deletions
diff --git a/src/poem/recite.rs b/src/poem/recite.rs
index 1f24d14..4038e37 100644
--- a/src/poem/recite.rs
+++ b/src/poem/recite.rs
@@ -4,7 +4,6 @@ use crate::compose::Environment;
use crate::path;
use crate::poem::anthology;
use crate::poem::elements::rune::Rune;
-use crate::poem::read::Readable;
use std::env;
use std::{
io,
@@ -26,30 +25,8 @@ impl Reciteable for Poem {
// Keep track of pids for background processes
let mut pids: Arc<Mutex<Vec<i32>>> = Arc::new(Mutex::new(Vec::new()));
- // Check for aliases
- let mut vv = Poem::new();
- for verse in self.iter() {
- let alias = match env.aliases.get(&verse.verb()) {
- Some(alias) => alias,
- None => {
- vv.push(verse.clone());
- continue;
- }
- }
- .to_string();
-
- let mut poem = Poem::read(alias).unwrap();
- let len = poem.len();
- for (i, new_verse) in poem.iter_mut().enumerate() {
- if verse.clause().is_some() && i + 1 == len {
- new_verse.stanza.append(&mut verse.clause().unwrap());
- }
- vv.push(new_verse.clone());
- }
- }
-
// Loop through each verse in the poem
- for verse in vv.iter() {
+ for verse in self.iter() {
// Verse may need to be mutable
let mut verse = verse.clone();