예제 #1
0
파일: Menu.php 프로젝트: jpalala/codex
 /**
  * getDocumentBreadcrumb
  *
  * @param \Codex\Codex\Document $document
  */
 public function getDocumentBreadcrumb(Document $document)
 {
     $url = $document->url();
     $item = $this->findItemBy('href', $url);
     $parents = [];
     if (isset($item)) {
         $parents = $this->getItemParents($item);
         $item['last'] = true;
         $parents[] = $item;
     }
     return $parents;
 }
예제 #2
0
 /**
  * Handle the filter.
  *
  * @param \Codex\Codex\Document $document
  * @param array $config
  * @return void
  */
 public function handle(Document $document, array $config)
 {
     $content = $document->getContent();
     $pattern = '/<!---([\\w\\W]*?)-->/';
     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);
         $attributes = array_replace_recursive($document->getAttributes(), Yaml::parse($matches[1]));
         $document->setAttributes($attributes);
     }
     $document->setContent($content);
 }
예제 #3
0
 /**
  * Handle the filter.
  *
  * @param  \Codex\Codex\Document  $document
  * @param  array                  $config
  * @return void
  */
 public function handle(Document $document, array $config)
 {
     $document->setContent($this->parsedown->text($document->getContent()));
 }