File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ public function parse()
102
102
$ returnValue = $ element ->ownerDocument ->saveXML ($ element );
103
103
104
104
if ($ this ->format === Format::PLAIN_TEXT ) {
105
- $ returnValue = strip_tags ($ returnValue );
105
+ $ returnValue = Utils:: stripTagsMaintainWhitespace ($ returnValue );
106
106
}
107
107
108
108
$ returnValue = trim ($ returnValue );
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace DivineOmega \WikitextParser ;
4
+
5
+ class Utils
6
+ {
7
+ public static function stripTagsMaintainWhitespace (string $ html )
8
+ {
9
+ $ plaintext = $ html ;
10
+ $ plaintext = str_replace ('< ' , ' < ' , $ plaintext );
11
+ $ plaintext = strip_tags ($ plaintext );
12
+ $ plaintext = str_replace (' ' , ' ' , $ plaintext );
13
+
14
+ return $ plaintext ;
15
+ }
16
+ }
You can’t perform that action at this time.
0 commit comments