Behaviour SwRS-MDOKFSTUDIO-REVIEW-100
A thread follows its quote in the plain text, narrowed by its context, or is orphaned and keeps its lines
When the quote of a review thread is no longer in its old lines but occurs in the document at one place, the extension SHALL move the thread to the lines of that place, and, when the quote cannot be found and its old lines do not resemble it, mark the thread as orphaned and keep its stored lines and comments
Another outcome at step 1 of path 1 in StRS-MDOKFSTUDIO-REVIEW-008, in the state “The text of a document with review threads changes”.
Part of StRS-MDOKFSTUDIO-REVIEW-001, outside the paths drawn on its map.
Scenarios 13
The situations the tests check; open one to read it.
nominalA thread follows its quote to the line where it moved
nominalUnchanged threads are kept
nominalSeveral copies are narrowed by the prefix and suffix of the thread
a second thread with prefix "Please " and suffix " soon." moves to the other copy
boundaryWithout usable context only the nearest copy within 50 lines counts
When several copies remain and the surroundings do not decide, the thread moves to the nearest copy only if it lies within 50 lines (WINDOW_LINES) of the old lines and is strictly nearer than the next copy.
| Input | Outcome |
|---|---|
| a thread on line 205 and copies on lines 11 and 212 | the thread moves to line 212 |
| copies only outside the window | the thread is orphaned |
| two copies at the same distance | the thread is orphaned |
boundaryDistance allowed for a short and for a long quote
| Input | Outcome |
|---|---|
| a thread on line 3 quoting Fox (fewer than 12 characters, MIN_FAR_QUOTE) and a copy 20 lines further | the thread moves there |
| the same short quote only 200 lines further | the thread is orphaned |
| a thread on line 4 and a long quote (at least 12 characters) occurring exactly once, now on line 301 | the thread moves to line 301, however far it is |
| a long quote occurring twice, far from the old lines | the thread is orphaned |
nominalThe quote is searched in the plain text of the document
The searched text has block markers, link targets, emphasis marks, table pipes and rules, HTML tags and comments and footnote markers removed, entities decoded and whitespace collapsed. A MyST role is read as the text it renders: the content of a role such as {kbd}`Ctrl`, and nothing for a role that renders a label the source does not hold, such as {cite} and {ref} without text.
| Input | Outcome |
|---|---|
| a list item "see **the quick** brown [fox](https://example.com) now" and the quote "the quick brown fox now" | the thread is found on that line |
| a line "Tom & Jerry went home. `<!-- TODO fix -->`" and the quote "Tom & Jerry went home." | the thread stays on that line |
| the source "Press {kbd}`Ctrl` to continue." and the quote "Press Ctrl to continue." | the thread stays anchored |
| the source "As shown in {cite}`smith2020` the result holds." and the quote "As shown in Smith, 2020 the result holds." | the thread stays anchored at its original line |
refusalCode fences and front matter are never searched
when the quote also occurs in a paragraph, the thread is found in the paragraph
boundaryA quote spanning several lines, also in a CRLF document
| Input | Outcome |
|---|---|
| the quote "brown fox jumps over the lazy" over lines 3 to 5 | the thread moves to lines 3 to 5 |
| the same document with CRLF line ends | the result is the same |
nominalA deleted quote orphans the thread
nominalAn orphan among several threads is untouched
boundaryThe old lines are checked before the cap of 200 candidates
for a quote with more than 200 copies and no copy in the old lines, at most 200 copies are examined (MAX_CANDIDATES)
refusalSurroundings that disagree prevent a move
| Input | Outcome |
|---|---|
| a thread quoting Overview (a short quote) with prefix "Intro: " and a document where the word has other surroundings | the thread is orphaned |
| two copies of the quote and none that matches the stored prefix and suffix | the thread is orphaned |
boundaryOld lines that still resemble the quote keep the thread
When the quote has no acceptable place but at least 60 percent of its words occur in order in the old lines (RESEMBLANCE = 0.6), or the old lines hold a role that renders text the source lacks, the thread stays on those lines.
| Input | Outcome |
|---|---|
| the quote "The scheduler stops after the first problem" and the old line "The scheduler stops after a first problem happens." | the thread stays anchored |
| a quote with no word in common with the old lines | the thread is orphaned |