Skip to content

Commit

Permalink
normalise the json
Browse files Browse the repository at this point in the history
  • Loading branch information
asim committed Dec 23, 2024
1 parent 3fb9590 commit dcda750
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 33 deletions.
14 changes: 7 additions & 7 deletions hadith/hadith.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ import (
var files embed.FS

type Volume struct {
Name string
Books []*Book
Name string `json:"name"`
Books []*Book `json:"books"`
}

type Book struct {
Name string
Hadiths []*Hadith
Name string `json:"name"`
Hadiths []*Hadith `json:"hadiths"`
}

type Hadith struct {
Info string
By string
Text string
Info string `json:"info"`
By string `json:"by"`
Text string `json:"text"`
}

type Volumes []*Volume
Expand Down
2 changes: 1 addition & 1 deletion html/files/hadith.json

Large diffs are not rendered by default.

34 changes: 24 additions & 10 deletions html/files/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,43 +52,57 @@
</div>
<div id="content"><h1 id="what-is-the-reminder">What is the Reminder?</h1>

<p>The Reminder refers to the messages and guidance revealed by Allah, primarily conveyed through the Quran. It serves as a warning and guidance for humanity, encouraging people to reflect upon their actions, remember Allah, and adhere to the teachings that lead to righteousness and faith.</p>
<p>The Reminder refers to the Quran and the messages it conveys, serving as guidance and a warning for humanity. It emphasizes reflections on faith, moral conduct, and remembrance of Allah&rsquo;s signs and teachings.</p>

<h1 id="what-is-the-quran">What is the Quran?</h1>

<p>The Quran is the holy book of Islam, believed by Muslims to be the word of Allah revealed to the Prophet Muhammad through the angel Gabriel. It serves as a guide for personal conduct, moral principles, and spiritual guidance, containing teachings on faith, law, and worship. The Quran is considered a literary masterpiece in Arabic and is recited in prayers and various aspects of daily life by Muslims.</p>
<p>The Quran is the holy book of Islam, believed to be the word of Allah (God) as revealed to the Prophet Muhammad through the Angel Gabriel. It serves as a guide for Muslims, containing teachings on faith, morality, worship, and law. The Quran is written in Arabic and consists of chapters (Surahs) and verses (Ayahs). It is regarded as a source of guidance, wisdom, and a reminder for humanity.</p>

<h1 id="what-is-the-hadith">What is the Hadith?</h1>

<p>A Hadith is a recorded statement, action, or approval of the Prophet Muhammad. It serves as a source of Islamic law and moral guidance, alongside the Quran, and is used to understand and interpret various aspects of Islam.</p>
<p>A Hadith is a recorded saying, action, or approval of the Prophet Muhammad (peace be upon him). It serves as a source of guidance for Muslims, complementing the teachings of the Quran. Each Hadith is typically accompanied by a chain of narrators (Isnad) that verifies its authenticity.</p>

<h1 id="who-is-allah">Who is Allah?</h1>

<p>Allah is the One and Only God, the Creator of all things. He is described as the Most Compassionate, Most Merciful, the Supreme Knower of the seen and unseen, and the Sustainer of everything. Allah is unique with no partners, and all authority belongs to Him. He is known for His beautiful attributes, and believers are encouraged to worship Him alone.</p>
<p>Allah is the one and only God in Islam, the Creator of all things, and the Sustainer of the universe. He is described as the All-Knowing, All-Wise, Most Compassionate, and Most Merciful. Allah is the source of guidance, and worship is directed solely to Him.</p>

<h1 id="who-is-the-prophet-muhammad">Who is the prophet Muhammad</h1>

<p>Prophet Muhammad is considered the final messenger of Allah in Islam. He was born in Mecca around 570 CE and is regarded as the &ldquo;Seal of the Prophets.&rdquo; He received revelations from Allah, which are compiled in the Quran. Known for his exemplary character, he preached monotheism and ethical conduct, establishing the foundations of Islam. His life and teachings have a profound influence on over a billion Muslims worldwide.</p>
<p>Prophet Muhammad is regarded as the last messenger of Allah in Islam. He was born in Mecca around 570 CE and received divine revelations that constitute the Quran, the holy book of Islam. He is known for his role in spreading the message of monotheism and establishing the foundations of Islamic teachings and practices. He is also referred to as Al-Mutawakkil, the Apostle, and has several other titles that signify his significance in guiding humanity.</p>

<h1 id="why-do-we-worship-allah">Why do we &lsquo;worship&rsquo; Allah?</h1>

<p>We worship Allah to acknowledge His greatness, express gratitude for His blessings, seek guidance, and fulfill our purpose as created beings. Worship helps cultivate a relationship with Him, aligning our lives with His will and attaining spiritual fulfillment.</p>
<p>We worship Allah because He is the Creator of all things, deserving of our devotion and gratitude. Worshipping Him acknowledges His sovereignty, power, and mercy, fostering a relationship of reverence, obedience, and thankfulness. It is through worship that we seek guidance, strength, and forgiveness, ultimately fulfilling our purpose as His creation.</p>

<h1 id="how-do-we-worship-allah">How do we &lsquo;worship&rsquo; Allah?</h1>

<p>Worshiping Allah involves sincere devotion, obedience, and various acts of worship, including prayer (Salah), fasting (Sawm), giving alms (Zakat), and performing good deeds. It is essential to worship Allah alone, without associating partners with Him, and to maintain a heartfelt connection through remembrance and gratitude. Observing the teachings of the Quran and the example of the Prophet Muhammad also guides worship practices.</p>
<p>Worshiping Allah involves sincere devotion, which can include prayer, reading the Quran, performing acts of charity, fasting, and following His guidance as outlined in Islamic teachings. It also means recognizing His oneness, avoiding associations with Him, and living a life that reflects gratitude and obedience to His commandments. Regular prayers, acts of kindness, and mindfulness of His presence in daily life are also essential aspects of worship.</p>

<h1 id="what-happens-when-we-die">What happens when we die?</h1>

<p>When we die, our souls are taken by the Angel of Death, and we face a transition to the afterlife. After death, we are believed to be resurrected for judgment, where our deeds are evaluated, resulting in either paradise or punishment. The process includes experiences in the grave and a final resurrection on the Day of Judgment. Ultimately, every soul will return to Allah for judgment based on their actions in life.</p>
<p>When we die, our souls are taken by the Angel of Death, and we are returned to Allah for judgment. The body is buried, and our deeds remain with us. After death, we will experience a kind of awareness regarding our place in the Hereafter, either in Paradise or Hell, based on our actions in this life. On the Day of Resurrection, we will be resurrected for final judgment.</p>

<h1 id="how-do-i-remember-allah">How do I remember Allah?</h1>

<p>You can remember Allah by engaging in regular prayers, reciting Quranic verses, making supplications (duas), and reflecting on His attributes and creations. Engaging in meditation on His favours, being mindful in your daily activities, and dedicating moments of your day to remembrance (dhikr) also help. It&rsquo;s important to keep a sincere heart and be consistent in your efforts.</p>
<p>You can remember Allah by engaging in regular prayers, reciting the Quran, reflecting on His creation, and practicing gratitude for His blessings. Additionally, you can invoke His names, engage in dhikr (remembrance of Allah), and be mindful of His presence in your daily life.</p>

<h1 id="how-do-i-become-muslim">How do I become Muslim?</h1>

<p>To become Muslim, you need to sincerely declare the Shahada, which is the testimony of faith. This involves saying, &ldquo;Ashhadu an la ilaha illallah wahdahu la sharika lahu, wa Ashhadu anna Muhammadur rasoolullah,&rdquo; which translates to, &ldquo;I bear witness that there is no god but Allah, and Muhammad is His Messenger.&rdquo; It is also recommended to perform a ritual purification (ghusl) and start learning about the teachings and practices of Islam, including prayer, fasting, and charity. Consider seeking guidance from a local Muslim community or an imam for support.</p>
<p>To become a Muslim, you need to do the following:</p>

<ol>
<li><p><strong>Shahada</strong>: Recite the declaration of faith, known as the Shahada, which states: &ldquo;Ashhadu an la ilaha illallah, wa ashhadu anna Muhammadur rasulullah.&rdquo; (I bear witness that there is no god but Allah, and Muhammad is His messenger.)</p></li>

<li><p><strong>Intention</strong>: Have a sincere intention in your heart to embrace Islam and worship only Allah.</p></li>

<li><p><strong>Knowledge</strong>: Learn about the fundamental beliefs and practices of Islam, including the Five Pillars: belief in one God (Allah), prayer (Salah), giving alms (Zakat), fasting during Ramadan, and pilgrimage to Mecca (Hajj) if able.</p></li>

<li><p><strong>Community</strong>: It can be beneficial to join a local mosque or community of Muslims to seek guidance, support, and further understanding of the faith.</p></li>

<li><p><strong>Practice</strong>: Start practicing Islam by performing the five daily prayers and living according to Islamic values and teachings.</p></li>
</ol>

<p>Once you have taken these steps, you are considered a Muslim.</p>
</div>
</div>
</body>
Expand Down
2 changes: 1 addition & 1 deletion html/files/names.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion html/files/quran.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion html/html.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function expand(el) {
}
function reference(el) {
return "<div>Text: " + el.Text + "<br>Metadata: " + JSON.stringify(el.Metadata) + "<br>Score: " + el.Score + "</div>";
return "<div>Text: " + el.text + "<br>Metadata: " + JSON.stringify(el.metadata) + "<br>Score: " + el.score + "</div>";
}
document.addEventListener('DOMContentLoaded', function(){
Expand Down
5 changes: 5 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,11 @@ func main() {
var contexts []string

for _, r := range res {
for k, v := range r.Metadata {
delete(r.Metadata, k)
r.Metadata[strings.ToLower(k)] = v
}

b, _ := json.Marshal(r)
// TODO: maybe just provide text
contexts = append(contexts, string(b))
Expand Down
10 changes: 5 additions & 5 deletions names/names.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import (
var files embed.FS

type Name struct {
Number int
English string
Arabic string
Meaning string
Description string
Number int `json:"number"`
English string `json:"english"`
Arabic string `json:"arabic"`
Meaning string `json:"meaning"`
Description string `json:"description"`
}

type Names []*Name
Expand Down
14 changes: 7 additions & 7 deletions quran/quran.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ import (
var files embed.FS

type Chapter struct {
Name string
Number int
Verses []*Verse
Name string `json:"name"`
Number int `json:"number"`
Verses []*Verse `json:"verses"`
}

type Verse struct {
Number int
Text string
Arabic string
Number int `json:"number"`
Text string `json:"text"`
Arabic string `json:"arabic"`
}

type Quran struct {
Chapters []*Chapter
Chapters []*Chapter `json:"chapters"`
}

func (q *Quran) JSON() []byte {
Expand Down

0 comments on commit dcda750

Please sign in to comment.