mod custom_options;
mod generated;
mod schema;
#[allow(clippy::module_inception)]
mod script_data;
mod script_list;
use alloc::string::String;
use alloc::vec::Vec;
pub use custom_options::*;
pub use schema::*;
pub use script_list::*;
use crate::scripts::Script;
pub fn get_all_options(from_script: Script, to_script: Script) -> Vec<String> {
let from_script_data = ScriptData::get_script_data(&from_script.into());
let to_script_data = ScriptData::get_script_data(&to_script.into());
let custom_options_map = get_custom_options_map();
let all_options_enabled = crate::CustomOptions::all_enabled();
let active_options = crate::transliterate::transliterate::get_active_custom_options(
from_script_data,
to_script_data,
Some(&all_options_enabled),
);
let mut ordered: Vec<String> = Vec::new();
for key in custom_options_map.keys() {
if active_options.get(key.as_str()).unwrap_or(false) {
ordered.push(key.clone());
}
}
ordered
}
#[cfg(test)]
mod tests {
use super::*;
use crate::scripts::Script;
use std::str::FromStr;
#[test]
fn test_get_all_option_valid_scripts() {
let _ = get_all_options(Script::Devanagari, Script::Telugu);
}
#[test]
fn test_get_all_option_normalized_names() {
let from = Script::from_str("dev").unwrap().into();
let to = Script::from_str("tel").unwrap().into();
let _ = get_all_options(from, to);
}
}