Skip to content

Commit

Permalink
move hard-coded quran to a plain text file
Browse files Browse the repository at this point in the history
  • Loading branch information
alpancs committed Jan 30, 2024
1 parent 4da744d commit 09e51f1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 29 deletions.
11 changes: 3 additions & 8 deletions src/quran/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 =
Expand Down
19 changes: 8 additions & 11 deletions src/quran/simple_clean.rs → src/quran/quran-simple-clean.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#[cfg(test)]
pub(crate) const RAW_QURAN: &str = r#"
بسم الله الرحمن الرحيم
الحمد لله رب العالمين
الرحمن الرحيم
Expand Down Expand Up @@ -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/
#
#====================================================================
"#;
18 changes: 8 additions & 10 deletions src/quran/simple_plain.rs → src/quran/quran-simple-plain.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pub(crate) const RAW_QURAN: &str = r#"
بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ
الْحَمْدُ لِلَّهِ رَبِّ الْعَالَمِينَ
الرَّحْمَٰنِ الرَّحِيمِ
Expand Down Expand Up @@ -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/
#
#====================================================================
"#;

0 comments on commit 09e51f1

Please sign in to comment.