From 7fea3a6e3d7e78e943b6ee19f3d48b3414b7542f Mon Sep 17 00:00:00 2001
From: deva <deva>
Date: Sun, 14 Feb 2010 13:31:39 +0000
Subject: Add 'center' by writing '=some text='.

---
 utils/markdown.php | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

(limited to 'utils')

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;
 		}
-- 
cgit v1.2.3