Permalink
Browse files

Correct class extends declarations, and configuration defaults for ex…

…tended classes. Add PEAR2\Text\Markdown_Extra test implementation.

git-svn-id: http://svn.php.net/repository/pear2/sandbox/Text_Markdown/trunk@300578 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
1 parent bf8ae54 commit 14ed531b96df95be60486f419ff263d77ddaacdc @saltybeagle saltybeagle committed Jun 18, 2010
@@ -24,7 +24,7 @@
*/
namespace PEAR2\Text;
-class Markdown_Apidoc extends Markdown
+class Markdown_Apidoc extends Markdown_Main
{
/**
*
@@ -65,4 +65,10 @@ class Markdown_Apidoc extends Markdown
'Markdown_Wiki_Escape',
),
);
+
+ function __construct()
+ {
+ $this->_config = $this->_config + $this->_Markdown_Apidoc + $this->_Markdown;
+ $this->_postConstruct();
+ }
}
@@ -26,7 +26,7 @@
*/
namespace PEAR2\Text;
-class Markdown_Extra extends Markdown
+class Markdown_Extra extends Markdown_Main
{
/**
*
@@ -66,4 +66,10 @@ class Markdown_Extra extends Markdown
'Markdown_Plugin_Break',
),
);
+
+ function __construct()
+ {
+ $this->_config = $this->_config + $this->_Markdown_Extra + $this->_Markdown;
+ $this->_postConstruct();
+ }
}
View
@@ -256,35 +256,10 @@ class Markdown_Main
*/
protected $_chars = '.{}\\';
-/**
+ /**
*
* Collection point for configuration values.
*
- * Note that you do not define config defaults in $_config directly.
- *
- * {{code: php
- * // DO NOT DO THIS
- * protected $_config = array(
- * 'foo' => 'bar',
- * 'baz' => 'dib',
- * );
- * }}
- *
- * Instead, define config defaults in a protected property named for the
- * class, withan underscore prefix.
- *
- * For exmple, a "Vendor_Class_Name" class would define the default
- * config array in "$_Vendor_Class_Name". This convention lets
- * child classes inherit parent config keys and values.
- *
- * {{code: php
- * // DO THIS INSTEAD
- * protected $_Vendor_Class_Name = array(
- * 'foo' => 'bar',
- * 'baz' => 'dib',
- * );
- * }}
- *
* @var array
*
*/
@@ -24,7 +24,7 @@
*/
namespace PEAR2\Text;
-class Markdown_Wiki extends Markdown
+class Markdown_Wiki extends Markdown_Main
{
/**
*
@@ -68,4 +68,10 @@ class Markdown_Wiki extends Markdown
'Markdown_Wiki_Escape',
),
);
+
+ function __construct()
+ {
+ $this->_config = $this->_config + $this->_Markdown_Wiki + $this->_Markdown;
+ $this->_postConstruct();
+ }
}
@@ -0,0 +1,20 @@
+<?php
+function autoload($class)
+{
+ $class = str_replace(array('PEAR2\\Text\\', '_'), array('', '/'), $class);
+ include $class . '.php';
+}
+
+spl_autoload_register("autoload");
+
+set_include_path(dirname(dirname(dirname(dirname(__FILE__)))).'/src/Text');
+
+ini_set('display_errors', true);
+error_reporting(E_ALL);
+
+
+
+function Markdown($text) {
+ $markdown = new \PEAR2\Text\Markdown_Extra();
+ return $markdown->transform($text);
+}

0 comments on commit 14ed531

Please sign in to comment.