From 09e51f1bfc1656ba05093cf4abefe12b2e6ac9e0 Mon Sep 17 00:00:00 2001 From: Alfan Nur Fauzan Date: Tue, 30 Jan 2024 19:35:37 +0700 Subject: [PATCH] move hard-coded quran to a plain text file --- src/quran/mod.rs | 11 +++-------- ...simple_clean.rs => quran-simple-clean.txt} | 19 ++++++++----------- ...simple_plain.rs => quran-simple-plain.txt} | 18 ++++++++---------- 3 files changed, 19 insertions(+), 29 deletions(-) rename src/quran/{simple_clean.rs => quran-simple-clean.txt} (99%) rename src/quran/{simple_plain.rs => quran-simple-plain.txt} (99%) diff --git a/src/quran/mod.rs b/src/quran/mod.rs index 1edd412..b91814b 100644 --- a/src/quran/mod.rs +++ b/src/quran/mod.rs @@ -2,8 +2,7 @@ use std::{iter::Filter, str::Chars}; -mod simple_plain; -use simple_plain::RAW_QURAN as SIMPLE_PLAIN; +const SIMPLE_PLAIN: &str = include_str!("quran-simple-plain.txt"); const SURA_COUNT: usize = 114; const AYA_COUNT: usize = 6236; @@ -103,16 +102,12 @@ impl<'a> AyaGetter<'a> { } } -#[cfg(test)] -mod simple_clean; - -#[cfg(test)] -use simple_clean::RAW_QURAN as SIMPLE_CLEAN; - #[cfg(test)] mod tests { use super::*; + const SIMPLE_CLEAN: &str = include_str!("quran-simple-clean.txt"); + #[test] fn test_quran_version_compatibility() { let word_counter = diff --git a/src/quran/simple_clean.rs b/src/quran/quran-simple-clean.txt similarity index 99% rename from src/quran/simple_clean.rs rename to src/quran/quran-simple-clean.txt index 48791a3..7c71971 100644 --- a/src/quran/simple_clean.rs +++ b/src/quran/quran-simple-clean.txt @@ -1,5 +1,3 @@ -#[cfg(test)] -pub(crate) const RAW_QURAN: &str = r#" بسم الله الرحمن الرحيم الحمد لله رب العالمين الرحمن الرحيم @@ -6242,28 +6240,27 @@ pub(crate) const RAW_QURAN: &str = r#" #==================================================================== # # Tanzil Quran Text (Simple Clean, Version 1.1) -# Copyright (C) 2007-2023 Tanzil Project +# Copyright (C) 2007-2024 Tanzil Project # License: Creative Commons Attribution 3.0 # -# This copy of the Quran text is carefully produced, highly -# verified and continuously monitored by a group of specialists +# This copy of the Quran text is carefully produced, highly +# verified and continuously monitored by a group of specialists # at Tanzil Project. # # TERMS OF USE: # -# - Permission is granted to copy and distribute verbatim copies +# - Permission is granted to copy and distribute verbatim copies # of this text, but CHANGING IT IS NOT ALLOWED. # -# - This Quran text can be used in any website or application, -# provided that its source (Tanzil Project) is clearly indicated, +# - This Quran text can be used in any website or application, +# provided that its source (Tanzil Project) is clearly indicated, # and a link is made to tanzil.net to enable users to keep # track of changes. # -# - This copyright notice shall be included in all verbatim copies -# of the text, and shall be reproduced appropriately in all files +# - This copyright notice shall be included in all verbatim copies +# of the text, and shall be reproduced appropriately in all files # derived from or containing substantial portion of this text. # # Please check updates at: http://tanzil.net/updates/ # #==================================================================== -"#; diff --git a/src/quran/simple_plain.rs b/src/quran/quran-simple-plain.txt similarity index 99% rename from src/quran/simple_plain.rs rename to src/quran/quran-simple-plain.txt index cbb4e47..c53a9af 100644 --- a/src/quran/simple_plain.rs +++ b/src/quran/quran-simple-plain.txt @@ -1,4 +1,3 @@ -pub(crate) const RAW_QURAN: &str = r#" بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ الْحَمْدُ لِلَّهِ رَبِّ الْعَالَمِينَ الرَّحْمَٰنِ الرَّحِيمِ @@ -6241,28 +6240,27 @@ pub(crate) const RAW_QURAN: &str = r#" #==================================================================== # # Tanzil Quran Text (Simple Plain, Version 1.1) -# Copyright (C) 2007-2023 Tanzil Project +# Copyright (C) 2007-2024 Tanzil Project # License: Creative Commons Attribution 3.0 # -# This copy of the Quran text is carefully produced, highly -# verified and continuously monitored by a group of specialists +# This copy of the Quran text is carefully produced, highly +# verified and continuously monitored by a group of specialists # at Tanzil Project. # # TERMS OF USE: # -# - Permission is granted to copy and distribute verbatim copies +# - Permission is granted to copy and distribute verbatim copies # of this text, but CHANGING IT IS NOT ALLOWED. # -# - This Quran text can be used in any website or application, -# provided that its source (Tanzil Project) is clearly indicated, +# - This Quran text can be used in any website or application, +# provided that its source (Tanzil Project) is clearly indicated, # and a link is made to tanzil.net to enable users to keep # track of changes. # -# - This copyright notice shall be included in all verbatim copies -# of the text, and shall be reproduced appropriately in all files +# - This copyright notice shall be included in all verbatim copies +# of the text, and shall be reproduced appropriately in all files # derived from or containing substantial portion of this text. # # Please check updates at: http://tanzil.net/updates/ # #==================================================================== -"#;