plugin nl2br: add newlines to improve readability of the output

This commit is contained in:
Stephan Brunker 2020-05-22 17:57:44 +02:00
parent 8e24108b88
commit 9f0af1f275
2 changed files with 6 additions and 5 deletions

View File

@ -1,3 +1,4 @@
2.21.7: * add some newlines in output to make it better humanly readable
2.21.6: * add missing 'u' inline element 2.21.6: * add missing 'u' inline element
2.21.5: * nl2p: if the double newline contains spaces, e.g. \n \n, these 2.21.5: * nl2p: if the double newline contains spaces, e.g. \n \n, these
spaces are now ignored spaces are now ignored

View File

@ -18,7 +18,7 @@ class serendipity_event_nl2br extends serendipity_event
$propbag->add('description', PLUGIN_EVENT_NL2BR_DESC); $propbag->add('description', PLUGIN_EVENT_NL2BR_DESC);
$propbag->add('stackable', false); $propbag->add('stackable', false);
$propbag->add('author', 'Serendipity Team, Stephan Brunker'); $propbag->add('author', 'Serendipity Team, Stephan Brunker');
$propbag->add('version', '2.21.6'); $propbag->add('version', '2.21.7');
$propbag->add('requirements', array( $propbag->add('requirements', array(
'serendipity' => '1.6', 'serendipity' => '1.6',
'smarty' => '2.6.7', 'smarty' => '2.6.7',
@ -772,7 +772,7 @@ p.wl_notopbottom {
// concatenate closing tag if it's standard html // concatenate closing tag if it's standard html
if (in_array($tag, $this->isolation_block_elements) ) if (in_array($tag, $this->isolation_block_elements) )
{ {
$content .= $textarray[$i]; $content .= $textarray[$i] . "\n";
} }
} }
//closing blocktag or p parent - e.g. </table> or </td> //closing blocktag or p parent - e.g. </table> or </td>
@ -786,11 +786,11 @@ p.wl_notopbottom {
$content .= $this->nl2pblock(implode(array_slice($textarray,$start,$i-$start))) . "\n"; $content .= $this->nl2pblock(implode(array_slice($textarray,$start,$i-$start))) . "\n";
} else } else
{ {
$content .= implode(array_slice($textarray,$start,$i-$start)); $content .= implode(array_slice($textarray,$start,$i-$start)) . "\n";
} }
} }
//closing tag //closing tag
$content .= $textarray[$i]; $content .= $textarray[$i] . "\n";
$start = $i+1; $start = $i+1;
array_shift($tagstack); array_shift($tagstack);
@ -902,7 +902,7 @@ p.wl_notopbottom {
$bufferhastext = false; $bufferhastext = false;
//append textline //append textline
$content .= $textline[$j]; $content .= $textline[$j] . "\n";
//close open tags //close open tags
foreach($tagstack as $ins_tag) { $content .= $this->html_end_tag($this->extract_tag($ins_tag)); } foreach($tagstack as $ins_tag) { $content .= $this->html_end_tag($this->extract_tag($ins_tag)); }