=== modified file 'markdown.module'
--- old/markdown.module 2009-06-04 16:02:03 +0000
+++ new/markdown.module 2009-06-04 16:47:47 +0000
@@ -53,17 +53,33 @@
* Implementation of hook_filter_tips().
*/
function markdown_filter_tips($delta = 0, $format = -1, $long) {
- if ($long) {
- return t('Quick Tips:
- - Two or more spaces at a line\'s end = Line break
- - Double returns = Paragraph
- - *Single asterisks* or _single underscores_ = Emphasis
- - **Double** or __double__ = Strong
- - This is [a link](http://the.link.example.com "The optional title text")
-
For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.');
+ if (variable_get("markdown_extra_$format", 1) == 1) {
+ if ($long) {
+ return t('Quick Tips:
+ - Two or more spaces at a line\'s end = Line break
+ - Double returns = Paragraph
+ - *Single asterisks* or _single underscores_ = Emphasis
+ - **Double** or __double__ = Strong
+ - This is [a link](http://the.link.example.com "The optional title text")
+
For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.');
+ }
+ else {
+ return t('You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.', array('@filter_tips' => url('filter/tips'), '@markdown_extra' => 'http://michelf.com/projects/php-markdown/extra/'));
+ }
}
else {
- return t('You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.', array('@filter_tips' => url('filter/tips'), '@markdown_extra' => 'http://michelf.com/projects/php-markdown/extra/'));
+ if ($long) {
+ return t('Quick Tips:
+ - Two or more spaces at a line\'s end = Line break
+ - Double returns = Paragraph
+ - *Single asterisks* or _single underscores_ = Emphasis
+ - **Double** or __double__ = Strong
+ - This is [a link](http://the.link.example.com "The optional title text")
+
For complete details on the Markdown syntax, see the Markdown documentation.');
+ }
+ else {
+ return t('You can use Markdown syntax to format and style the text.', array('@filter_tips' => url('filter/tips')));
+ }
}
}
@@ -107,7 +123,29 @@
function _markdown_process($text, $format) {
if (!empty($text)) {
include_once drupal_get_path('module', 'markdown') .'/markdown.php';
- $text = Markdown($text);
+
+ if(variable_get("markdown_extra_$format", 1) == 1) {
+
+ # Setup static parser variable.
+ static $markdown_extra_parser;
+ if (!isset($markdown_extra_parser)) {
+ $markdown_extra_parser = new MarkdownExtra_Parser;
+ }
+
+ # Transform text using parser.
+ $text = $markdown_extra_parser->transform($text);
+ } else {
+
+ # Setup static parser variable.
+ static $markdown_parser;
+ if (!isset($markdown_parser)) {
+ $markdown_parser = new Markdown_Parser;
+ }
+
+ # Transform text using parser.
+ $text = $markdown_parser->transform($text);
+
+ }
}
return $text;
}
@@ -121,6 +159,12 @@
'#type' => 'fieldset',
'#title' => t('Markdown'),
);
+ $form['markdown_wrapper']["markdown_extra_$format"] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Use Markdown Extra Syntax'),
+ '#default_value' => variable_get("markdown_extra_$format", 1),
+ '#description' => t('If enabled, use the full Markdown Extra syntax instead of vanilla Markdown.'),
+ );
$links = array(
'Markdown PHP Version: '. MARKDOWN_VERSION .'',
'Markdown Extra Version: '. MARKDOWNEXTRA_VERSION .'',