Rename gallery generation script, write gallery and original photo name in Markdown file, simplify next/previous

This commit is contained in:
2015-12-22 18:08:52 +00:00
parent d33f961874
commit 2ccbe8cb9b
3 changed files with 12 additions and 10 deletions

View File

@@ -13,13 +13,13 @@ layout: post
</div>
<ul style="margin-top:0;">
{% if page.previous %}
<li><a href="/{{ site.baseurl }}{{ page.previous }}.html" rel="prev">&nbsp;&larr;&nbsp;</a></li>
<li><a href="/{{ site.baseurl }}/gallery/{{ page.gallery }}/{{ page.previous }}.html" rel="prev">&nbsp;&larr;&nbsp;</a></li>
{% else %}
<li><span class="noanchor">&nbsp;&larr;&nbsp;</span></li>
{% endif %}
{% if page.next %}
<li><a href="/{{ site.baseurl }}{{ page.next }}.html" rel="next">&nbsp;&rarr;&nbsp;</a></li>
<li><a href="/{{ site.baseurl }}/gallery/{{ page.gallery }}/{{ page.next }}.html" rel="next">&nbsp;&rarr;&nbsp;</a></li>
{% else %}
<li><span class="noanchor">&nbsp;&rarr;&nbsp;</span></li>
{% endif %}
@@ -94,13 +94,13 @@ layout: post
<div class="meta-navigate screen-only">
{% if page.next %}
<div style="float:right;">
<a href="/{{ site.baseurl }}{{ page.next }}.html" rel="next">Next Photo &raquo;</a>
<a href="/{{ site.baseurl }}/gallery/{{ page.gallery }}/{{ page.next }}.html" rel="next">Next Photo &raquo;</a>
</div>
{% endif %}
{% if page.previous %}
<div style="float:left;">
<a href="/{{ site.baseurl }}{{ page.previous }}.html" rel="prev">&laquo; Previous</a>
<a href="/{{ site.baseurl }}/gallery/{{ page.gallery }}/{{ page.previous }}.html" rel="prev">&laquo; Previous</a>
</div>
{% endif %}

View File

@@ -1,5 +1,5 @@
set root=%~dp0..
php -dmemory_limit=1G %root%/_scripts/convert.php ^
php -dmemory_limit=1G %root%/_scripts/generate-gallery.php ^
%1 ^
%2 ^
%root%/asset/gallery ^

View File

@@ -1,5 +1,5 @@
<?php
require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/../_php/autoload.php';
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
@@ -195,7 +195,9 @@ $oConsole
$oOutput->write(' <comment>markdown</comment>');
$aMatter = [
'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'),
'ordering' => $aPhoto['ordering']
];
@@ -214,11 +216,11 @@ $oConsole
}
if (isset($aPhotos[$i - 1])) {
$aMatter['previous'] = '/gallery/' . $sGallery . '/' . $aPhotos[$i - 1]['id'];
$aMatter['previous'] = $aPhotos[$i - 1]['id'];
}
if (isset($aPhotos[$i + 1])) {
$aMatter['next'] = '/gallery/' . $sGallery . '/' . $aPhotos[$i + 1]['id'];
$aMatter['next'] = $aPhotos[$i + 1]['id'];
}
if (isset($aPhoto['latitude'])) {
@@ -314,7 +316,7 @@ $oConsole
</div>
{%% include gallery_list.html gallery='%s' %%}
EOF
, (empty($aGallery['description']) ? '' : $aGallery['description']), implode('&middot;', $aLinks), $sGallery);
, (empty($aGallery['description']) ? '' : $aGallery['description']), implode(' &middot; ', $aLinks), $sGallery);
file_put_contents(
$sRenderPath . '/index.html',
'---' . "\n" . yamlDump($aMatter) . '---' . "\n" . $sContents