当前位置: 首页>>代码示例>>PHP>>正文


PHP MarkdownExtra::defaultTransform方法代码示例

本文整理汇总了PHP中Michelf\MarkdownExtra::defaultTransform方法的典型用法代码示例。如果您正苦于以下问题:PHP MarkdownExtra::defaultTransform方法的具体用法?PHP MarkdownExtra::defaultTransform怎么用?PHP MarkdownExtra::defaultTransform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Michelf\MarkdownExtra的用法示例。


在下文中一共展示了MarkdownExtra::defaultTransform方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: compile

 /**
  * compile
  *
  * @param \Twig_Compiler $compiler
  *
  * @return  void
  */
 public function compile(\Twig_Compiler $compiler)
 {
     $data = $this->getNode('value')->getAttribute('data');
     $markdown = new MarkdownExtra();
     $data = $markdown->defaultTransform($data);
     $compiler->write('echo ')->string($data)->raw(';');
 }
开发者ID:bgao-ca,项目名称:vaseman,代码行数:14,代码来源:MarkdownNode.php

示例2: generateHtml

 protected function generateHtml($source, $template, $refresh)
 {
     // Check that the source file is sane
     if (!file_exists($source)) {
         throw new \Exception("Unable to open source file: {$source}");
     }
     // Check that our template is sane, or set to the default one
     if (!$template) {
         $template = $this->app->defaultTemplate;
     }
     $templatePath = join(DIRECTORY_SEPARATOR, array($this->app->templatePath, basename($template)));
     $templateIndexPath = join(DIRECTORY_SEPARATOR, array($templatePath, 'index.html'));
     if (!file_exists($templateIndexPath)) {
         throw new \Exception("Unable to open template file: {$templateIndexPath}");
     }
     $style = $this->generateContent($templatePath, 'css');
     $links = $this->generateContent($templatePath, 'links');
     $templateContent = file_get_contents($templateIndexPath);
     $resumeContent = file_get_contents($source);
     // Process with Markdown, and then use SmartyPants to clean up punctuation.
     $resumeHtml = MarkdownExtra::defaultTransform($resumeContent);
     $resumeHtml = SmartyPants::defaultTransform($resumeHtml);
     // Construct the title for the html document from the h1 and h2 tags
     $simpleDom = HtmlDomParser::str_get_html($resumeHtml);
     $title = sprintf('%s | %s', $simpleDom->find('h1', 0)->innertext, $simpleDom->find('h2', 0)->innertext);
     // Render the Markdown into an html file with Mustache Templates
     $m = new \Mustache_Engine();
     $rendered = $m->render($templateContent, array('title' => $title, 'style' => $style, 'links' => $links, 'resume' => $resumeHtml, 'reload' => (bool) $refresh, 'refresh_rate' => $refresh));
     return $rendered;
 }
开发者ID:KartikPadmanabhan,项目名称:markdown-resume,代码行数:30,代码来源:HtmlCommand.php

示例3: parseMarkup

 /**
  * Runs the given string through the "markup" parser (MarkdownExtra).
  *
  * @param string $source
  *
  * @return string
  */
 public function parseMarkup($source)
 {
     $source = $this->callHook('modifySmartDownMarkupInput', $source);
     $source = MarkdownExtra::defaultTransform($source);
     $source = $this->callHook('modifySmartDownMarkupOutput', $source);
     return $source;
 }
开发者ID:kamicrafted,项目名称:designhub,代码行数:14,代码来源:Parser.php

示例4: render

 public function render($content)
 {
     $html = $this->getLayoutHead();
     $html .= MarkdownExtra::defaultTransform($content);
     $html .= $this->getLayoutFooter();
     return $html;
 }
开发者ID:mimiz,项目名称:silex-documentation-provider,代码行数:7,代码来源:Markdown.php

示例5: convert

 /**
  * Convert the input data
  * 
  * @param string $input The raw content without Front-matter
  * 
  * @return string
  */
 public function convert($input)
 {
     if (!is_string($input)) {
         throw new \InvalidArgumentException('Expected Markdown string to parse');
     }
     return MarkdownExtra::defaultTransform($input);
 }
开发者ID:pancao,项目名称:Spress,代码行数:14,代码来源:Markdown.php

示例6: convert

 /**
  * Convert the input data.
  *
  * @param string $input The raw content without Front-matter
  *
  * @return string
  */
 public function convert($input)
 {
     if (is_string($input) === false) {
         throw new \InvalidArgumentException('Expected a string value at MichelfMarkdown converter.');
     }
     return MarkdownExtra::defaultTransform($input);
 }
开发者ID:jjk-jacky,项目名称:Spress,代码行数:14,代码来源:MichelfMarkdownConverter.php

示例7: prepareData

 /**
  * prepareData
  *
  * @param \Windwalker\Data\Data $data
  *
  * @return  void
  */
 protected function prepareData($data)
 {
     $markdown = new MarkdownExtra();
     foreach ($data['posts'] as $post) {
         $post->link = Router::buildHtml('front:post_default', ['id' => $post->id, 'alias' => $post->alias]);
         $post->introtext = $markdown->defaultTransform($post->introtext);
         $post->author = Author::getPostAuthor($post->author);
         $post->created = new Date($post->created);
         $post->created = $post->created->format('F j, Y');
     }
     foreach ($data['statics'] as $post) {
         $post->link = Router::buildHtml('front:static_default', ['id' => $post->id, 'alias' => $post->alias]);
     }
     // Title
     if ($data->type == 'home') {
         $title = $data->blog->title;
         $suffix = '';
         $data->bodyClass = 'home posts page-' . $data->page;
     } else {
         $title = '';
         $suffix = $data->blog->title;
         $data->bodyClass = 'home posts page-' . $data->page;
     }
     $data->pageTitle = $title;
     $data->pageTitle .= $data->page > 1 ? ' - Page ' . $data->page : '';
     $data->pageTitle .= $suffix ? '|' . $suffix : '';
     // Meta
     $desc = $data->blog->description;
     $desc = OutputFilter::cleanText($desc);
     $desc = Utf8String::substr($desc, 0, 200);
     $data->meta->desc = $desc;
 }
开发者ID:Trult,项目名称:windspeaker-demo,代码行数:39,代码来源:PostsHtmlView.php

示例8: markdown

 public function markdown($value = '')
 {
     $text = $value;
     $html = MarkdownExtra::defaultTransform($text);
     $html = preg_replace('/<img src="images\\/([^\\"]*)"/i', '<img src="/posts/images/$1"', $html);
     return $html;
 }
开发者ID:hotli,项目名称:JustWriting,代码行数:7,代码来源:blog_lib.php

示例9: getContent

 public function getContent($page)
 {
     $pageFile = $this->getDocumentationPath() . "/{$page}.md";
     return $this->cache->rememberForever("doc_page_{$pageFile}_content", function () use($pageFile) {
         $data = $this->parser->parse($this->finder->get($pageFile));
         return MarkdownExtra::defaultTransform($data->getContent());
     });
 }
开发者ID:Houbsi,项目名称:Website,代码行数:8,代码来源:GitDocumentationRepository.php

示例10: render

 /**
  * render
  *
  * @return  string
  */
 public function render()
 {
     $md = file_get_contents($this->file->getPathname());
     $md = $this->prepareData($md);
     $markdown = new MarkdownExtra();
     $content = $markdown->defaultTransform($md);
     return $this->output = $this->renderLayout($content);
 }
开发者ID:bgao-ca,项目名称:vaseman,代码行数:13,代码来源:MarkdownProcessor.php

示例11: getParsedContent

 public function getParsedContent()
 {
     // Replace old announcements
     $oldAnnouncementDiv = ['<div style="color:#222;width:400px;font-family:Georgia, serif;text-align:justify;line-height:14pt;' . 'font-size:12pt;">', '<div style="color:#222;width:400px;font-family:Georgia, serif;text-align:left;line-height:14pt;' . 'font-size:12pt;">'];
     $newOldAnnouncementDiv = '<div style="width:400px;font-family:Georgia, serif;text-align:justify;' . 'line-height:14pt;font-size:12pt;">';
     $content = str_replace($oldAnnouncementDiv, $newOldAnnouncementDiv, $this->content);
     return MarkdownExtra::defaultTransform($content);
 }
开发者ID:jomo,项目名称:TheNightsWatch2,代码行数:8,代码来源:Announcement.php

示例12: toHtml

 public function toHtml($mdStr)
 {
     $html = $this->preTransformText($mdStr);
     $html = MarkdownExtra::defaultTransform($html);
     $html = SmartyPants::defaultTransform($html);
     $html = $this->postTransformText($html);
     return $html;
 }
开发者ID:strever,项目名称:blog,代码行数:8,代码来源:Markdowner.php

示例13: markdown

 public static function markdown($content)
 {
     $html = \Michelf\MarkdownExtra::defaultTransform($content);
     if (Options::get('habarimarkdown__smarty', false)) {
         $html = SmartyPants($html);
     }
     return $html;
 }
开发者ID:habari-extras,项目名称:habarimarkdown,代码行数:8,代码来源:habarimarkdown.plugin.php

示例14: toHTML

 public function toHTML($text)
 {
     $text = $this->preTransformText($text);
     $text = MarkdownExtra::defaultTransform($text);
     $text = SmartyPants::defaultTransform($text);
     $text = $this->postTransformText($text);
     return $text;
 }
开发者ID:Armen2004,项目名称:laravel_blog,代码行数:8,代码来源:Markdowner.php

示例15: prepareData

 /**
  * prepareData
  *
  * @param \Windwalker\Data\Data $data
  *
  * @return  void
  */
 protected function prepareData($data)
 {
     $markdown = new MarkdownExtra();
     foreach ($data['posts'] as $post) {
         $post->link = Router::buildHtml('front:post_default', ['id' => $post->id, 'alias' => $post->alias]);
         $post->introtext = $markdown->defaultTransform($post->introtext);
         $post->author = Author::getPostAuthor($post->author);
     }
 }
开发者ID:Trult,项目名称:windspeaker-demo,代码行数:16,代码来源:PostsFeedView.php


注:本文中的Michelf\MarkdownExtra::defaultTransform方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。