Skip to content

Commit 4406a4f

Browse files
authored
Merge pull request Sub6Resources#431 from Sub6Resources/revert-398-fix/trim_whitespaces
Revert "Remove remaining leading and trailing whitespaces"
2 parents dab9923 + 34b5228 commit 4406a4f

File tree

2 files changed

+2
-23
lines changed

2 files changed

+2
-23
lines changed

lib/html_parser.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class HtmlParser extends StatelessWidget {
6969
// scaling is used, but relies on https://github.com/flutter/flutter/pull/59711
7070
// to wrap everything when larger accessibility fonts are used.
7171
return StyledText(
72-
textSpan: parsedTree,
72+
textSpan: parsedTree,
7373
style: cleanedTree.style,
7474
textScaleFactor: MediaQuery.of(context).textScaleFactor,
7575
);
@@ -439,15 +439,13 @@ class HtmlParser extends StatelessWidget {
439439
/// (2) Replace all newlines with a space
440440
/// (3) Replace all tabs with a space
441441
/// (4) Replace any instances of two or more spaces with a single space.
442-
/// (5) Remove remaining leading and trailing spaces.
443442
static String _removeUnnecessaryWhitespace(String text) {
444443
return text
445444
.replaceAll(RegExp("\ *(?=\n)"), "\n")
446445
.replaceAll(RegExp("(?:\n)\ *"), "\n")
447446
.replaceAll("\n", " ")
448447
.replaceAll("\t", " ")
449-
.replaceAll(RegExp(" {2,}"), " ")
450-
.trim();
448+
.replaceAll(RegExp(" {2,}"), " ");
451449
}
452450

453451
/// [processListCharacters] adds list characters to the front of all list items.

test/html_parser_test.dart

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,6 @@ void main() {
1919
);
2020
});
2121

22-
testWidgets("Parser trims whitepaces", (WidgetTester tester) async {
23-
await tester.pumpWidget(
24-
MaterialApp(
25-
home: Scaffold(
26-
body: Html(
27-
data: """
28-
<div>
29-
content
30-
</div>
31-
""",
32-
),
33-
),
34-
),
35-
);
36-
expect(find.byType(Html), findsOneWidget);
37-
expect(find.text("content"), findsOneWidget);
38-
expect(find.text(" content "), findsNothing);
39-
});
40-
4122
testNewParser();
4223
}
4324

0 commit comments

Comments
 (0)