fix preview when no header
fix search or tag with no param
This commit is contained in:
parent
f9a4005d11
commit
5589822afb
|
@ -79,11 +79,11 @@
|
||||||
$pos = 0;
|
$pos = 0;
|
||||||
if (str_starts_with($content, '---'))
|
if (str_starts_with($content, '---'))
|
||||||
{
|
{
|
||||||
$pos = strpos($content, '---', 3);
|
$pos = strpos($content, '---', 3) + 3;
|
||||||
}
|
}
|
||||||
$Parsedown = new Parsedown();
|
$Parsedown = new Parsedown();
|
||||||
$Parsedown->setBreaksEnabled(true);
|
$Parsedown->setBreaksEnabled(true);
|
||||||
echo $Parsedown->text('# ' . $title . "\r\n" . substr($content, $pos + 3));
|
echo $Parsedown->text('# ' . $title . "\r\n" . substr($content, $pos));
|
||||||
$nextpage = '';
|
$nextpage = '';
|
||||||
}
|
}
|
||||||
else if (isset($_GET['open']))
|
else if (isset($_GET['open']))
|
||||||
|
@ -165,7 +165,7 @@
|
||||||
$name = basename($path);
|
$name = basename($path);
|
||||||
if (!str_ends_with($name, '.del'))
|
if (!str_ends_with($name, '.del'))
|
||||||
{
|
{
|
||||||
if (isset($_GET['search']) || isset($_GET['tags']))
|
if ($_GET['param'] && (isset($_GET['search']) || isset($_GET['tags'])))
|
||||||
{
|
{
|
||||||
$content = file_get_contents($path);
|
$content = file_get_contents($path);
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo '<div><a href=index.php?open=true¶m=' . urlencode($name) . '>' . $name .'</a>';
|
echo '<div><a href=index.php?open=true¶m=' . urlencode($name) . '>' . $name .'</a>';
|
||||||
if (isset($_GET['tags']))
|
if (isset($content) && isset($_GET['tags']))
|
||||||
{
|
{
|
||||||
$tags = array();
|
$tags = array();
|
||||||
$hastags = preg_match_all('/tags:(.*)/i', $content, $tags, PREG_SET_ORDER);
|
$hastags = preg_match_all('/tags:(.*)/i', $content, $tags, PREG_SET_ORDER);
|
||||||
|
|
Loading…
Reference in New Issue