Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix error with not found occurrences on quotes combinations #7

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
28 changes: 15 additions & 13 deletions examples/getBook.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,21 @@ export async function getTargetBook(_bookId, shouldFetch = false) {

const targetUsfm = !shouldFetch
? fs.readFileSync(
path.join(__dirname, "../examples/data/", `${bookId}-target.usfm`),
"utf8"
)
path.join(__dirname, "../examples/data/", `${bookId}-target.usfm`),
"utf8"
)
: await fetch(
`https://git.door43.org/unfoldingWord/en_ult/raw/branch/master/${String(
bookNames[bookId]
).padStart(2, "0")}-${bookId}.usfm`
).then(r => r.text());
`https://git.door43.org/api/v1/repos/unfoldingword/en_ult/releases/latest?pre-release=false`
)
.then((r) => r.json())
.then(
async ({ tag_name: tag }) =>
await fetch(
`https://git.door43.org/unfoldingWord/en_ult/raw/tag/${tag}/${String(
bookNames[bookId]
).padStart(2, "0")}-${bookId}.usfm`
).then((r) => r.text())
);

const targetBook = getParsedUSFM(targetUsfm).chapters;
targetBooks[bookId] = targetBook;
Expand All @@ -105,12 +112,7 @@ export async function getSourceBook(_bookId, shouldFetch = false) {
const bookId = _bookId.toUpperCase();
if (sourceBooks[bookId])
return sourceBooks[bookId];
const url = `https://git.door43.org/unfoldingWord/${
bookNames[bookId] < 40 ? "hbo_uhb" : "el-x-koine_ugnt"
}/raw/branch/master/${String(bookNames[bookId]).padStart(
2,
"0"
)}-${bookId}.usfm`;

const sourceUsfm = !shouldFetch
? fs.readFileSync(
path.join(__dirname, "../examples/data/", `${bookId}-source.usfm`),
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "uw-quote-helpers",
"description": "An open component package for generating target quotes from an aligned Bible.",
"version": "1.1.4",
"version": "1.1.5-beta.1",
"homepage": "",
"license": "MIT",
"repository": {
Expand Down
Loading