$this->baseUrl = $baseUrl;
}
+ function getBaseUrl() {
+ return $this->baseUrl;
+ }
+
/**
* Find a markdown reference file in one REFPATH. If nothing could be found
* an empty Path will be returned.
$file = $this->getPath();
if (!$file->isFile()) {
- throw new \Exception("Not a file: '{$this->entry}'");
+ throw new \Exception("Not a file: '{$file}'");
}
if (!$this->file = fopen($file->getFullPath(".md"), "r")) {
- throw new \Exception("Could not open {$this->entry}");
+ throw new \Exception("Could not open {$file}");
}
}
}
$this->entry);
}
}
+
+ function recurse(Finder $refs, $pattern, callable $cb) {
+ $path = $refs->find($refs->getBaseUrl()->mod($this->entry));
+ foreach (new RefListing($path, $refs->glob($path, $pattern)) as $entry) {
+ /* @var $entry RefEntry */
+ $cb($entry, $pattern, function($entry, $pattern) use ($refs, $cb) {
+ $entry->recurse($refs, $pattern, $cb);
+ });
+ }
+ }
}
\ No newline at end of file
margin: 1em 2em;
}
+li>p {
+ margin: 1em 0;
+}
+
blockquote {
border-top: 1px solid #800000;
border-bottom: 1px solid #800000;
<h2>Available References</h2>
<?php foreach ($listing as $entry) : ?>
<h3><a href="<?=$entry->formatUrl()?>"><?=$entry->formatLink()?></a></h3>
+ <?php $entry->recurse($refs, "/*.md", function($entry, $pattern, callable $recursor) { ?>
<ul>
- <?php foreach (new mdref\RefListing($path = $refs->find($baseUrl->mod($entry->formatUrl())), $refs->glob($path, "/*.md")) as $entry) : ?>
- <li><a href="<?=$entry->formatUrl()?>"><?=$entry->formatLink()?></a><br>
- <?=$entry->readDescription()?></li>
- <?php endforeach; ?>
+ <li><p><a href="<?=$entry->formatUrl()?>"><?=$entry->formatLink()?></a></p>
+ <?=$entry->readDescription()?>
+ <?php $recursor($entry, "/[A-Z]*.md") ?>
+ </li>
</ul>
+ <?php }); ?>
<?php endforeach; ?>
<?php endif; ?>
<?php endif; ?>