示例#1
0
 protected function pattern(Document $document, $pattern)
 {
     $content = $document->getContent();
     if (preg_match($pattern, $content, $matches) === 1) {
         // not really required when using html doc tags. But in case it's frontmatter, it should be removed
         $content = preg_replace($pattern, '', $content);
         $data = Yaml::parse($matches[1]);
         if (is_array($data)) {
             $attributes = array_replace_recursive($document->getAttributes(), $data);
             $document->setAttributes($attributes);
         }
     }
     $document->setContent($content);
     return $this;
 }
 public function __construct(Codex $codex, Project $project, Filesystem $files, Container $container, Cache $cache)
 {
     ini_set('memory_limit', '2G');
     $path = $project->path($project->config('hooks.sassdoc.path'));
     $pathName = 'sassdoc';
     parent::__construct($codex, $project, $files, $container, $path, $pathName);
     $this->mergeAttributes($project->config('hooks.sassdoc'));
     $this->setPath($path);
     $this->cache = $cache;
 }
示例#3
0
 /**
 * Handle the filter.
 *
 * @param  \Codex\Core\Document $document
 * @param  array                $config
 *
 *@return void
 */
 public function handle(Document $document, array $config)
 {
     $this->parsedown->setConfig($config);
     $document->setContent($this->parsedown->text($document->getContent()));
 }