/[drupal]/contributions/modules/marksmarty/marksmarty.module
ViewVC logotype

Diff of /contributions/modules/marksmarty/marksmarty.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.13.4.2, Sun May 14 20:39:38 2006 UTC revision 1.13.4.3, Sat Oct 7 19:39:47 2006 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: marksmarty.module,v 1.13 2005/03/20 16:57:02 teradome Exp $  // $Id: marksmarty.module,v 1.13.4.2 2006/05/14 20:39:38 teradome Exp $
3    
4  /********************************************************************  /********************************************************************
5   * Drupal Hooks   * Drupal Hooks
# Line 35  function marksmarty_filter_tips($delta = Line 35  function marksmarty_filter_tips($delta =
35        </ul>For complete details on the Markdown syntax, see the <a href="http://daringfireball.net/projects/markdown/syntax">Markdown documentation</a>.');        </ul>For complete details on the Markdown syntax, see the <a href="http://daringfireball.net/projects/markdown/syntax">Markdown documentation</a>.');
36    }    }
37    else {    else {
38      $the_output = t('You can use '.l('Markdown syntax', 'filter/tips').' to format and style the text.');      $the_output = t('You can use %link to format and style the text.', array('%link' => l(t('Markdown syntax'), 'filter/tips')));
39    }    }
40    
41    return $the_output;    return $the_output;
# Line 44  function marksmarty_filter_tips($delta = Line 44  function marksmarty_filter_tips($delta =
44  function marksmarty_help($in_section = 'admin/help#marksmarty') {  function marksmarty_help($in_section = 'admin/help#marksmarty') {
45    switch ($in_section) {    switch ($in_section) {
46      case 'admin/modules#description':      case 'admin/modules#description':
47        $the_output = 'Allows content to be submitted using Markdown, a simple plain-text syntax that is filtered into valid XHTML, and converts plain ASCII characters to Unicode entities using SmartyPants.';        $the_output = t('Allows content to be submitted using Markdown, a simple plain-text syntax that is filtered into valid XHTML, and converts plain ASCII characters to Unicode entities using SmartyPants.');
48        break;        break;
49    
50      case 'admin/help#marksmarty':      case 'admin/help#marksmarty':
51        $the_output = '<p>The Markdown with SmartyPants module allows you to enter content using <a href="http://daringfireball.net/projects/markdown">Markdown</a>, a simple plain-text syntax that is filtered into valid XHTML, and will automatically convert plain ASCII characters to their proper Unicode entities in context ("curly quotes," et al.) using <a href="http://daringfireball.net/projects/smartypants">SmartyPants</a>.</p>';        $the_output = t('<p>The Markdown with SmartyPants module allows you to enter content using <a href="http://daringfireball.net/projects/markdown">Markdown</a>, a simple plain-text syntax that is filtered into valid XHTML, and will automatically convert plain ASCII characters to their proper Unicode entities in context ("curly quotes," et al.) using <a href="http://daringfireball.net/projects/smartypants">SmartyPants</a>.</p>');
52        break;        break;
53    }    }
54    
55    return t($the_output);    return $the_output;
56  }  }
57    
58  /********************************************************************  /********************************************************************
# Line 62  function marksmarty_help($in_section = ' Line 62  function marksmarty_help($in_section = '
62  function _marksmarty_process($text, $format) {  function _marksmarty_process($text, $format) {
63    require_once(dirname(__FILE__) . '/markdown.php');    require_once(dirname(__FILE__) . '/markdown.php');
64    require_once(dirname(__FILE__) . '/smartypants.php');    require_once(dirname(__FILE__) . '/smartypants.php');
65      if (variable_get("marksmarty_is_markdown_on_$format", 1) == 1) {
66        $text = Markdown($text);
67      }
68    if (variable_get("marksmarty_is_smarty_on_$format", 1) == 1) {    if (variable_get("marksmarty_is_smarty_on_$format", 1) == 1) {
69      global $smartypants_attr;      global $smartypants_attr;
70      $smartypants_attr = variable_get("marksmarty_smarty_hyphens_$format", 0) + 1;      $smartypants_attr = variable_get("marksmarty_smarty_hyphens_$format", 0) + 1;
71      return SmartyPants(Markdown($text));      $text = SmartyPants($text);
   }  
   else {  
     return Markdown($text);  
72    }    }
73      return $text;
74  }  }
75    
76  function _marksmarty_settings($format) {  function _marksmarty_settings($format) {
77      require_once(dirname(__FILE__) . '/markdown.php');
78      require_once(dirname(__FILE__) . '/smartypants.php');
79    $form['markdown_settings'] = array(    $form['markdown_settings'] = array(
80      '#type' => 'fieldset',      '#type' => 'fieldset',
81      '#title' => t('Markdown with SmartyPants'),      '#title' => t('Markdown with SmartyPants'),
# Line 81  function _marksmarty_settings($format) { Line 84  function _marksmarty_settings($format) {
84    );    );
85    $form['markdown_settings']['help'] = array(    $form['markdown_settings']['help'] = array(
86      '#type' => 'markup',      '#type' => 'markup',
87      '#value' => '<p>Markdown is enabled. Please read the <a href="http://daringfireball.net/projects/markdown/syntax">Markdown documentation</a> for full details on its formatting syntax.</p>',      '#value' => '<p>Please read the <a href="http://daringfireball.net/projects/markdown/syntax">Markdown documentation</a> for full details on its formatting syntax.</p>',
88      );
89      $form['markdown_settings']["marksmarty_is_markdown_on_$format"] = array(
90        '#type' => 'select',
91        '#title' => t('Enable Markdown?'),
92        '#default_value' => variable_get("marksmarty_is_markdown_on_$format", 1),
93        '#options' => array(0 => t('No'), 1 => t('Yes')),
94    );    );
95    $form['markdown_settings']["marksmarty_is_smarty_on_$format"] = array(    $form['markdown_settings']["marksmarty_is_smarty_on_$format"] = array(
96      '#type' => 'select',      '#type' => 'select',

Legend:
Removed from v.1.13.4.2  
changed lines
  Added in v.1.13.4.3

  ViewVC Help
Powered by ViewVC 1.1.2