29 lines
381 B
Bash
29 lines
381 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
dir=$1
|
||
|
|
||
|
|
||
|
for f in $dir/*; do
|
||
|
d=$(date +"%Y-%m-%d")
|
||
|
span=""
|
||
|
filename=$(basename $f)
|
||
|
noext=${filename%.*}
|
||
|
title=${noext%_*}
|
||
|
title=${title//-/ }
|
||
|
if [ -n "$title" ]; then
|
||
|
span="<span class='image-details'>$title</span>"
|
||
|
fi
|
||
|
cat > "_art/$d-$noext.md"<< EOF
|
||
|
---
|
||
|
layout: post
|
||
|
title: $filename
|
||
|
date: $d
|
||
|
categories: art
|
||
|
---
|
||
|
|
||
|
![$title](/$f)
|
||
|
|
||
|
$span
|
||
|
EOF
|
||
|
done
|