當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Markdown_Parser類代碼示例

本文整理匯總了PHP中Markdown_Parser的典型用法代碼示例。如果您正苦於以下問題:PHP Markdown_Parser類的具體用法?PHP Markdown_Parser怎麽用?PHP Markdown_Parser使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Markdown_Parser類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: smarty_modifier_markdown

function smarty_modifier_markdown($text)
{
    $parser = new Markdown_Parser();
    $parser->no_markup = true;
    $parser->no_entities = true;
    $html = $parser->transform($text);
    return $html;
}
開發者ID:OwlManAtt,項目名稱:smarty-ys,代碼行數:8,代碼來源:modifier.markdown.php

示例2: format

 /**
  * @param string $text Markdown formatted text.
  * @return string HTML
  */
 public static function format($text)
 {
     static $markdown;
     if (!isset($markdown)) {
         $markdown = new Markdown_Parser();
     }
     foreach (PicoraEvent::getObserverList('PicoraTextile.beforeFormat') as $callback) {
         call_user_func($callback, $text);
     }
     $output = $markdown->transform($text);
     foreach (PicoraEvent::getObserverList('PicoraTextile.afterFormat') as $callback) {
         call_user_func($callback, $output);
     }
     return $output;
 }
開發者ID:r8-forks,項目名稱:Picora,代碼行數:19,代碼來源:PicoraMarkdown.php

示例3: parseMarkdown

 static function parseMarkdown($text)
 {
     static $parser = null;
     if (is_null($parser)) {
         $parser = new Markdown_Parser();
     }
     return $parser->transform($text);
 }
開發者ID:jstanden,項目名稱:devblocks,代碼行數:8,代碼來源:Devblocks.class.php

示例4: markdown2html

 public static function markdown2html($text)
 {
     static $parser;
     if (!isset($parser)) {
         $parser = new Markdown_Parser();
     }
     return $parser->transform($text);
 }
開發者ID:290329416,項目名稱:guahao,代碼行數:8,代碼來源:markdown.php

示例5: preview

 public function preview()
 {
     require_once 'classMarkdown.php';
     $markdown = new Markdown_Parser();
     echo $markdown->transform($_POST['data']);
 }
開發者ID:crick-ru,項目名稱:wolfcms,代碼行數:6,代碼來源:MarkdownController.php

示例6: text_to_html

 public function text_to_html($str)
 {
     switch (PERCH_APPS_EDITOR_MARKUP_LANGUAGE) {
         case 'textile':
             $Textile = new Textile();
             $str = $Textile->TextileThis($str);
             break;
         case 'markdown':
             $Markdown = new Markdown_Parser();
             $str = $Markdown->transform($str);
             break;
     }
     if (defined('PERCH_XHTML_MARKUP') && PERCH_XHTML_MARKUP == false) {
         $str = str_replace(' />', '>', $str);
     }
     return $str;
 }
開發者ID:pete-naish,項目名稱:4hair,代碼行數:17,代碼來源:PerchEvents_Events.class.php

示例7: filter_post_content_out

 public static function filter_post_content_out($content, $post)
 {
     static $textile;
     static $markdown;
     $markup = Options::get('Markup__markup_type');
     switch ($markup) {
         case 'markdown':
             //				return Markdown( $content );
             if (!isset($markdown)) {
                 $markdown = new Markdown_Parser();
             }
             return $markdown->transform($content);
             break;
         case 'textile':
             if (!isset($textile)) {
                 $textile = new Textile();
             }
             return $textile->TextileThis($content);
             break;
         case 'html':
         default:
             return $content;
     }
 }
開發者ID:anupom,項目名稱:my-blog,代碼行數:24,代碼來源:markup.plugin.php

示例8: parse_markdown

 /**
  * Parse markdown
  *
  * @param $markdown
  * @return string The HTML
  */
 function parse_markdown($markdown)
 {
     if (!class_exists('Markdown_Parser')) {
         include plugin_dir_path(__FILE__) . 'inc/markdown.php';
     }
     $parser = new Markdown_Parser();
     return $parser->transform($markdown);
 }
開發者ID:DonMehdi,項目名稱:wordpress_website,代碼行數:14,代碼來源:siteorigin-widget.class.php

示例9: isset

<?php

require_once 'libs/markdown.php';
$article = 'articles/' . $_GET['article'] . '.md';
$theme = isset($_GET['theme']) ? $_GET['theme'] : 'notmyidea';
if (file_exists($article)) {
    $content = file_get_contents($article);
    $parser = new Markdown_Parser();
    include 'themes/' . $theme . '/_header.php';
    echo $parser->transform($content);
    include 'themes/' . $theme . '/_footer.php';
}
開發者ID:almet,項目名稱:markdown-doc,代碼行數:12,代碼來源:index.php

示例10: tc_post_process

function tc_post_process($text, $do_text = '', $do_char = '')
{
    if ('textile2' == $do_text) {
        require_once 'text-control/textile2.php';
        $t = new Textile();
        $text = $t->process($text);
    } else {
        if ('textile1' == $do_text) {
            require_once 'text-control/textile1.php';
            $text = textile($text);
        } else {
            if ('markdown' == $do_text) {
                require_once 'text-control/markdown.php';
                //$text = Markdown_Parser($text);
                $o = new Markdown_Parser();
                return $o->transform($text);
            } else {
                if ('txt2tags' == $do_text) {
                    require_once 'text-control/txt2tags.class.php';
                    $x = new T2T($text);
                    $x->go();
                    return $text = $x->bodyhtml;
                } else {
                    if ('wpautop' == $do_text) {
                        $text = wpautop($text);
                    } else {
                        if ('nl2br' == $do_text) {
                            $text = nl2br($text);
                        } else {
                            if ('none' == $do_text) {
                                $text = $text;
                            } else {
                                $text = wpautop($text);
                            }
                        }
                    }
                }
            }
        }
    }
    if ('smartypants' == $do_char) {
        require_once 'text-control/smartypants.php';
        $text = SmartyPants($text);
    } else {
        if ('wptexturize' == $do_char) {
            $text = wptexturize($text);
        } else {
            if ('none' == $do_char) {
                $text = $text;
            } else {
                $text = wptexturize($text);
            }
        }
    }
    return $text;
}
開發者ID:hunterfu,項目名稱:plugins,代碼行數:56,代碼來源:text-control.php

示例11: parse

 /**
  * Parses $text containing doc-markdown text and generates the correct
  * HTML
  *
  * ### Options:
  *
  * - stripHtml - remove any HTML before parsing.
  * - engine: default, markdown, markdown_extra
  *
  * IDEAS
  * - elements: allow further elemens like video, latex, ... (use registerElement to register new stuff)
  *
  * @param string $text Text to be converted
  * @param array $options Array of options for converting
  * @return string Parsed HTML
  */
 public function parse($text, $options = array())
 {
     $defaults = array('engine' => 'default');
     $options = am($defaults, $options);
     if (!empty($options['stripHtml'])) {
         $text = strip_tags($text);
     }
     if ($options['engine'] == 'markdown_extra') {
         App::import('Vendor', 'MarkupParsers.markdown/markdown');
         $Markdown = new MarkdownExtra_Parser();
         return trim($Markdown->transform($text));
     } elseif ($options['engine'] == 'markdown') {
         App::import('Vendor', 'MarkupParsers.markdown/markdown');
         $Markdown = new Markdown_Parser();
         return trim($Markdown->transform($text));
     }
     $this->_placeHolders = array();
     $text = str_replace("\r\n", "\n", $text);
     $text = str_replace("\t", str_repeat(' ', $this->spacesPerTab), $text);
     $text = $this->_runBlocks($text);
     return $text;
 }
開發者ID:jxav,項目名稱:markup_parsers,代碼行數:38,代碼來源:MarkdownParser.php

示例12: function

<?php

use Verbier\Application;
Application::registerPlugin('Markdown', function ($app) {
    $app->helper('markdown', function ($text) {
        $parser = new Markdown_Parser();
        return $parser->transform($text);
    });
});
define('MARKDOWN_VERSION', "1.0.1n");
define('MARKDOWN_EMPTY_ELEMENT_SUFFIX', " />");
define('MARKDOWN_TAB_WIDTH', 4);
class Markdown_Parser
{
    # Regex to match balanced [brackets].
    # Needed to insert a maximum bracked depth while converting to PHP.
    var $nested_brackets_depth = 6;
    var $nested_brackets_re;
    var $nested_url_parenthesis_depth = 4;
    var $nested_url_parenthesis_re;
    # Table of hash values for escaped characters:
    var $escape_chars = '\\`*_{}[]()>#+-.!';
    var $escape_chars_re;
    # Change to ">" for HTML output.
    var $empty_element_suffix = MARKDOWN_EMPTY_ELEMENT_SUFFIX;
    var $tab_width = MARKDOWN_TAB_WIDTH;
    # Change to `true` to disallow markup or entities.
    var $no_markup = false;
    var $no_entities = false;
    # Predefined urls and titles for reference links and images.
    var $predef_urls = array();
開發者ID:niceboy120,項目名稱:verbier,代碼行數:31,代碼來源:Markdown.php

示例13: parseMarkdown

 /**
  * Runs a string through Markdown.
  *
  * @param string $str
  *
  * @return string
  */
 public static function parseMarkdown($str)
 {
     if (!class_exists('\\Markdown_Parser', false)) {
         require_once craft()->path->getFrameworkPath() . 'vendors/markdown/markdown.php';
     }
     $md = new \Markdown_Parser();
     return $md->transform($str);
 }
開發者ID:ericnormannn,項目名稱:m,代碼行數:15,代碼來源:StringHelper.php

示例14: filter

 /**
  * @see IFilter::filter()
  */
 public function filter(HamlNode $node)
 {
     if (null === $node) {
         throw new Exception("MarkdownFilter: node is null.");
     }
     $children = $node->getChildren();
     $output = '';
     $indent = 999999999;
     // gets the lowes indent among the children to set as base
     foreach ($children as $child) {
         if ($indent > ($ind = $child->getIndentationLevel())) {
             $indent = $ind;
         }
     }
     foreach ($children as $childNode) {
         $output .= substr($childNode->getRawHaml(), $indent) . "\n";
     }
     return $this->parser->transform($output);
 }
開發者ID:hamlphp,項目名稱:hamlphp,代碼行數:22,代碼來源:MarkdownFilter.php

示例15: teardown

 function teardown()
 {
     #
     # Clearing Extra-specific variables.
     #
     $this->footnotes = array();
     $this->footnotes_ordered = array();
     $this->abbr_desciptions = array();
     $this->abbr_word_re = '';
     parent::teardown();
 }
開發者ID:bshaffer,項目名稱:Symplist,代碼行數:11,代碼來源:MarkdownExtraParser.class.php


注:本文中的Markdown_Parser類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。