summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruckelman <uckelman@nomic.net>2010-04-25 21:15:18 +0000
committeruckelman <uckelman@nomic.net>2010-04-25 21:15:18 +0000
commitec947b4b08de552c1c9970cb596ac08c7e5a46e6 (patch)
tree2a22768091f19d0d4115dad7112180d2f2ca72b3
parent8a4f825e50db60a474229391601b28282a0d9c71 (diff)
Fixed list spacing.
git-svn-id: https://vassalengine.svn.sourceforge.net/svnroot/vassalengine/site-src/trunk@6760 67b53d14-2c14-4ace-a08f-0dab2b34000c
-rw-r--r--src/BBCodeParser.php18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/BBCodeParser.php b/src/BBCodeParser.php
index 1d15763..87c4175 100644
--- a/src/BBCodeParser.php
+++ b/src/BBCodeParser.php
@@ -103,17 +103,22 @@ class BBCodeParser {
$c = array_pop($list_counter_stack);
if (is_int($c)) {
- $out .= $c . '. ';
+ $out .= $c . '.';
$list_counter_stack[] = $c + 1;
}
else if ($c == '*') {
- $out .= $c . ' ';
+ $out .= $c;
$list_counter_stack[] = '*';
}
else {
- $out .= $c . '. ';
+ $out .= $c . '.';
$list_counter_stack[] = chr(ord($c)+1);
}
+
+ if ($in[$i] != ' ') {
+ # add space after item label only if there is not one already
+ $out .= ' ';
+ }
break;
case 'img':
$text_stack[] = $out;
@@ -169,13 +174,18 @@ class BBCodeParser {
case 'list:o':
case 'list:u':
# TODO: untested
- $out .= "\n";
array_pop($list_counter_stack);
+
+ if ($in[$i] != "\n") {
+ # add newline after list only if there is not one already
+ $out .= "\n";
+ }
break;
case '*':
case '*:m':
# TODO: untested
if ($in[$i] != "\n") {
+ # add newline after item only if there is not one already
$out .= "\n";
}
break;