Commit b83bb95e authored by Robert Knight's avatar Robert Knight

Add a couple of explanatory comments

parent 11ac17b2
...@@ -431,6 +431,8 @@ async function anchorQuote(quoteSelector, positionHint) { ...@@ -431,6 +431,8 @@ async function anchorQuote(quoteSelector, positionHint) {
if (page < expectedPageIndex) { if (page < expectedPageIndex) {
strippedHint = strippedText.length; // Prefer matches closer to end of page. strippedHint = strippedText.length; // Prefer matches closer to end of page.
} else if (page === expectedPageIndex) { } else if (page === expectedPageIndex) {
// Translate expected offset in whitespace-inclusive version of page
// text into offset in whitespace-stripped version of page text.
[strippedHint] = translateOffsets( [strippedHint] = translateOffsets(
text, text,
strippedText, strippedText,
...@@ -454,6 +456,8 @@ async function anchorQuote(quoteSelector, positionHint) { ...@@ -454,6 +456,8 @@ async function anchorQuote(quoteSelector, positionHint) {
} }
if (!bestMatch || match.score > bestMatch.match.score) { if (!bestMatch || match.score > bestMatch.match.score) {
// Translate match offset from whitespace-stripped version of page text
// back to original text.
const [start, end] = translateOffsets( const [start, end] = translateOffsets(
strippedText, strippedText,
text, text,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment