generate.sh: fix last puzzles, some usability improvements - chess-puzzles - ch… | |
git clone git://git.codemadness.org/chess-puzzles | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 10ce46bdd74256d98eec084142787f40730c582d | |
parent 2046625e2948b915fb5f7b6244e54f79cf2c2a8a | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Thu, 21 Dec 2023 20:27:17 +0100 | |
generate.sh: fix last puzzles, some usability improvements | |
Diffstat: | |
M generate.sh | 25 ++++++++++++++++++++----- | |
1 file changed, 20 insertions(+), 5 deletions(-) | |
--- | |
diff --git a/generate.sh b/generate.sh | |
@@ -56,6 +56,13 @@ body { | |
margin: 0 auto; | |
padding: 0 10px; | |
} | |
+h2 a { | |
+ color: #000; | |
+ text-decoration: none; | |
+} | |
+h2 a:hover:after { | |
+ content: " #"; | |
+} | |
.puzzle { | |
float: left; | |
margin-right: 25px; | |
@@ -63,6 +70,9 @@ body { | |
footer { | |
clear: both; | |
} | |
+details { | |
+ cursor: pointer; /* show hand */ | |
+} | |
</style> | |
</head> | |
<body> | |
@@ -93,8 +103,8 @@ shuffle "$groupsdir/matein2.csv" 100 | sed 10q | LC_ALL=C aw… | |
shuffle "$groupsdir/matein3.csv" 100 | sed 10q | LC_ALL=C awk '{ print $0 ",3 … | |
shuffle "$groupsdir/matein4.csv" 100 | sed 10q | LC_ALL=C awk '{ print $0 ",4 … | |
shuffle "$groupsdir/matein5_lt_2000.csv" 100 | sed 5q | LC_ALL=C awk '{ print … | |
-shuffle "$groupsdir/matein5_ge_2000.csv" | sed 3q | LC_ALL=C awk '{ print $0 "… | |
-shuffle "$groupsdir/matein5_ge_2700.csv" | sed 2q | LC_ALL=C awk '{ print $0 "… | |
+shuffle "$groupsdir/matein5_ge_2000.csv" 100 | sed 3q | LC_ALL=C awk '{ print … | |
+shuffle "$groupsdir/matein5_ge_2700.csv" 100 | sed 2q | LC_ALL=C awk '{ print … | |
rm -rf "$groupsdir" | |
) | \ | |
while read -r line; do | |
@@ -132,8 +142,8 @@ while read -r line; do | |
"$fenbin" $flip -o ascii "$fen" "$firstmove" > "$desttxt" | |
"$fenbin" $flip -o tty "$fen" "$firstmove" > "$destvt" | |
- printf '<div class="puzzle">\n' >> "$index" | |
- printf '<h2>Puzzle %s</h2>\n' "$i" >> "$index" | |
+ printf '<div class="puzzle" id="puzzle-%s">\n' "$i" >> "$index" | |
+ printf '<h2><a href="#puzzle-%s">Puzzle %s</a></h2>\n' "$i" "$i" >> "$… | |
test "$lichess" != "" && printf '<a href="%s">' "$lichess" >> "$index" | |
title="" | |
@@ -164,12 +174,17 @@ while read -r line; do | |
# solutions per puzzle. | |
printf '<div class="puzzle-solution">\n' >> "$solutions" | |
- printf '<h2>Puzzle %s</h2>\n' "$i" >> "$solutions" | |
+ printf '<h2><a href="#puzzle-%s">Puzzle %s</a></h2>\n' "$i" "$i" >> "$… | |
m="${allmoves}" | |
movecount=0 | |
# create a move list, removing one move each step, for generating | |
# the solution images. | |
+ | |
+ # add initial puzzle aswell for context. | |
+ printf '<img src="%s" width="180" height="180" loading="lazy" />\n' \ | |
+ "${i}.svg" >> "$solutions" | |
+ | |
while [ "$m" != "" ]; do | |
prevmoves="$m" | |