Skip to content

Commit

Permalink
plugin nl2br: add newlines to improve readability of the output
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanbrunker committed May 22, 2020
1 parent 376e197 commit dd4d5ba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions plugins/serendipity_event_nl2br/Changelog
Original file line number Diff line number Diff line change
@@ -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.5: * nl2p: if the double newline contains spaces, e.g. \n \n, these
spaces are now ignored
Expand Down
10 changes: 5 additions & 5 deletions plugins/serendipity_event_nl2br/serendipity_event_nl2br.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function introspect(&$propbag)
$propbag->add('description', PLUGIN_EVENT_NL2BR_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Serendipity Team, Stephan Brunker');
$propbag->add('version', '2.21.6');
$propbag->add('version', '2.21.7');
$propbag->add('requirements', array(
'serendipity' => '1.6',
'smarty' => '2.6.7',
Expand Down Expand Up @@ -772,7 +772,7 @@ function nl2p($otext)
// concatenate closing tag if it's standard html
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>
Expand All @@ -786,11 +786,11 @@ function nl2p($otext)
$content .= $this->nl2pblock(implode(array_slice($textarray,$start,$i-$start))) . "\n";
} else
{
$content .= implode(array_slice($textarray,$start,$i-$start));
$content .= implode(array_slice($textarray,$start,$i-$start)) . "\n";
}
}
//closing tag
$content .= $textarray[$i];
$content .= $textarray[$i] . "\n";

$start = $i+1;
array_shift($tagstack);
Expand Down Expand Up @@ -902,7 +902,7 @@ function nl2pblock($textstring)
$bufferhastext = false;

//append textline
$content .= $textline[$j];
$content .= $textline[$j] . "\n";

//close open tags
foreach($tagstack as $ins_tag) { $content .= $this->html_end_tag($this->extract_tag($ins_tag)); }
Expand Down

0 comments on commit dd4d5ba

Please sign in to comment.