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

When formatting verse numbers, handle range separator #763

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions src/lib/components/ScriptureViewSofria.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ LOGGING:
inlineGraft: 1,
mark: 1,
meta: 1,
row: 1
row: 1,
placement: 1
}
: $logs['scripture'];

Expand Down Expand Up @@ -524,10 +525,14 @@ LOGGING:
}
function addVerseNumber(workspace: any, element: any, showVerseNumbers: boolean) {
if (showVerseNumbers === true) {
var spanV = document.createElement('span');
const spanV = document.createElement('span');
spanV.classList.add('v');
spanV.innerText = numerals.formatNumber(numeralSystem, element.atts['number']);
var spanVsp = document.createElement('span');
// 'number' can be a range of verse numbers
const numbers = element.atts['number']
.split(verseRangeSeparator)
.map((x) => numerals.formatNumber(numeralSystem, x));
spanV.innerText = numbers.join(verseRangeSeparator);
const spanVsp = document.createElement('span');
spanVsp.classList.add('vsp');
spanVsp.innerText = '\u00A0'; // &nbsp
workspace.phraseDiv.appendChild(spanV);
Expand Down Expand Up @@ -979,6 +984,9 @@ LOGGING:
pos: string,
verse: string
) {
if (scriptureLogs?.placement) {
console.log('Placing element:', element, 'at', pos, 'of verse', verse);
}
if (pos === 'after') {
const el = document.getElementById('bookmarks' + verse);
el.insertAdjacentElement('afterend', element);
Expand Down Expand Up @@ -2397,7 +2405,8 @@ LOGGING:
$: books = $refs.catalog.documents;
$: direction = config.bookCollections.find((x) => x.id === references.collection).style
.textDirection;

$: verseRangeSeparator = config.bookCollections.find((x) => x.id === references.collection)
.features['ref-verse-range-separator'];
$: (() => {
performance.mark('query-start');
const bookHasIntroduction = books.find((x) => x.bookCode === currentBook)?.hasIntroduction;
Expand Down
Loading