Add support for implicitly defined \par (backslash + newline / carriage return)

This commit is contained in:
Tom Z?hner
2021-01-03 15:50:55 +01:00
parent 9b068da670
commit 4d9420fc92
8 changed files with 42 additions and 11 deletions
Generated Vendored
+9 -4
View File
@@ -776,10 +776,6 @@ var Parser = /** @class */ (function () {
// Reset if we unexpectedly encounter a keyword
this.parser.state.skipchars = 0;
switch (keyword) {
case "\n":
return "\n";
case "\r":
return "\r";
case "tab":
return "\t";
case "emdash":
@@ -854,6 +850,15 @@ var Parser = /** @class */ (function () {
case "ltrch":
case "rtlch":
return;
case "\n":
case "\r": {
// Carriage return and line feed must be treated like a \par, so we rewrite the keyword
// here and then fall through to the default behavior
this.parser.line++;
this.parser.column = 0;
keyword = "par";
}
// eslint-disable-next-line no-fallthrough
default:
if (!this.parser.state.skipdestination) {
if (first) {
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+10 -4
View File
@@ -235,10 +235,6 @@ export class Parser {
// Reset if we unexpectedly encounter a keyword
this.parser.state.skipchars = 0;
switch (keyword) {
case "\n":
return "\n";
case "\r":
return "\r";
case "tab":
return "\t";
case "emdash":
@@ -318,6 +314,16 @@ export class Parser {
case "rtlch":
return;
case "\n":
case "\r": {
// Carriage return and line feed must be treated like a \par, so we rewrite the keyword
// here and then fall through to the default behavior
this.parser.line++;
this.parser.column = 0;
keyword = "par";
}
// eslint-disable-next-line no-fallthrough
default:
if (!this.parser.state.skipdestination) {
if (first) {
@@ -0,0 +1 @@
{}
@@ -0,0 +1,14 @@
<div>
<span> LINE1 - APPLE
</span>
</div>
<div>
<span> LINE2 - BANANA
</span>
</div>
<div>
<span> LINE3 - CLEAN
</span>
</div>
<div>
</div>
@@ -0,0 +1,5 @@
{\rtf1\ansi\ansicpg1252
LINE1 - APPLE\
LINE2 - BANANA\
LINE3 - CLEAN\
}