#!/bin/bash
chapter_loop () {
echo '
'"$1 - Manga2Web"''"$1 - Manga2Web
"
for i in "$1"/*{jpg,jpeg,png}; do
if [ -f "$i" ]; then
echo "
"
fi
done
if [ ! -z "$previous_chapter_dir" ]; then
echo '<-- previous chapter'
fi
}
manga_index () {
echo '
'"${PWD##*/} - Manga2Web"''"${PWD##*/} - Manga2Web
"
for i in *; do
if [ -d "$i" ]; then
echo "$i
"
fi
done
echo '
'
}
main () {
manga_index > index.html
for chapter_dir in *; do
if [ -d "$chapter_dir" ]; then
if [ ! -z "$previous_chapter_dir" ]; then
echo 'next chapter -->
' >> "$previous_chapter_dir/index.html"
fi
chapter_loop "$chapter_dir" > "$chapter_dir/index.html"
previous_chapter_dir=$chapter_dir
fi
done
echo '