From 6a13a9bc04ddfbc7cad293ed5d392267b6f93db6 Mon Sep 17 00:00:00 2001 From: tim Date: Thu, 11 Nov 2021 11:31:29 +1030 Subject: [PATCH] Initial commit --- manga2web.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 manga2web.sh diff --git a/manga2web.sh b/manga2web.sh new file mode 100755 index 0000000..80b823d --- /dev/null +++ b/manga2web.sh @@ -0,0 +1,40 @@ +#!/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 '


' >> "$previous_chapter_dir/index.html" +} + +main