]> Sergey Matveev's repositories - galgen.git/commitdiff
Ability to specify link to the stylesheet
authorSergey Matveev <stargrave@stargrave.org>
Wed, 22 Feb 2023 09:28:13 +0000 (12:28 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Wed, 22 Feb 2023 09:28:13 +0000 (12:28 +0300)
galgen.zsh

index f1c6253092020a07b0b8b32803d3f8371ffc5142..55e24e84300dc39da2d62a4b82ec8a9bf5289421 100755 (executable)
@@ -5,6 +5,7 @@ set -e
 
 pagesize=${PAGESIZE:-100}
 ordering=${ORDERING:-Om}
+style=$STYLE
 
 djxl2ppm() {
     djxl $1 $1.ppm
@@ -13,6 +14,8 @@ djxl2ppm() {
     rm ${1}-ec1.pgm
 }
 
+[[ -z $style ]] || style="<link rel=\"stylesheet\" type=\"text/css\" href=\"$style\">"
+
 setopt EXTENDED_GLOB
 imgs=((*.jxl|*.webp~*.preview.webp)($ordering))
 for (( i=1 ; i <= ${#imgs} ; i++ )) {
@@ -21,7 +24,7 @@ for (( i=1 ; i <= ${#imgs} ; i++ )) {
     local dst=$i.img.html
     cat > $dst <<EOF
 <!DOCTYPE html>
-<html><head><title>Image ${i}/${#imgs}: $img</title></head><body>
+<html><head>${style}<title>Image ${i}/${#imgs}: $img</title></head><body>
 EOF
     [[ $i -eq 1 ]] ||
         echo "<a href=\"$(( $i - 1 )).img.html\">&lt;&lt;&lt;</a>" >> $dst
@@ -86,7 +89,7 @@ for (( p=1 ; p <= $pages ; p++ )) {
     local dst=$p.page.html
     cat > $dst <<EOF
 <!DOCTYPE html>
-<html><head><title>Page ${p}/$pages</title></head><body>
+<html><head>${style}<title>Page ${p}/$pages</title></head><body>
 EOF
     [[ $p -eq 1 ]] && [[ -r .txt ]] && {
         echo "<pre>" >> $dst