use a colon instead of semi-colon for verse reference key dilimeters. you should fix the data in strongs cross references when you get around to cleaning up that data...

This commit is contained in:
Jason Wall 2020-08-01 23:28:18 -04:00
parent cb3903f86e
commit d3c7287b14
3 changed files with 22 additions and 16 deletions

View File

@ -1912,11 +1912,11 @@ export class BibleReference {
chapter: number | string, chapter: number | string,
vs: number | string vs: number | string
) { ) {
return `${book};${chapter};${vs}`; return `${book}:${chapter}:${vs}`;
} }
public static makePassageFromReferenceKey(referenceKey: string) { public static makePassageFromReferenceKey(referenceKey: string) {
const keyArray = referenceKey.split(';'); const keyArray = referenceKey.split(':');
const book = BibleReference.bookName(parseInt(keyArray[0], 10)).name; const book = BibleReference.bookName(parseInt(keyArray[0], 10)).name;
return new BibleReference(`${book} ${keyArray[1]}:${keyArray[2]}`); return new BibleReference(`${book} ${keyArray[1]}:${keyArray[2]}`);
} }

View File

@ -128,13 +128,13 @@ export interface StrongsDefinitionPart {
export interface StrongsCrossReference { export interface StrongsCrossReference {
readonly id: string; // strongs id H1|G1 readonly id: string; // strongs id H1|G1
readonly t: string; // strongs testament grk|heb readonly t: string; // strongs testament grk|heb
readonly d: string; // strongs word/data Aaron {ah-ar-ohn'} readonly d: string; // strongs word/data definition Aaron {ah-ar-ohn'}
readonly ss: readonly [ readonly ss: readonly [
{ {
readonly w: string; readonly w: string; // translated word
readonly rs: readonly [ readonly rs: readonly [
{ {
readonly r: string; readonly r: string; // reference
} }
]; ];
} }

View File

@ -296,7 +296,22 @@ export class AppService extends createStateService(reducer, initialState) {
.toPromise(); .toPromise();
for (const cr of d) { for (const cr of d) {
if (cr.id.toUpperCase() === result.prefix + result.sn) { if (cr.id.toUpperCase() === result.prefix + result.sn) {
result.crossrefs = cr; result.crossrefs = {
id: cr.id, // strongs id H1|G1
t: cr.t, // strongs testament grk|heb
d: cr.d, // strongs word/data definition Aaron {ah-ar-ohn'}
ss: cr.ss.map((ss) => {
return {
w: ss.w, // translated word
rs: ss.rs.map((rs) => {
return {
r: rs.r.split(';').join(':'), // fix the reference...
};
}),
};
}),
};
break; break;
} }
} }
@ -724,16 +739,7 @@ export class AppService extends createStateService(reducer, initialState) {
return; return;
} }
// find the right word // find the right word
const refs = r const refs = r.filter((o) => o.w === query);
.filter((o) => o.w === query)
// you used the wrong delimiter here... *sigh* its ;'s in all the other things.
.map((o) => {
return {
...o,
r: o.r.map((ref) => ref.replace(':', ';')),
};
});
if (refs.length > 0) { if (refs.length > 0) {
return refs[0].r; return refs[0].r;
} else { } else {