Skip to content

Commit

Permalink
2.3.6 fix Spainish short name trigger
Browse files Browse the repository at this point in the history
fix #149
  • Loading branch information
tim-hub committed Nov 25, 2023
1 parent f8d625e commit 5e6d9fb
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 20 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "obsidian-bible-reference",
"name": "Bible Reference",
"version": "2.3.5",
"version": "2.3.6",
"minAppVersion": "0.12.0",
"description": "Taking Bible Study note in Obsidian.md application easily. Automatically suggesting Bible Verses as references. ",
"author": "tim-hub",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-bible-reference",
"version": "2.3.5",
"version": "2.3.6",
"description": "Taking Bible Study note in Obsidian.md application easily. Automatically suggesting Bible Verses as references. ",
"main": "main.js",
"scripts": {
Expand Down Expand Up @@ -73,7 +73,7 @@
},
"dependencies": {
"ackee-tracker": "^5.1.0",
"bible-reference-toolkit": "^2.3.1",
"bible-reference-toolkit": "^2.3.2",
"flagsmith-nodejs": "^3.1.1"
}
}
14 changes: 7 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions src/utils/bookNameReference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,26 @@ import Reference from 'bible-reference-toolkit'

export const getBookIdFromBookName = (
bookName: string,
langaugeCode: string = 'en'
languageCode: string = 'en'
): number => {
try {
return Reference.bookIdFromTranslationAndName(langaugeCode, bookName)
console.debug('get book id first time', bookName, languageCode)
return Reference.bookIdFromTranslationAndName(languageCode, bookName)
} catch (e) {
// try in slow but in all supported languages
console.debug('get book id from all translations', bookName)
return Reference.bookIdFromName(bookName)
}
}

export const getFullBookName = (
name: string,
langaugeCode: string = 'en'
languageCode: string = 'en'
): string => {
console.debug('getFullBookName', name, langaugeCode)
const bookId = getBookIdFromBookName(name, langaugeCode)
console.debug('getFullBookName', name, languageCode)
const bookId = getBookIdFromBookName(name, languageCode)
try {
return Reference.bookNameFromTranslationAndId(langaugeCode, bookId)
return Reference.bookNameFromTranslationAndId(languageCode, bookId)
} catch (e) {
return Reference.bookEnglishFullNameFromId(bookId)
}
Expand Down
6 changes: 3 additions & 3 deletions src/utils/regs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ export const ORIGINAL_REG = /-{2}(([123])*)(\w{3,})\+\d{0,3}:*\d{0,3}-*\d{0,3}$/
* --John12:1-3
* --John1:1
*/
export const SHORT_REG = /-{2}([123])*\s*[A-z]{3,}\s*\d{1,3}:\d{1,3}(-\d{1,3})*/
export const SHORT_REG = /-{2}([123])*\s*[A-z]{2,}\s*\d{1,3}:\d{1,3}(-\d{1,3})*/

/**
* regular expression to match
* John12:1-3
* John1:1
*/
export const MODAL_REG = /([123])*\s*[A-z]{3,}\s*\d{1,3}:\d{1,3}(-\d{1,3})*/
export const MODAL_REG = /([123])*\s*[A-z]{2,}\s*\d{1,3}:\d{1,3}(-\d{1,3})*/

export const BOOK_REG = /[123]*\s*[A-z]{3,}/
export const BOOK_REG = /[123]*\s*[A-z]{2,}/
3 changes: 2 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,6 @@
"2.3.2": "0.12.0",
"2.3.3": "0.12.0",
"2.3.4": "0.12.0",
"2.3.5": "0.12.0"
"2.3.5": "0.12.0",
"2.3.6": "0.12.0"
}

0 comments on commit 5e6d9fb

Please sign in to comment.