summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordeva <deva>2010-02-14 13:31:39 +0000
committerdeva <deva>2010-02-14 13:31:39 +0000
commit7fea3a6e3d7e78e943b6ee19f3d48b3414b7542f (patch)
treec86f84390dd1138a32a6a41451d9c7c939d41be8
parent6e765a5628404c966a02bfc88cccf4bdff75bedb (diff)
Add 'center' by writing '=some text='.
-rw-r--r--utils/markdown.php13
1 files changed, 10 insertions, 3 deletions
diff --git a/utils/markdown.php b/utils/markdown.php
index dd6416b..89a85b2 100644
--- a/utils/markdown.php
+++ b/utils/markdown.php
@@ -2449,9 +2449,16 @@ class MarkdownExtra_Parser extends Markdown_Parser {
$is_p = !preg_match('/^B\x1A[0-9]+B|^C\x1A[0-9]+C$/', $value);
if ($is_p) {
- $value = "<div class=\"paragraph\">" . $value . "</div>";
- //$value = "<p>" . $value . "</p>";
- //$value = "<div>$value</div>";
+ $centerl = "";
+ $centerr = "";
+ if(strlen($value) > 2 && $value[0] == '=' &&
+ $value[strlen($value)-1] == '=') {
+ $centerl = "<div style=\"text-align: center;\">";
+ $centerr = "</div>";
+ $value = substr($value, 1, strlen($value) - 2);
+ }
+ $value = "<div class=\"paragraph\">" .
+ $centerl . $value . $centerr . "</div>";
}
$grafs[$key] = $value;
}