/**
* @param \mdref\Path $path
*/
- function __construct(Path $path) {
+ function __construct(Path $path = null) {
$this->path = $path;
}
* @return string
*/
function __toString() {
+ if (!$this->path) {
+ return "";
+ }
try {
$r = fopen($this->path->getFullPath(".md"), "r");
$md = \MarkdownDocument::createFromStream($r);
}
return $html;
}
+
+ function quick($string) {
+ $md = \MarkdownDocument::createFromString($string);
+ $md->compile(\MarkdownDocument::AUTOLINK);
+ return $md->getHtml();
+ }
}
function readTitle() {
$this->openFile();
fseek($this->file, 1, SEEK_SET);
- return htmlspecialchars(fgets($this->file));
+ return fgets($this->file);
}
/**
fseek($this->file, 0, SEEK_SET);
fgets($this->file);
fgets($this->file);
- return htmlspecialchars(fgets($this->file));
+ return fgets($this->file);
}
/**
* @return \mdref\RefEntry
*/
function current() {
- return new RefEntry($this->path, $this->key());//$this->format($this->key());
+ return new RefEntry($this->path, $this->key());
}
/**
<?php $entry->recurse($refs, "/*.md", function($entry, $pattern, callable $recursor) { ?>
<ul>
<li><p><a href="<?=$entry->formatUrl()?>"><?=$entry->formatLink()?></a></p>
- <?=$entry->readDescription()?>
- <?php $recursor($entry, "/[A-Z]*.md") ?>
+ <?php
+ if (!isset($html)) {
+ $html = new \mdref\Markdown;
+ }
+ echo $html->quick($entry->readDescription());
+ $recursor($entry, "/[A-Z]*.md");
+ ?>
</li>
</ul>
<?php }); ?>
<?php foreach($sublisting as $entry) : ?>
<li>
<h3><a href="<?=$entry->formatUrl()?>"><?=$entry->formatLink(true)?></a></h3>
- <p><?=$entry->readDescription()?></p>
- <p><?=$entry->readTitle()?></p>
+ <p><?=$html->quick($entry->readDescription())?></p>
+ <p><?=$view->esc($entry->readTitle())?></p>
</li>
<?php endforeach; ?>
</ul>