Add the ability to read type

This commit is contained in:
Greg Hellings
2025-02-25 19:49:02 -06:00
parent fc904b33b3
commit 945823370b
6 changed files with 71 additions and 13 deletions
+21 -12
View File
@@ -5,18 +5,27 @@ fn main() {
let mut mgr = Mgr::new_with_format(Format::HTMLHref);
for mod_name in mgr.get_modules() {
let mut module = mgr.get_module(&mod_name);
println!("Module: {}", module.get_name());
let random_number: i32 = rand::rng().random_range(1..=20);
let random_number_str = format!("John.3.{}", random_number);
module.set_key_text(&random_number_str);
module.set_skip_consecutive_links(true);
for i in 0..10 {
module.increment();
println!(
"Text John 3:{} is \"{}\"",
random_number + i,
module.render_text()
);
// module.get_type();
println!(
"Module: {} which is a {}",
module.get_name(),
module.get_type().get_name()
);
if module.get_type() == sword_rs::module::Type::BiblicalTexts {
let random_number: i32 = rand::rng().random_range(1..=20);
let random_number_str = format!("John.3.{}", random_number);
module.set_key_text(&random_number_str);
module.set_skip_consecutive_links(true);
for i in 0..10 {
println!(
"Text John 3:{} is \"{}\"",
random_number + i,
module.render_text()
);
module.increment();
}
} else {
println!("This is not a Bible");
}
println!("==============================");
}