* List of first level entries
* @var array
*/
- private $list;
+ private $list = array();
/**
* The list iterator
* @param \mdref\Repo $repo
*/
public function __construct($path, Repo $repo) {
- if (!($list = glob("$path/*.md"))) {
+ if (realpath($path)."/" === $repo->getPath()) {
+ $list = [$path ."/". $repo->getName() .".md"];
+ } elseif (!($list = glob("$path/*.md"))) {
$list = glob("$path/*/*.md");
}
- $this->list = array_filter($list, $this->generateFilter($list));
- sort($this->list, SORT_STRING);
+ if ($list) {
+ $this->list = array_filter($list, $this->generateFilter($list));
+ sort($this->list, SORT_STRING);
+ }
$this->repo = $repo;
}