Skip to content

Commit

Permalink
EMMR-111 Correct transcription marginalia auto-numbering
Browse files Browse the repository at this point in the history
  • Loading branch information
camilocodes committed Nov 30, 2023
1 parent 03ffb86 commit 869dada
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions custom/modules/emmr_core/emmr_core.module
Original file line number Diff line number Diff line change
Expand Up @@ -235,14 +235,14 @@ function emmr_core_node_presave($node) {
// Find marginalia item matches.
preg_match_all('/<trxnmar>(.*?)<\/trxnmar>/', $trans, $matches);
// Iterate.
foreach ($matches as $key => $marginalia) {
foreach ($matches[0] as $key => $marginalia) {
$i = $key + 1;
// Get full expression match
$original = $marginalia[0] ?? NULL;
$original = $marginalia ?? NULL;
if ($original) {
// Get number segment.
// Get numbexr segment.
preg_match_all('/<span class="trxn-number">(.*?)<\/span>/', $original, $number);
// Build sequential number segment.
$i = $key + 1;
$new = "<span class='trxn-number'>$i</span>";
// Replace original number segment in original match.
$replacement = str_replace($number[0], $new, $original, $count);
Expand All @@ -253,7 +253,7 @@ function emmr_core_node_presave($node) {
'value' => $trans,
'format' => 'unb_libraries',
]);
}
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion custom/modules/emmr_transcribe/js/build/transMargin.js

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

Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function createTransMargin(writer) {
// transmarginediting.js.
const transMargin = writer.createElement('transMargin');
const transMarginNumber = writer.createElement('transMarginNumber');
writer.appendText('X', {}, transMarginNumber);
writer.appendText('#', {}, transMarginNumber);
const transMarginText = writer.createElement('transMarginText');
let marginaliaText = prompt("Enter transcription marginalia text");
writer.appendText(marginaliaText, {}, transMarginText);
Expand Down

0 comments on commit 869dada

Please sign in to comment.