Merge branch 'master' into menu

This commit is contained in:
Benjamin A. Shelton 2026-08-20 17:20:09 -06:00
commit b6f6845235
Signed by: zancarius
GPG key ID: 8BD42DBD6C337E01
18 changed files with 2949 additions and 1616 deletions

View file

@ -6,7 +6,7 @@ import Icon from '../assets/circle-half.svg';
<ul>
<li>&copy; 2026 <a href="https://bashelton.com/">Benjamin A. Shelton</a></li>
<li>Some rights reserved.</li>
<li>Revised § <a href="https://git.destrealm.org/zancarius/sundays">July 2026</a></li>
<li>Revised § <a href="https://git.destrealm.org/zancarius/sundays">August 2026</a></li>
<li><button data-toggle-theme><Icon /></button></li>
</ul>
</footer>

View file

@ -0,0 +1,8 @@
---
const { title, image } = Astro.props;
---
{title && <meta property="og:title" content={title} />}
{image && <meta property="og:image" content=`https://bashelton.com${image}` />}
<meta property="og:description" content="Just Us Class Notes and Resources" />
<meta property="og:url" content="https://bashelton.com/sundays" />
<meta property="og:type" content="website" />

View file

@ -2,10 +2,11 @@
//import "../global.css";
import Header from "../components/Header.astro";
import Footer from "../components/Footer.astro";
import Meta from "../components/Meta.astro";
import { urlfrag } from "../utils/path.js";
const { title } = Astro.props;
const { title, image } = Astro.props;
const base = import.meta.env.BASE_URL;
---
@ -15,6 +16,7 @@ const base = import.meta.env.BASE_URL;
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#28303c" />
<Meta title={title} image={image} />
<link rel="icon" type="image/svg+xml" href={urlfrag(base, 'favicon.svg')} />
<link rel="icon" href={urlfrag(base, 'favicon.png')} />
<title>{title}</title>

View file

@ -0,0 +1,108 @@
---
date: "2026-08-09"
title: "Matthew 13:53-58; Luke 4:16-30; Psalm 69:4"
meta_description: "Matthew 13:53-58; Luke 4:16-30; Psalm 69:4"
sub_heading: "Jesus Rejected at Nazareth"
scripture_category: gospels
post_image: "/images/headers/jesus-rejected-at-nazareth.jpg"
types: ["long-form"]
book: matthew
chapter: 13
chapters: 13
verses: [{"matthew": ["13:53-58"]}, {"luke": ["4:16-30"]}, {"psalms": ["69:4"]}]
tags:
- notes
- matthew
---
## Lesson
Today's lesson concludes [Matthew 13](:scripture) and the growth of Jesus' discipleship ministry. Although this section is comparatively short, it contains deep theology and looks forward to Christ's rejection culminating in the cross.
And, ultimately, it serves as a prototype of his continued rejection today by the world. We must take heart--for the world hated Jesus before it hated us.
## Contents
## The Rejection at Nazareth ([Matthew 13:53-58](:scripture))
[“Only in his hometown and in his own household is a prophet without honor.”](:jesus)
If there was a single outcome of import among all others for the Old Testament prophets and their God-given vocation it was to be rejected by the house of Israel. Being called as a prophet for the Lord was thankless, unglamorous, and usually lead to rejection and, at times, even death. Jesus’ self-comparison to the prophets of old was no accident.
The Lukan account ([Luke 4:16-30](:scripture)) contains markedly more detail and dialogue, which we will discuss in a following section, but for now we’ll focus on Matthew’s account.
The purpose for Jesus' visit back to Nazareth at this point in the narrative is unclear. The ESV:SB speculates that he may have returned on request by his “mother and brothers,”<sup><a href="#source-1">1(p.1850)</a></sup> but this is speculative. Further, the Matthean narrative does not explicitly call out Nazareth as the town Jesus traveled to, which itself would imply that *patris* (*homeland* or *hometown*) is subject to interpretation on context and heritage, but this would also require ignorance of the parallel passages starting with [Luke 4:16](:scripture). Rather, this short paragraph in Matthew gives us a brief insight into the broader situation Jesus was walking into.
In [vv 55](:scripture=matt+13:55), we have indirect confirmation that Jesus did, in fact, return to Nazareth by way of the crowds’ remarks, “Isn’t this the carpenter’s son?”
Were this not a town already familiar with Jesus, it is doubtful they would have expressed astonishment in [vv 54](:scripture=matt+13:54) followed by a rhetorical question--presumably framing their surprise as a matter of disgust and derision (confirmed in [vv 57](:scripture=matt+13:57)) (["[a]nd they took offense at him"](:quote)).
If we rope in the Markan account ([Mark 6:1-6](:scripture)) we also see *patris* used in this context for Jesus’ hometown, but if we include the broader contextual agreement from his activity in [Mark 5:1-20](:scripture), we begin to paint a geographical picture that strongly points to his presence in Nazareth.
All of this operates independently of the Lukan narrative to provide a harmony of the gospel accounts, but establishing a purpose for Jesus' visit beyond speculation is much more interesting.
Luke writes “[Then Jesus came to Nazareth, where he had been brought up. *As was his custom*, he entered the synagogue on the Sabbath](:quote),” ([Luke 4:16](:scripture)) which strongly points to Jesus' reputation as one who was often found in the synagogues preaching and teaching. Since this is the purpose best supported by scripture here and in other accounts, the speculation raised by some scholars that he was there on account of his mother’s or brothers’ request(s) seems unlikely. It is instead far *more* likely Jesus had returned to his hometown for two reasons: The first is to preach and teach in the synagogue, as he did everywhere he went; the second was necessity. His rejection to fulfill messianic prophecy *was required*.
Rejection in Nazareth set the stage as a prototype for Jesus' path to the cross, and it also served to illustrate what is perhaps the most important takeaway in the Matthean account. This is recorded in the very last verse of [Matthew 13](:scripture) where Matthew writes ([vv 58](:scripture=matt+13:58)), “[[a]nd he did not do many miracles there, because of their unbelief.](:quote)”
The hard-heartedness of Jesus’ audience provides a timeless lesson for us today: Jesus was not going to impose his miraculous works upon those who were (and are) actively hostile toward him and his message. For us, we may witness the same in our own ministry--the Holy Spirit may withhold miracles of all sorts, including removing barriers to belief, if the audience is actively hostile.<sup><a href="#source-1">1(p.1850)</a></sup> Suffice to say, **the worst judgment God can impose on an unbelieving people is to leave them to their own devices.**
In my own experiences, I’m reminded of a family friend who had spent his entirely life rejecting God and God's people. His heart was hard, and he made light of faith as if it were a joke. Belief wasn’t something serious, and neither was the circumstance of his soul in the hereafter. He simply didn’t care.
The paradox was this friend's kindness. He was the sort of man who would give you the shirt off his back. He was filled with abundant kindness and generosity. But kindness doesn't earn a salvation that can only be received and not earned. The gift of kindness isn't from us in the first place, because all good things originate from the Lord ([James 1:17](:scripture)).
The Lord can soften unbelievers' hearts, but there are times when he does not. Just as Jesus refused to perform many miracles in Nazareth, so too might the Father withhold his call. God’s purpose for this may be difficult--if not impossible--for us to understand, but we must accept that it is His will, not ours, that guides all things. We must cling to hope that those we care about will be saved. Simultaneously, we must also accept that God may not have chosen them to be saved ([Matthew 11:27](:scripture), [Luke 10:22](:scripture), [John 6:44](:scripture)).
### Textual Analysis
[Matthew 13:55](:scripture) is one of the more contentious passages between protestants and Catholics for its mention of Jesus’ brothers. As one of the most direct and obvious passages of Jesus’ family composition, the Catholic Church has rejected this interpretation in order to maintain Mary’s perpetual virginity. Yet, one of the most holy things a woman can do in the sight of the Lord (and one that is impossible for a man) is to bear children.<sup><a href="#source-1">1(p.1850)</a></sup>
The textual question reduces to the use of *adelphos* (*adelphoi* in the manuscript as a *masculine plural* form) and its *probable* meaning as male relatives. However, the usage here in [Matthew 13:55](:scripture) is similar to others in the text where the relatives in question are immediate family members and the word is a clear reference to brothers (or sisters; sometimes both). There are circumstances (e.g. [Matthew 12:46](:scripture)) where its usage is ambiguous, but the Koine Greek we have available presents a picture that is mostly unanimous in its use of *adelphos* as brothers (or sisters) descending from the same parents.<sup><a href="#source-3">3(p.18)</a></sup> Given nature of the questions Jesus was asked, it is reasonable to conclude that they were speaking specifically of Jesus’ biological brothers. These were individuals known to the people of Nazareth and were unlikely to be cousins or uncles.
The premise that *adelphos* cannot refer to biological siblings centers on passages like [Galatians 1:11](:scripture) where Paul uses the word as a salutation, but this use rather ironically appears within close proximity to [Galatians 1:19](:scripture) where Paul is speaking of Jesus' brother James.
Doubtless the argument consists of *adelphos* representing a *disciple* of Christ, but the specific verbal construct is indicative of a male relative. Jesus had siblings.
### Parallel Account of the Rejection at Nazareth ([Luke 4:16-30](:scripture))
The parallel account of Jesus’ rejection at Nazareth as it appears in Luke contains more detail and substantially more background insights into Jesus’ activities.
First, Luke writes that it was “his custom” to attend synagogue and read. “Custom” in this context conveys the idea of something one is accustomed to or partakes of as a tradition. Luke therefore shows us that this activity was a regular one for Christ.
As we continue through the dialog between Jesus and the people assembled, we find them first in amazement at his gracious words in [vv 22](:scripture=luke+4:22) only to be filled with wrath by [vv 28](:scripture=luke+4:28). Jesus reminded the crowds of Israel's past rejection of YHWH. In each case, YHWH's response was instead to send away the prophets to those who would receive them--Gentiles in this case. This exchange infuriated the Jews for it served as a reminder of their past insolence, but one has to marvel at Jesus’ directness. He had informed them, specifically, that they would reject him, and his kingdom would then pass along to the Gentiles. Still, their efforts to kill him further foreshadows his work on the cross.
## Matthew 13 Conclusion
There are different ways to logically divide the book of Matthew. Michael Green in *The Message of Matthew* points to [chapter 13](:scripture=matthew+13) as an inflection point in Matthew’s gospel, closing the end of Jesus’ ministry of discipleship, and looking forward toward Jerusalem. Other analysts agree, while some point to [chapter 16](:scripture=matt+16) where Peter confesses the Christ.
It is true that many central features of the narrative change following [Matthew 13](:scripture), and general tone of the narrative shifts toward an urgency that culminates in the cross. We will begin the next chapter by taking a look at the death of John the Baptist and will explore the historical parallel it provides to Jesus’ ministry in Nazareth.
The roadmap I have in mind as we continue our course through Matthew is to treat [chapter 16](:scripture=matt+16) as the inflection point instead, toward which we witness the revelation of Jesus’ identity through Peter. Prior to this chapter, we observed numerous other miracles Jesus performed, which we’ll bear witness to again. Likewise, as in [chapter 12](:scripture=matt+12), the Pharisees and Sadducees again demand Jesus supply signs from heaven. For the most part, outside his ministry of discipleship coming to a close with [chapter 13](:scripture=matt+13), [chapters 14](:scripture=matt+14) through [16:12](:scripture=matt+16:12) follow much the same as those that came prior--with discourses, miracles, admonishing the Jewish authorities for their lack of faith and understanding, and a nod toward the inclusion of the Gentiles ([Matthew 15:21-28](:scripture)). These chapters act as a brief interlude, reflecting on what came before, and looking forward to his final discourses, parables, betrayal, arrest, and crucifixion. Many of the chapters ahead are focused on further discourse but at their core they reveal the heart Jesus had for those he came to save, how **we** are to act as children of God, and the culmination of Christ’s work during his ministry.
It would be worthwhile to offer up time to the Lord after our eight month journey with a prayer of thanksgiving.
## Epilogue ([Psalm 69:4](:scripture))
Jesus’ rejection centers on the world’s hatred of the perfect man who knew no sin. Rejection of Christ therefore is a consequence of that sin.
Following the conclusion of [Matthew 13](:scripture), it is appropriate to reflect on a key passage in [Psalm 69](:scripture). In this Psalm, the writer expresses lament for his suffering (and wrongdoing). As with a handful of the Psalms, it is not clear whether this Psalm was written by David or whether it was dedicated to David. In the Hebrew, the preposition “*leh*” can mean “‘*to*,’ ‘*for*,’ ‘*by*,’ or ‘*about*,’”<sup><a href="#source-4">4</a></sup> which introduces the ambiguity of its precise authorship. Regardless, we know well David was a man of immense suffering, and whether this Psalm was written *by* him or *for* him is inconsequential; David was hardly bashful to bring his suffering before the Lord.
The New Testament authors make use of this Psalm to describe the life of Christ<sup><a href="#source-1">1(p.1019)</a></sup>. In [John 15:25](:scripture) Jesus himself cites [Psalm 69:4](:scripture), for he was hated without cause. We glean slightly more purpose behind the verb *hate* by examining the Hebrew *sonea* (שׂנא), which can run the gamut of *to hate*, *to scorn*, or *to treat as an enemy*. In the specific verbalization here, *sonea* is used to mean *to hate* but the context is suggestive that *scorn* or *an enemy* could also be in view given that the word “destroy” (*matsmitha*) **specifically** is used as *to exterminate* or *to annihilate*. Jesus’ use of *this* particularly passage in *this* particular Psalm demonstrates strong awareness of his adversaries’ desires. Looking back to [Matthew 12:14](:scripture), we note that the Greek we translate as "*to kill*" may also mean *to destroy*.
In a messianic context, the phrasing “[they make me repay what I did not steal](:quote)” is of particular interest. Jesus paid, in full, the total cost of our sins though he was not the one who committed the crime. The force of this passage in the Psalms is easily connected to the cross. Jesus stood accused, beaten, and executed (therefore “paying in full”) the price for the *robbery* of sin.
As modern believers, this passage captures well what we face. Those who hate the Lord [outnumber the hairs](:quote) on our heads, and many would seek to crucify him again. We face violent opposition--though we are mostly insulated from this in the West--where our adversaries seek our destruction.
But, we may rest assured that **Christ paid everything in full**. Repent and believe.
## Sources
1. <a class="source" name="source-1">Crossway Bibles, The ESV Study Bible (Wheaton, IL: Crossway Bibles, 2008); 1019, 1850.</a>
2. <a class="source" name="source-2">Craig A. Evans, The Bible Knowledge Background Commentary: Matthew–Luke, ed. Craig A. Evans and Craig A. Bubeck, First Edition (Colorado Springs, CO: David C Cook, 2003), 284.</a>
3. <a class="source" name="source-3">William Arndt et al., A Greek-English Lexicon of the New Testament and Other Early Christian Literature (Chicago: University of Chicago Press, 2000), 18.</a>
4. <a class="source" name="source-4">John D. Barry et al., Faithlife Study Bible (Bellingham, WA: Lexham Press, 2012, 2016), Ps 3:title.</a>
5. <a class="source" name="source-5">Francis Brown, Samuel Rolles Driver, and Charles Augustus Briggs, Enhanced Brown-Driver-Briggs Hebrew and English Lexicon (Oxford: Clarendon Press, 1977), 856.</a>
## Copyright and License
Copyright &copy; Benjamin A. Shelton. Page contents licensed under [Creative Commons BY-ND 4.0](https://creativecommons.org/licenses/by-nd/4.0/). Other pages may be licensed under different terms.

View file

@ -0,0 +1,81 @@
---
date: "2026-08-16"
title: "Matthew 14:1-12"
meta_description: "Matthew 14:1-12"
sub_heading: "The Death of John the Baptist"
scripture_category: gospels
post_image: "/images/headers/death-of-john-the-baptist.jpg"
types: ["long-form"]
book: matthew
chapter: 14
chapters: 14
verses: [{"matthew": ["3:1-2", "14:1-12"], "psalm": ["29:5"]}]
tags:
- notes
- matthew
---
## Contents
## The Death of John the Baptist
### Revisiting John's *Preparing the Way* ([Matthew 3:1-6](:scripture), [11-12](:scripture=matt+3:11-12))
In Matthew's gospel, we read of John the Baptist first in [chapter 3](:scripture=matt+3). Here, he is described as something of a "wild man"--eating locusts and honey, dressed in camel skins--and one who is on the periphery of society ([Matthew 3:4](:scripture)). And yet, despite this, people from Jerusalem, Judea, and everywhere around the Jordan was coming to him to be baptised ([Matthew 3:5-6](:scripture)). For some, John's unusual characteristics--his dress and his diet--served as an attraction. For others, it may have been curiosity surrounding his message. Many, however, came to be baptised "for repentance" when they heard his pronouncement of the coming kingdom.
John describes his purpose well in [Matthew 3:11-12](:scripture) and who is to come after him.
We are most interested in the quote from [Malachi 3:1](:scripture) cited here in [Matthew 3:3](:scripture) and again in [Mark 1:2](:scripture). John's ministry, and his life, foreshadows Jesus'.
In particular, we should approach Matthew's case as an apologetic work. Matthew's audience was primarily Jewish and was familiar with Messianic prophecy and had certain expectations of who the Messiah would be and what he would accomplish. Matthew's case, then, is to appeal and an apologist for making a case that Christ is the Messiah they sought after. Every verse and every word is used, by Matthew, to link prophecy with Christ. Rather ironically, even the record Matthew shares in his account of Herod Antipas' words point rather crucially to the shared fate of John and Jesus.
The Matthean narrative is brilliant in its construction and design.
### The Beheading of John ([Matthew 14:1-12](:scripture))
As we begin the next chapter of Matthew, we encounter two literary devices used by Matthew that separate this chapter across time. In the first, Matthew writes "At that time Herod the tetrarch heard the reports about Jesus," which follows the conclusion of Jesus' time in Nazareth. This specific phrasing leads us to understand that Herod's assessment of Jesus as the resurrected John occurred some time during the portion of the narrative documented in [Matthew 13](:scripture). This provides an important backdrop for later in the narrative when Jesus is questioned by Herod. In the second case, Matthew utilizes a flashback from [vv 3-12](:scripture) detailing the events of John's execution following the latter's last question dispatched from prison in [Matthew 11](:scripture).
Though the Matthean account doesn't include the speculation by others in Herod's orbit, Mark and Luke document what may have been a dispute within his counsel regarding Jesus' identity. "Others" (whomever they were, possibly his counsel, and certainly many across Palestine) believed Jesus to be Elijah. Though Matthew lacks this detail, it is likely because his audience--being Jewish--was well-acquainted with this messianic expectation.
In any event, whatever those around Herod believed, they were not in agreement with the tetrarch. Herod himself believed Jesus to be John the Baptist, raised from the dead. Herod's beliefs were rooted in a mix of of superstition and pagan influence. Likely, he also suffered a degree of paranoia from the events that would follow in the narrative.
Herod Antipas had divorced his previous wife, the daughter of the Nabatean king, Aretas IV, and married Herodias, the wife of Herod Philip I.<sup><a href="#source-1">1</a></sup> It was unlawful to marry the wife of one's brother, according to Levitical Law ([Leviticus 18:16](:scripture), [20:21](:scripture)). John publicly and repeatedly admonished Antipas for his infraction, and in response, Antipas had him imprisoned ([Luke 3:18-20](:scripture)) in his fortress-palace.
Interestingly, Herod's fear of Jesus as the resurrected John in [vv 2](:scripture) was incorrect but it wasn't entirely unfounded. Though misinformed, Herod rather ironically foreshadows Jesus' own resurrection following his crucifixion, and the resurrection of the saints at the end of the age.
Herod's brutality wasn't unexpected. His father, after all, was the one who ordered the slaughter of the children of Bethlehem, recorded in [Matthew 2:16](:scripture). Antipas was a product of generational violence and worldly affairs (evidenced by his divorce and marrying his brother's wife, among other things). What reined in his rage, at least initially, was his fear of John's followers in [vv 5](:scripture). Antipas knew he would face potential rebellion and unrest if he had John executed.<sup><a href="#source-2">2</a></sup>
It was a fear he would face on his birthday.
By [vv 6-10](:scripture), we learn that Herodias' daughter Salome had danced before the assembled crowd and "pleased" Herod. He promised her anything she might ask and gave his oath before the guests who were reclining at table with him. On behalf of her mother, Salome requests John's head, and Herod became greatly distressed--he now had to face angering John's followers.
One might be curious why Herod was "pleased" sufficiently to make so great an offer to a girl who was probably between the ages of 12-14. As it turns out, the Greek (*ēresen* in the manuscripts) in this context, conveys "pleased" in the sense "of pleasure." The word doesn't always differentiate between the effort to please another party or the impact of the pleasure it produces, but it's clear that the lexical scope of *areskō* is highly suggestive of something that is *sensually pleasing*.<sup><a href="#source-3">3</a></sup>
It isn't *directly* spelled out in the text of Matthew, not when translated, but the Greek is clear: Herod's birthday celebration was a debased celebration, and Salome was exploited by her mother to manipulate Herod into committing an act that he had previously entertained but was too fearful to commit.
The lesson taught to us by [vv 9-12](:scripture) is of import.
### Lesson Learned
In [vv 9](:scripture), we find that Herod is greatly distressed by Salome's request. Primarily, this is because he feared the crowds ([vv 5](:scripture)) and the potential for an uprising against him by John's followers.<sup><a href="#source-2">2</a></sup> However, this exchange also teachers an important lesson: Be careful what you promise. Or, more idiomatically appropriate for our culture today, never make a promise you're unwilling to keep.
John had exhorted, repeatedly, Herod's marriage to Herodias as unlawful ([Lev 18:16](:scripture), [20:21](:scripture)), and we know that Herod was stirred to anger by this **very** public embarrassment. It is certainly possible that he and Herodias had discussed John's execution. Whether Herod's thinking was entirely of his own volition or influenced by his wife isn't established by the text. We know he wanted to kill John, and we know that Herodias had devised the means to do so.
Though we can speculate, as above, what actions happened behind the scenes and under the veneer of the text, such speculation is just that--speculation. On the other hand, God's word is very much alive, and if we feel a circumstance or story speaking to us from within the text, we ought to listen carefully. After all, we've each experienced over-promising something we had no hope or desire to deliver. Perhaps it was time, effort, or we simply didn't want to do something we promised. Perhaps someone in our orbit pushed us to do something we knew was wrong, maybe even sinful, but because our loyalty to them was greater than to God we did it anyway.
### Jesus' Fate and John as His Prototype
John's life--and his death--serve two purposes: One, to fulfill the prophecy of [Malachi 3:1](:scripture) (quoted in [Mark 1:2](:scripture) and again in [Matthew 11:10](:scripture)), and second, through that fulfillment, to pave the way for every part of Christ's ministry. Like Jesus, John taught the necessity of repentance and he drew large crowds. Both men were executed as criminals--though both were innocent--and both were buried by their own disciples.<sup><a href="#source-2">2</a></sup> John knew the Messiah was coming after him to render judgment upon the world ([Matthew 3:11-12](:scripture)), and therefore he felt great urgency in preaching a message of repentance and "good news." The urgency of Jesus' message, however, was consequent to the relatively short timeframe of his earthly ministry and that his second coming will be one of judgment and fire.
We should be immensely grateful to God that we live during this time of his mercy and grace, because only by God's mercy does he offer grace before the coming judgment. Whereas Jesus was innocent and executed as a guilty man, we stand guilty but have been pardoned through his blood. Everyone will stand before God's throne, but only those who have repented and placed their full faith and allegiance in Christ will be absolved of their guilt. We have this assurance!
## Sources
1. <a class="source" name="source-1">Crossway Bibles, The ESV Study Bible (Wheaton, IL: Crossway Bibles, 2008), 1850.</a>
2. <a class="source" name="source-2">John D. Barry et al., Faithlife Study Bible (Bellingham, WA: Lexham Press, 2012, 2016), Mt 14:5.</a>
3. <a class="source" name="source-3">William Arndt et al., A Greek-English Lexicon of the New Testament and Other Early Christian Literature (Chicago: University of Chicago Press, 2000), 129.</a>
## Copyright and License
Copyright &copy; Benjamin A. Shelton. Page contents licensed under [Creative Commons BY-ND 4.0](https://creativecommons.org/licenses/by-nd/4.0/). Other pages may be licensed under different terms.

View file

@ -35,7 +35,7 @@ const meta = `{
---
<Layout title=`${note.data.title} - ${note.data.sub_heading}`>
<Layout title=`${note.data.title} - ${note.data.sub_heading}` image=`${urlfrag(base, note.data.post_image)}`>
{meta && <script type="application/ld+json" is:inline set:html={meta} />}
<script>
import { bindModals } from '../../utils/modal.js';
@ -49,7 +49,6 @@ const meta = `{
</hgroup>
<section id="meta">
<time>{dateFormat(note.data.date)}</time>
<span class="divider">
<ul class="tags">
{note.data.tags?.filter((tag: string) => (tag != 'notes')).map((tag: string) => (
<li>{titleCase(tag)}</li>
@ -60,31 +59,30 @@ const meta = `{
<Content />
</div>
<dialog data-scripture=""
class="p-0 rounded-sm w-full max-w-md m-auto flex-col flex hidden scripture">
class="p-0 rounded-sm w-full lg:max-w-lg xl:max-w-lg 2xl:max-w-lg m-auto flex-col flex hidden scripture">
<div tabindex="-1" autofocus class="p-4">
<div>
<button data-close="">
<span class="align-middle">close</span>
<span class="align-middle mr-1">close</span>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-circle inline" viewBox="0 0 16 16">
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"/>
<path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708"/>
</svg>
</button>
</div>
<div class="mt-2">
<label for="translation">Translation</label>
<select id="translation" class="translation">
<option value="BSB">Berean Standard Bible (BSB)</option>
</select>
</div>
<div class="spinner">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-book-fill hidden" viewBox="0 0 16 16">
<path d="M8 1.783C7.015.936 5.587.81 4.287.94c-1.514.153-3.042.672-3.994 1.105A.5.5 0 0 0 0 2.5v11a.5.5 0 0 0 .707.455c.882-.4 2.303-.881 3.68-1.02 1.409-.142 2.59.087 3.223.877a.5.5 0 0 0 .78 0c.633-.79 1.814-1.019 3.222-.877 1.378.139 2.8.62 3.681 1.02A.5.5 0 0 0 16 13.5v-11a.5.5 0 0 0-.293-.455c-.952-.433-2.48-.952-3.994-1.105C10.413.809 8.985.936 8 1.783"/>
</svg>
</div>
<article class="mt-6">
<article class="mt-2">
</article>
<nav>
<a href="#" class="bg">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-link-45deg inline" viewBox="0 0 16 16">
<path d="M4.715 6.542 3.343 7.914a3 3 0 1 0 4.243 4.243l1.828-1.829A3 3 0 0 0 8.586 5.5L8 6.086a1 1 0 0 0-.154.199 2 2 0 0 1 .861 3.337L6.88 11.45a2 2 0 1 1-2.83-2.83l.793-.792a4 4 0 0 1-.128-1.287z"/>
<path d="M6.586 4.672A3 3 0 0 0 7.414 9.5l.775-.776a2 2 0 0 1-.896-3.346L9.12 3.55a2 2 0 1 1 2.83 2.83l-.793.792c.112.42.155.855.128 1.287l1.372-1.372a3 3 0 1 0-4.243-4.243z"/>
</svg>
<span class="align-middle">Open <span class="underline"></span> on Bible Gateway</span>
</a>
</nav>
</div>
</dialog>
</article>

View file

@ -201,6 +201,11 @@ footer {
dialog.scripture {
@apply bg-white;
@apply dark:bg-gray-600 dark:text-neutral-300;
@apply scrollbar-thumb-gray-300 dark:scrollbar-thumb-gray-500;
@apply scrollbar-thin;
&::backdrop {
background-color: rgba(0, 0, 0, 0.6);
}
p {
@apply mt-4;
span.verse {
@ -227,6 +232,19 @@ dialog.scripture {
p.poem-2 {
@apply mt-0 pl-14;
}
label[for=translation] {
@apply text-gray-500 text-sm bg-white;
@apply dark:bg-gray-600 dark:text-gray-400;
}
select.translation {
@apply text-sm mt-0 p-2 text-gray-600 bg-gray-100 border-gray-300 border-1 rounded-sm w-full;
@apply dark:text-gray-400 dark:bg-gray-700 dark:border-gray-800;
@apply overflow-hidden;
}
select.translation:focus, select.translation:focus-visible {
border: 1px solid rgb(79, 136, 206);
outline: 1px solid rgb(79, 136, 206);
}
button[data-close] {
@apply absolute top-0 right-0 pr-2 pb-2 pt-2 text-sm text-gray-500 cursor-pointer hover:text-red-900;
@apply dark:text-gray-400 dark:hover:text-red-500;
@ -235,7 +253,7 @@ dialog.scripture {
}
}
h1 {
@apply font-bold mb-2 text-2xl;
@apply font-bold mb-2 mt-0 text-2xl;
@apply dark:text-neutral-300;
}
nav {
@ -493,13 +511,21 @@ nav#pagination {
ul, li {
@apply inline;
}
li a {
@apply bg-gray-100 font-bold mb-2 p-4 rounded-md text-cyan-900 text-sm hover:bg-gray-200 hover:text-black inline;
@apply dark:bg-gray-700 dark:text-blue-300 dark:hover:text-gray-300 dark:hover:bg-gray-600;
}
li a.disabled {
@apply text-gray-400 bg-gray-50 hover:bg-gray-50;
@apply dark:bg-gray-800 dark:text-gray-500 dark:hover:bg-gray-800;
ul {
li {
@apply mr-1;
}
li:last-child {
@apply mr-0;
}
li a {
@apply bg-gray-100 font-bold mb-2 p-4 rounded-md text-cyan-900 text-sm hover:bg-gray-200 hover:text-black inline;
@apply dark:bg-gray-700 dark:text-blue-300 dark:hover:text-gray-300 dark:hover:bg-gray-600;
}
li a.disabled {
@apply text-gray-400 bg-gray-50 hover:bg-gray-50;
@apply dark:bg-gray-800 dark:text-gray-500 dark:hover:bg-gray-800;
}
}
}

10
src/utils/meta.js Normal file

File diff suppressed because one or more lines are too long

View file

@ -1,23 +1,18 @@
import { aliases, defaulttx, meta, translations } from './meta.js';
import { hasLocalStorage } from './utils.js';
export const modal = (el) => {
};
function parseRef(ref) {
console.log(ref);
ref = ref.replace(/%3[Aa]/, ':').replace(/\+/, ' ');
console.log(ref);
const m = ref.match(/((\d+(\+|\s))?[a-zA-Z]+)(\+|\s)?([0-9]+)?\:?([0-9]+(-?[0-9]+)?)?/);
console.log(m);
const book = m[1];
const book = m[1].toLowerCase();
const chapter = m[5];
const verses = m[6]?.replaceAll(/–/g, '-');
console.log(`parseRef: ${book}, ${chapter}, ${verses}`);
console.log(books);
if (book === undefined) {
return {};
}
@ -25,12 +20,10 @@ function parseRef(ref) {
let refdata = {
ref: ref
};
if (book in books) {
refdata.book = book;
} else if (book in _map) {
refdata.book = _map[book];
if (book in aliases) {
refdata.book = aliases[book];
}
refdata.meta = books[refdata.book];
refdata.meta = meta[refdata.book];
refdata.fullTitle = () => {
let title = refdata.meta.title+' ';
title += refdata.chapter;
@ -61,7 +54,6 @@ function parseRef(ref) {
};
}
}
console.log(refdata, book);
if ('verses' in refdata) {
if (refdata.verses.start < 1) {
@ -78,353 +70,250 @@ function parseRef(ref) {
return refdata;
}
function render(dialog, response, refs) {
const content = response?.chapter?.content;
let inSpan = false;
class RenderScripture {
translation = 'BSB';
dialog = null;
sel = null;
ls = false;
ref = {};
if (dialog === null || dialog === undefined) {
return;
}
constructor(dialog) {
this.dialog = dialog;
console.log('render refs:', refs);
//history.replaceState({dialog: false}, '');
window.addEventListener('popstate', (evt) => {
if (this.dialog[0]?.open) {
this.closeDialog();
}
});
this.dialog[0]?.addEventListener('close', () => {
if (history.state && history.state.dialog) {
history.back();
}
});
this.dialog[0]?.addEventListener('cancel', (evt) => {
evt.preventDefault();
history.back();
});
const section = document.createElement('section');
const article = dialog?.querySelector('article');
let para = document.createElement('p');
dialog.querySelector('a.bg').href = `https://www.biblegateway.com/passage/?search=${refs.ref}&version=ESV`
dialog.querySelector('a.bg span').insertAdjacentText('beforeend', refs.fullTitle());
const heading = document.createElement('h1');
heading.insertAdjacentText('beforeend',
`${refs.fullTitle()}`);
article.insertAdjacentElement('beforeend', heading);
for (const c of content) {
if (c.type === 'heading') {
continue;
if (hasLocalStorage()) {
this.ls = true;
this.translation = localStorage.getItem('__translation') || 'BSB';
}
let verse = document.createElement('span');
const elems = document.querySelectorAll('a[data-scripture]');
elems.forEach((e) => {
e.addEventListener('click', (evt) => {
this.anchorClick(evt)
});
});
const sel = this.dialog[0]?.querySelector('select.translation');
sel?.addEventListener('change', (evt) => {
this.txnOnChange(evt)
});
this.sel = sel;
switch (c.type) {
case 'line_break':
if (inSpan) {
section.insertAdjacentElement('beforeend', para);
para = document.createElement('p');
this.dialog[0]?.addEventListener('click', (evt) => {
if (evt.target === this.dialog[0]) {
this.closeDialog()
}
break;
case 'verse':
if (!('number' in c)) {
});
this.dialog[0]?.querySelector('button[data-close]')?.addEventListener('click', (evt) => {
if (history.state?.dialog) {
history.back();
} else {
this.closeDialog();
}
});
const url = new URL(document.URL);
if (url.searchParams.get("cite") !== null) {
history.replaceState({dialog: false}, '', '');
this.openDialog(url.searchParams.get("cite"), url.hash.substring(1));
}
}
anchorClick(evt) {
const scripture = evt.target.attributes.getNamedItem('data-scripture')?.value;
evt.preventDefault();
this.openDialog(scripture, evt.target.name);
}
buildTranslationList(sel) {
sel?.replaceChildren();
for (const tx in translations) {
const testament = meta[this.ref.book].ts;
if (translations[tx][2].indexOf(testament) == -1) {
continue;
}
if (!('verses' in refs) || (c.number >= refs.verses.start && c.number <= refs.verses.end)) {
inSpan = true;
} else {
inSpan = false;
const opt = document.createElement('option');
opt.setAttribute('value', tx);
opt.insertAdjacentText('beforeend', translations[tx][0]);
if (tx == this.translation) {
opt.setAttribute('selected', 'selected');
}
if (inSpan) {
verse.insertAdjacentText('beforeend', c.number);
verse.classList.add('verse');
para.insertAdjacentElement('beforeend', verse);
verse = document.createElement('span');
for (const v of c.content) {
if (typeof(v) === 'string') {
para.insertAdjacentText('beforeend', v+' ');
continue
}
if ('lineBreak' in v) {
if (para.innerHTML.length != 0 || para.innerText.length != 0) {
section.insertAdjacentElement('beforeend', para);
para = document.createElement('p');
sel?.insertAdjacentElement('beforeend', opt);
}
}
closeDialog() {
this.dialog[0]?.close();
this.dialog[0]?.classList.add('hidden');
this.dialog[0]?.querySelector('article')?.replaceChildren();
//history.replaceState({}, '', '');
//history.back();
}
openDialog(scripture, hash) {
const refs = parseRef(scripture);
this.ref = refs;
this.dialog[0]?.showModal();
this.dialog[0]?.setAttribute('data-scripture', scripture);
this.dialog[0]?.classList.remove("hidden");
this.dialog[0]?.querySelector('.spinner svg')
.classList.remove('hidden');
this.buildTranslationList(this.sel);
this.readScripture(refs);
history.pushState({
dialog: true,
scripture: scripture.value,
tx: this.translation
}, '', `?cite=${scripture}#${hash}`);
}
txnOnChange(evt) {
const tx = evt.target.selectedOptions[0].value;
this.translation = tx;
if (this.ls) {
localStorage.setItem('__translation', tx);
}
const refs = parseRef(this.dialog[0]?.getAttribute('data-scripture'));
this.dialog[0]?.querySelector('article')?.replaceChildren();
this.dialog[0]?.querySelector('.spinner svg')
.classList.remove('hidden');
this.readScripture(refs);
}
readScripture(refs) {
// Current translation.
let tx = this.translation;
// Previous translation.
const px = this.translation;
const book = refs.book;
const chapter = refs.chapter;
const testament = meta[book].ts;
// If the current translation doesn't contain the testament, switch to
// the default translation that does.
if (translations[tx][2].indexOf(testament) == -1) {
tx = defaulttx[testament];
this.translation = tx;
}
const uri = `https://bible.helloao.org/api/${tx}/${book.toUpperCase()}/${chapter}.json`;
fetch(uri)
.then((response) => {
if (!response.ok) {
console.error('query failed');
console.log(response);
return;
}
return response.json();
})
.then((response) => {
this.render(response, refs);
this.dialog[0]?.querySelector('.spinner svg')
.classList.add('hidden');
// Switch translation back if it's forced to a different
// translation from book availability.
if (this.translation != px) {
this.translation = px;
}
});
}
render(response, refs) {
const content = response?.chapter?.content;
let inSpan = false;
if (this.dialog === null || this.dialog === undefined) {
return;
}
const section = document.createElement('section');
const article = this.dialog[0]?.querySelector('article');
let para = document.createElement('p');
const heading = document.createElement('h1');
heading.insertAdjacentText('beforeend',
`${refs.fullTitle()}`);
article.insertAdjacentElement('beforeend', heading);
for (const c of content) {
if (c.type === 'heading') {
continue;
}
let verse = document.createElement('span');
switch (c.type) {
case 'line_break':
if (inSpan) {
section.insertAdjacentElement('beforeend', para);
para = document.createElement('p');
}
break;
case 'verse':
if (!('number' in c)) {
continue;
}
if (!('verses' in refs) || (c.number >= refs.verses.start && c.number <= refs.verses.end)) {
inSpan = true;
} else {
inSpan = false;
}
if (inSpan) {
verse.insertAdjacentText('beforeend', c.number);
verse.classList.add('verse');
para.insertAdjacentElement('beforeend', verse);
verse = document.createElement('span');
for (const v of c.content) {
if (typeof(v) === 'string') {
para.insertAdjacentText('beforeend', v+' ');
continue
}
//para.insertAdjacentElement('beforeend', document.createElement('br'));
//para = document.createElement('p');
}
if ('text' in v) {
para.insertAdjacentText('beforeend', v.text);
if ('poem' in v) {
para.classList.add('poem-'+v.poem);
if ('lineBreak' in v) {
if (para.innerHTML.length != 0 || para.innerText.length != 0) {
section.insertAdjacentElement('beforeend',
para);
section.insertAdjacentElement('beforeend', para);
para = document.createElement('p');
}
}
if ('text' in v) {
para.insertAdjacentText('beforeend', v.text);
if ('poem' in v) {
para.classList.add('poem-'+v.poem);
if (para.innerHTML.length != 0 || para.innerText.length != 0) {
section.insertAdjacentElement('beforeend',
para);
}
para = document.createElement('p');
}
para = document.createElement('p');
}
}
}
break;
default:
console.error('unhandled type:', c.type);
}
break;
default:
console.error('unhandled type:', c.type);
}
//console.log(c);
section.insertAdjacentElement('beforeend', para);
article.insertAdjacentElement('beforeend', section);
}
section.insertAdjacentElement('beforeend', para);
article.insertAdjacentElement('beforeend', section);
}
export const bindModals = () => {
const elems = document.querySelectorAll('a[data-scripture]');
const dialog = document.querySelectorAll('dialog[data-scripture]');
console.log(dialog);
elems.forEach((e) => {
e.addEventListener('click', (evt) => {
const scripture = e.attributes.getNamedItem('data-scripture');
const refs = parseRef(scripture.value);
evt.preventDefault();
console.log('scripture:', scripture);
console.log('refs:', refs);
const uri = `https://bible.helloao.org/api/BSB/${refs.book.toUpperCase()}/${refs.chapter}.json`;
dialog[0]?.showModal();
dialog[0]?.setAttribute('data-scripture', scripture);
dialog[0]?.classList.remove("hidden");
dialog[0]?.querySelector('.spinner svg')
.classList.remove('hidden');
fetch(uri)
.then((response) => {
return response.json();
})
.then((response) => {
render(dialog[0], response, refs);
dialog[0]?.querySelector('.spinner svg')
.classList.add('hidden');
});
});
});
dialog[0]?.addEventListener('click', (evt) => {
if (evt.target === dialog[0]) {
dialog[0]?.close();
dialog[0]?.classList.add('hidden');
dialog[0]?.querySelector('article')?.replaceChildren();
dialog[0]?.querySelector('a.bg span').replaceChildren();
}
});
dialog[0]?.querySelector('button[data-close]')?.addEventListener('click', (evt) => {
evt.preventDefault();
dialog[0]?.close();
dialog[0]?.classList.add('hidden');
dialog[0]?.querySelector('article')?.replaceChildren();
dialog[0]?.querySelector('a.bg span').replaceChildren();
});
};
const books = {
"gen": {"title": "Genesis", "start": 1, "stop": 50, "count": 50,
"aliases": ["gn"],
},
"exo": {"title": "Exodus", "start": 1, "stop": 40, "count": 40,
"aliases": ["ex"],
},
"lev": {"title": "Leviticus", "start": 1, "stop": 27, "count": 27,
"aliases": ["lv"],
},
"num": {"title": "Numbers", "start": 1, "stop": 36, "count": 36,
"aliases": ["nm", "numb", "nmb", "nmbs"],
},
"deu": {"title": "Deuteronomy", "start": 1, "stop": 34, "count": 34,
"aliases": ["dt", "deut", "deuter"],
},
"jos": {"title": "Joshua", "start": 1, "stop": 24, "count": 24,
"aliases": ["js", "josh"],
},
"jdg": {"title": "Judges", "start": 1, "stop": 21, "count": 21,
"aliases": ["jd", "jdgs"],
},
"rut": {"title": "Ruth", "start": 1, "stop": 4, "count": 4,
"aliases": ["rt"],
},
"1sa": {"title": "1 Samuel", "start": 1, "stop": 31, "count": 31,
"aliases": ["1s", "1sam", "1 s", "1 sa", "1 sam"],
},
"2sa": {"title": "2 Samuel", "start": 1, "stop": 24, "count": 24,
"aliases": ["2s", "2sam", "2 s", "2 sa", "2 sam"],
},
"1ki": {"title": "1 Kings", "start": 1, "stop": 22, "count": 22,
"aliases": ["1k", "1kgs", "1king", "1 k", "1 ki", "1 kgs", "1 king"],
},
"2ki": {"title": "2 Kings", "start": 1, "stop": 25, "count": 25,
"aliases": ["2k", "2kgs", "2king", "2 k", "2 ki", "2 kgs", "2 king"],
},
"1ch": {"title": "1 Chronicles", "start": 1, "stop": 29, "count": 29,
"aliases": ["1c", "1chr", "1chron", "1 c", "1 ch", "1 chr", "1 chron"],
},
"2ch": {"title": "2 Chronicles", "start": 1, "stop": 36, "count": 36,
"aliases": ["2c", "2chr", "2chron", "2 c", "2 ch", "2 chr", "2 chron"],
},
"ezr": {"title": "Ezra", "start": 1, "stop": 10, "count": 10,
"aliases": ["ez"],
},
"neh": {"title": "Nehemiah", "start": 1, "stop": 13, "count": 13,
"aliases": ["nh"],
},
"est": {"title": "Esther", "start": 1, "stop": 10, "count": 10,
"aliases": ["es"],
},
"job": {"title": "Job", "start": 1, "stop": 42, "count": 42,
"aliases": ["jo"],
},
"psa": {"title": "Psalms", "start": 1, "stop": 150, "count": 150,
"aliases": ["ps", "psalm", "pss"],
},
"pro": {"title": "Proverbs", "start": 1, "stop": 31, "count": 31,
"aliases": ["pr", "prov"],
},
"ecc": {"title": "Ecclesiastes", "start": 1, "stop": 12, "count": 12,
"aliases": ["ec", "eccl", "eccle"],
},
"sng": {"title": "Song of Solomon", "start": 1, "stop": 8, "count": 8,
"aliases": ["sn", "son", "song", "sol"],
},
"isa": {"title": "Isaiah", "start": 1, "stop": 66, "count": 66,
"aliases": ["is", "isai"],
},
"jer": {"title": "Jeremiah", "start": 1, "stop": 52, "count": 52,
"aliases": ["jr", "jere", "jerem"],
},
"lam": {"title": "Lamentations", "start": 1, "stop": 5, "count": 5,
"aliases": ["lm", "lamen"],
},
"ezk": {"title": "Ezekiel", "start": 1, "stop": 48, "count": 48,
"aliases": ["eze", "ezek"],
},
"dan": {"title": "Daniel", "start": 1, "stop": 12, "count": 12,
"aliases": ["dn"],
},
"hos": {"title": "Hosea", "start": 1, "stop": 14, "count": 14,
"aliases": ["hs"],
},
"jol": {"title": "Joel", "start": 1, "stop": 3, "count": 3,
"aliases": ["jl"],
},
"amo": {"title": "Amos", "start": 1, "stop": 9, "count": 9,
"aliases": ["am"],
},
"oba": {"title": "Obadiah", "start": 1, "stop": 1, "count": 1,
"aliases": ["ob", "obd", "obad"],
},
"jon": {"title": "Jonah", "start": 1, "stop": 4, "count": 4,
"aliases": ["jo"],
},
"mic": {"title": "Micah", "start": 1, "stop": 7, "count": 7,
"aliases": ["mc"],
},
"nam": {"title": "Nahum", "start": 1, "stop": 3, "count": 3,
"aliases": ["na"],
},
"hab": {"title": "Habakkuk", "start": 1, "stop": 3, "count": 3,
"aliases": ["hb", "haba", "habak"],
},
"zep": {"title": "Zephaniah", "start": 1, "stop": 3, "count": 3,
"aliases": ["ze", "zf", "zef"],
},
"hag": {"title": "Haggai", "start": 1, "stop": 2, "count": 2,
"aliases": ["hg"],
},
"zec": {"title": "Zechariah", "start": 1, "stop": 14, "count": 14,
"aliases": ["ze", "zech"],
},
"mal": {"title": "Malachi", "start": 1, "stop": 4, "count": 4,
"aliases": ["ml", "mala"],
},
"mat": {"title": "Matthew", "start": 1, "stop": 28, "count": 28,
"aliases": ["mt", "matt"],
},
"mrk": {"title": "Mark", "start": 1, "stop": 16, "count": 16,
"aliases": ["mk"],
},
"luk": {"title": "Luke", "start": 1, "stop": 24, "count": 24,
"aliases": ["lk"],
},
"jhn": {"title": "John", "start": 1, "stop": 21, "count": 21,
"aliases": ["jn"],
},
"act": {"title": "Acts", "start": 1, "stop": 28, "count": 28,
"aliases": ["ac"],
},
"rom": {"title": "Romans", "start": 1, "stop": 16, "count": 16,
"aliases": ["rm", "rms"],
},
"1co": {"title": "1 Corinthians", "start": 1, "stop": 16, "count": 16,
"aliases": ["1cor", "1corin", "1 co", "1 cor", "1 corin"],
},
"2co": {"title": "2 Corinthians", "start": 1, "stop": 13, "count": 13,
"aliases": ["2cor", "2corin", "2 co", "2 cor", "2 corin"],
},
"gal": {"title": "Galatians", "start": 1, "stop": 6, "count": 6,
"aliases": ["gl"],
},
"eph": {"title": "Ephesians", "start": 1, "stop": 6, "count": 6,
"aliases": ["ep", "ef"],
},
"php": {"title": "Philippians", "start": 1, "stop": 4, "count": 4,
"aliases": ["ph", "phil"],
},
"col": {"title": "Colossians", "start": 1, "stop": 4, "count": 4,
"aliases": ["cl", "colo"],
},
"1th": {"title": "1 Thessalonians", "start": 1, "stop": 5, "count": 5,
"aliases": ["1thes", "1thess", "1 thes", "1 thess"],
},
"2th": {"title": "2 Thessalonians", "start": 1, "stop": 3, "count": 3,
"aliases": ["2thes", "2thess", "2 thes", "2 thess"],
},
"1ti": {"title": "1 Timothy", "start": 1, "stop": 6, "count": 6,
"aliases": ["1tim", "1 ti", "1 tim"],
},
"2ti": {"title": "2 Timothy", "start": 1, "stop": 4, "count": 4,
"aliases": ["2tim", "2 ti", "2 tim"],
},
"tit": {"title": "Titus", "start": 1, "stop": 3, "count": 3,
"aliases": ["ti"],
},
"phm": {"title": "Philemon", "start": 1, "stop": 1, "count": 1,
"aliases": ["pi", "philm", "philem"],
},
"heb": {"title": "Hebrews", "start": 1, "stop": 13, "count": 13,
"aliases": ["he"],
},
"jas": {"title": "James", "start": 1, "stop": 5, "count": 5,
"aliases": ["ja", "jam"],
},
"1pe": {"title": "1 Peter", "start": 1, "stop": 5, "count": 5,
"aliases": ["1p", "1pt", "1pet", "1 p", "1 pe", "1 pt", "1 pet"],
},
"2pe": {"title": "2 Peter", "start": 1, "stop": 3, "count": 3,
"aliases": ["2p", "2pt", "2pet", "2 p", "2 pe", "2 pt", "2 pet"],
},
"1jn": {"title": "1 John", "start": 1, "stop": 5, "count": 5,
"aliases": ["1jon", "1 jn", "1 jon"],
},
"2jn": {"title": "2 John", "start": 1, "stop": 1, "count": 1,
"aliases": ["2jon", "2 jn", "2 jon"],
},
"3jn": {"title": "3 John", "start": 1, "stop": 1, "count": 1,
"aliases": ["3jon", "3 jn", "3 jon"],
},
"jud": {"title": "Jude", "start": 1, "stop": 1, "count": 1,
"aliases": ["ju"],
},
"rev": {"title": "Revelation", "start": 1, "stop": 22, "count": 22,
"aliases": ["rv", "reve"],
},
}
function buildBookMap() {
let mp = {};
for (const book in books) {
if (!("aliases" in books[book])) {
continue;
}
for (const alias of books[book]?.aliases) {
mp[alias] = book;
}
mp[books[book]["title"].toLowerCase()] = book;
}
console.log(mp.length);
return mp;
}
const _map = buildBookMap();
const renderer = new RenderScripture(dialog);
};

View file

@ -1,48 +1,59 @@
import { visit } from 'unist-util-visit';
let currentBook = '';
class LinkParser {
linkCount = 1;
currentBook = '';
function scriptureLink(node, args, meta) {
const value = node.children?.[0]?.value?.trim() || '';
let passage = (args && args.length > 0 && args[0] != '') ? args[0] : value;
constructor() {
this.linkCount = 1;
this.currentBook = '';
}
if (value.match(/^[Vv][Vv]?(erses?)?\s*/)) {
const book = meta.data.astro.frontmatter.book;
const chapter = meta.data.astro.frontmatter.chapter;
if ((args.length == 0 || args[0] == '') && (book && chapter)) {
passage = `${book} ${chapter}:${value.replace(/^[Vv][Vv]?(erses?)?\s*/, '')}`;
} else if (args.length == 0 || args[0] == '') {
node.properties.href = null;
return;
parse(node, args, meta) {
const value = node.children?.[0]?.value?.trim() || '';
let passage = (args && args.length > 0 && args[0] != '') ? args[0] : value;
if (value.match(/^[Vv][Vv]?(erses?)?\s*/)) {
const book = meta.data.astro.frontmatter.book;
const chapter = meta.data.astro.frontmatter.chapter;
if ((args.length == 0 || args[0] == '') && (book && chapter)) {
passage = `${book} ${chapter}:${value.replace(/^[Vv][Vv]?(erses?)?\s*/, '')}`;
} else if (args.length == 0 || args[0] == '') {
node.properties.href = null;
return;
}
}
}
// Stylized hyphen replacement from Logos.
passage = passage.replaceAll(/–/g, '-');
// Stylized hyphen replacement from Logos.
passage = passage.replaceAll(/–/g, '-');
if (passage.match(/^[-0-9:]+$/)) {
passage = `${currentBook} ${passage}`;
}
if (passage.match(/^[-0-9:]+$/)) {
passage = `${this.currentBook} ${passage}`;
}
passage = passage.toLowerCase();
passage = passage.replace(/pss/, 'ps');
const match = passage.match(/^(\d?\s*[-a-zA-Z]+)\s*\d+?/)
passage = passage.toLowerCase();
passage = passage.replace(/pss/, 'ps');
const match = passage.match(/^(\d?\s*[-a-zA-Z]+)\s*\d+?/)
passage = passage.replaceAll(/ /g, '+');
passage = passage.replace(/\:/, '%3A');
passage = passage.replaceAll(/ /g, '+');
passage = passage.replace(/\:/, '%3A');
if (passage !== '') {
node.properties.href = `https://www.biblegateway.com/passage/?search=${passage}&version=ESV`;
node.properties["data-scripture"] = passage;
}
if (passage !== '') {
node.properties.href = `https://www.biblegateway.com/passage/?search=${passage}&version=ESV`;
node.properties["data-scripture"] = passage;
node.properties.name = 'scripture-'+this.linkCount;
this.linkCount++;
}
if (match) {
currentBook = match?.[1].trim();
if (match) {
this.currentBook = match?.[1].trim();
}
}
}
export const ScriptureLinks = () => {
return async (tree, file) => {
const parser = new LinkParser();
visit(tree, 'element', (node) => {
let tag = '';
let rest = '';
@ -64,7 +75,7 @@ export const ScriptureLinks = () => {
switch (tag) {
// Scripture reference.
case 'scripture':
scriptureLink(node, rest.split(','), file);
parser.parse(node, rest.split(','), file);
break;
// Quoting Jesus' words.
case 'jesus':

16
src/utils/utils.js Normal file
View file

@ -0,0 +1,16 @@
export const hasLocalStorage = () => {
try {
var ls = localStorage;
var key = "__test";
ls.setItem(key, key);
ls.removeItem(key);
return true;
} catch (e) {
return (
e instanceof DOMException &&
e.name === "QuotaExceededError" &&
localStorage &&
localStorage.length !== 0
);
}
}