Behaviour SwRS-MDOKFSTUDIO-TABLE-091
Pipes in cell text are escaped and line breaks become spaces
When the writer types text into a table cell or inserts text into a cell from the table bar, the extension SHALL write the pipes of that text as \| so that the edited row keeps its cell count, and replace every line break of text inserted from the bar or pasted into the cell with a space.
Another outcome at step 2 of path 1 in StRS-MDOKFSTUDIO-TABLE-015, in the state “The cell text is formatted”.
Scenarios 5
The situations the tests check; open one to read it.
nominalTyped pipe
Giventhe value a|b typed in a cell
Whenthe table is saved
Thenthe source holds a\|b and the table parses back to the same number of cells
boundaryPipe in a code span typed in a cell
Giventhe value `a|b` typed
Whenthe table is saved
Thenthe source holds `a\|b` and the preview shows a|b in the code span, because a pipe inside a code span splits a cell like any other (see the cell splitting in SwRS-MDOKFSTUDIO-TABLE-094)
nominalLink text and URL inserted from the bar
Givena link text and a URL that contain a pipe, inserted from the Link panel, a text with a pipe inside a code span, and a link text containing a line break
Whenthe text is inserted
Thenevery unescaped pipe is written \|, also the one inside the code span, each line break is a space, and the row keeps its cell count and stays one line
boundaryEscaped pipes and line break pairs in text inserted from the bar
| Inserted text | Outcome |
|---|---|
| a pipe that is already escaped (|) | left as it is |
| a pipe preceded by an odd number of backslashes in the cell | left as it is |
| a pipe preceded by an even number of backslashes (or none) | written | |
| a CRLF pair | one space |
| a lone line feed or a lone carriage return | one space |
| the colour inserted from the bar | no test of its own for this rule (untested) |
boundaryLine break pasted into the cell text box
Giventhe clipboard holds "a\nb" (or "a\r\nb"), a text without a tab, and the cell text box is focused
Whenthe writer pastes
Thenthe text box holds "a b", the caret keeps its place after the pasted text and the source row stays one line with the same cell count