Rename gallery generation script, write gallery and original photo name in Markdown file, simplify next/previous
This commit is contained in:
@@ -13,13 +13,13 @@ layout: post
|
|||||||
</div>
|
</div>
|
||||||
<ul style="margin-top:0;">
|
<ul style="margin-top:0;">
|
||||||
{% if page.previous %}
|
{% if page.previous %}
|
||||||
<li><a href="/{{ site.baseurl }}{{ page.previous }}.html" rel="prev"> ← </a></li>
|
<li><a href="/{{ site.baseurl }}/gallery/{{ page.gallery }}/{{ page.previous }}.html" rel="prev"> ← </a></li>
|
||||||
{% else %}
|
{% else %}
|
||||||
<li><span class="noanchor"> ← </span></li>
|
<li><span class="noanchor"> ← </span></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if page.next %}
|
{% if page.next %}
|
||||||
<li><a href="/{{ site.baseurl }}{{ page.next }}.html" rel="next"> → </a></li>
|
<li><a href="/{{ site.baseurl }}/gallery/{{ page.gallery }}/{{ page.next }}.html" rel="next"> → </a></li>
|
||||||
{% else %}
|
{% else %}
|
||||||
<li><span class="noanchor"> → </span></li>
|
<li><span class="noanchor"> → </span></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -94,13 +94,13 @@ layout: post
|
|||||||
<div class="meta-navigate screen-only">
|
<div class="meta-navigate screen-only">
|
||||||
{% if page.next %}
|
{% if page.next %}
|
||||||
<div style="float:right;">
|
<div style="float:right;">
|
||||||
<a href="/{{ site.baseurl }}{{ page.next }}.html" rel="next">Next Photo »</a>
|
<a href="/{{ site.baseurl }}/gallery/{{ page.gallery }}/{{ page.next }}.html" rel="next">Next Photo »</a>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if page.previous %}
|
{% if page.previous %}
|
||||||
<div style="float:left;">
|
<div style="float:left;">
|
||||||
<a href="/{{ site.baseurl }}{{ page.previous }}.html" rel="prev">« Previous</a>
|
<a href="/{{ site.baseurl }}/gallery/{{ page.gallery }}/{{ page.previous }}.html" rel="prev">« Previous</a>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
set root=%~dp0..
|
set root=%~dp0..
|
||||||
php -dmemory_limit=1G %root%/_scripts/convert.php ^
|
php -dmemory_limit=1G %root%/_scripts/generate-gallery.php ^
|
||||||
%1 ^
|
%1 ^
|
||||||
%2 ^
|
%2 ^
|
||||||
%root%/asset/gallery ^
|
%root%/asset/gallery ^
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
require __DIR__ . '/../vendor/autoload.php';
|
require __DIR__ . '/../_php/autoload.php';
|
||||||
|
|
||||||
use Symfony\Component\Console\Application;
|
use Symfony\Component\Console\Application;
|
||||||
use Symfony\Component\Console\Input\ArgvInput;
|
use Symfony\Component\Console\Input\ArgvInput;
|
||||||
@@ -195,7 +195,9 @@ $oConsole
|
|||||||
$oOutput->write(' <comment>markdown</comment>');
|
$oOutput->write(' <comment>markdown</comment>');
|
||||||
$aMatter = [
|
$aMatter = [
|
||||||
'layout' => $sLayout,
|
'layout' => $sLayout,
|
||||||
'title' => isset($aPhoto['title']) ? $aPhoto['title'] : null,
|
'gallery' => $sGallery,
|
||||||
|
'file' => basename($aPhoto['path'], '.jpg'),
|
||||||
|
'title' => isset($aPhoto['title']) ? $aPhoto['title'] : '',
|
||||||
'date' => $aPhoto['date']->format('Y-m-d H:i:s'),
|
'date' => $aPhoto['date']->format('Y-m-d H:i:s'),
|
||||||
'ordering' => $aPhoto['ordering']
|
'ordering' => $aPhoto['ordering']
|
||||||
];
|
];
|
||||||
@@ -214,11 +216,11 @@ $oConsole
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($aPhotos[$i - 1])) {
|
if (isset($aPhotos[$i - 1])) {
|
||||||
$aMatter['previous'] = '/gallery/' . $sGallery . '/' . $aPhotos[$i - 1]['id'];
|
$aMatter['previous'] = $aPhotos[$i - 1]['id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($aPhotos[$i + 1])) {
|
if (isset($aPhotos[$i + 1])) {
|
||||||
$aMatter['next'] = '/gallery/' . $sGallery . '/' . $aPhotos[$i + 1]['id'];
|
$aMatter['next'] = $aPhotos[$i + 1]['id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($aPhoto['latitude'])) {
|
if (isset($aPhoto['latitude'])) {
|
||||||
@@ -314,7 +316,7 @@ $oConsole
|
|||||||
</div>
|
</div>
|
||||||
{%% include gallery_list.html gallery='%s' %%}
|
{%% include gallery_list.html gallery='%s' %%}
|
||||||
EOF
|
EOF
|
||||||
, (empty($aGallery['description']) ? '' : $aGallery['description']), implode('·', $aLinks), $sGallery);
|
, (empty($aGallery['description']) ? '' : $aGallery['description']), implode(' · ', $aLinks), $sGallery);
|
||||||
file_put_contents(
|
file_put_contents(
|
||||||
$sRenderPath . '/index.html',
|
$sRenderPath . '/index.html',
|
||||||
'---' . "\n" . yamlDump($aMatter) . '---' . "\n" . $sContents
|
'---' . "\n" . yamlDump($aMatter) . '---' . "\n" . $sContents
|
||||||
Reference in New Issue
Block a user