mirror of
https://github.com/AngelJumbo/gruvbox-wallpapers.git
synced 2026-08-12 00:42:29 +00:00
Cleaner script
This commit is contained in:
@@ -20,9 +20,8 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
touch ./index.html
|
||||
|
||||
echo "<!DOCTYPE html>
|
||||
write_header(){
|
||||
echo "<!DOCTYPE html>
|
||||
<html lang=\"en\">
|
||||
|
||||
<head>
|
||||
@@ -32,15 +31,41 @@ echo "<!DOCTYPE html>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Wallpapers for gruvbox</h1>" > ./index.html
|
||||
<h1>Wallpapers for gruvbox</h1>" > $1
|
||||
}
|
||||
|
||||
write_section_header(){
|
||||
|
||||
echo "<h2 id=s"$1">" >> "$3"
|
||||
echo "$2" | tr a-z A-Z >> "$3"
|
||||
echo "</h2>" >> "$3"
|
||||
}
|
||||
|
||||
write_img(){
|
||||
echo " <a target=\"_blank\" href=\"$1\">
|
||||
<img loading=\"lazy\" src=\"$1\" alt="$1" width=\"200\"></a>" >> "$2"
|
||||
}
|
||||
|
||||
|
||||
write_footer(){
|
||||
echo "<p> Contributions <a href=\"https://github.com/AngelJumbo/gruvbox-wallpapers\">here</a>.</p>
|
||||
<p> This images are from random sites or contributions so I don't have a way to know who are their original artist.</p>
|
||||
<p> I want to keep this site as simple as possible, but if you are the creator of any of these images and you want acknowledgment I will happily add a section with your name. Just open an issue <a href=\"https://github.com/AngelJumbo/gruvbox-wallpapers/issues\">here</a>.</p>
|
||||
<p> The same goes, if you want me to remove your art.</p>
|
||||
</body>
|
||||
</html>" >> "$1"
|
||||
|
||||
}
|
||||
|
||||
touch ./index.html
|
||||
|
||||
write_header ./index.html
|
||||
|
||||
color=1
|
||||
for subdir in ./wallpapers/*
|
||||
do
|
||||
|
||||
echo "<h2 id=s"$color">" >> ./index.html
|
||||
echo "${subdir##*/}" | tr a-z A-Z >> ./index.html
|
||||
echo "</h2>" >> ./index.html
|
||||
write_section_header $color "${subdir##*/}" ./index.html
|
||||
|
||||
echo "<div id=c>" >> ./index.html
|
||||
|
||||
@@ -48,49 +73,33 @@ do
|
||||
for wallpaper in ${subdir}/*
|
||||
do
|
||||
if [ "$count" -lt 9 ]; then #limit the amount of images per section in index
|
||||
echo " <a target=\"_blank\" href=\"$wallpaper\">
|
||||
<img loading=\"lazy\" src=\"$wallpaper\" alt="$wallpaper" width=\"200\"></a>" >> ./index.html
|
||||
write_img $wallpaper ./index.html
|
||||
count=$((count+1))
|
||||
else #if the limit is exceeded then create a new html with all the images of the section
|
||||
# TODO: make this part cleaner, this is really ugly!!.
|
||||
subhtml="${subdir##*/}.html"
|
||||
nimgs=$(ls "${subdir}" | wc -l)
|
||||
|
||||
echo " <a target=\"_blank\" class = \"showmore\" href=\"${subhtml}\">
|
||||
<div class = \"showmore\">show all ${nimgs} ${subdir##*/} wallpapers </div></a>" >> ./index.html
|
||||
|
||||
touch "${subhtml}"
|
||||
|
||||
echo "<!DOCTYPE html>
|
||||
<html lang=\"en\">
|
||||
|
||||
<head>
|
||||
<meta charset=\"utf-8\">
|
||||
<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\">
|
||||
<title>Gruvbox wallpapers</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Wallpapers for gruvbox</h1>" > "${subhtml}"
|
||||
write_header $subhtml
|
||||
|
||||
echo "<h2 id=s"$color">" >> "${subhtml}"
|
||||
echo "${subdir##*/}" | tr a-z A-Z >> "${subhtml}"
|
||||
echo "</h2>" >> "${subhtml}"
|
||||
|
||||
write_section_header $color "${subdir##*/}" $subhtml
|
||||
|
||||
|
||||
echo "<div id=c>" >> "${subhtml}"
|
||||
|
||||
for wallpaper2 in ${subdir}/*
|
||||
do
|
||||
echo " <a target=\"_blank\" href=\"$wallpaper2\">
|
||||
<img loading=\"lazy\" src=\"$wallpaper2\" alt="$wallpaper2" width=\"200\"></a>" >> "${subhtml}"
|
||||
write_img $wallpaper2 $subhtml
|
||||
done
|
||||
|
||||
echo "</div>" >> "${subhtml}"
|
||||
|
||||
echo "<p> Contributions <a href=\"https://github.com/AngelJumbo/gruvbox-wallpapers\">here</a>.</p>
|
||||
<p> This images are from random sites or contributions so I don't have a way to know who are their original artist.</p>
|
||||
<p> I want to keep this site as simple as possible, but if you are the creator of any of these images and you want acknowledgment I will happily add a section with your name. Just open an issue <a href=\"https://github.com/AngelJumbo/gruvbox-wallpapers/issues\">here</a>.</p>
|
||||
<p> The same goes, if you want me to remove your art.</p>
|
||||
</body>
|
||||
</html>" >> "${subhtml}"
|
||||
write_footer $subhtml
|
||||
break
|
||||
fi
|
||||
|
||||
@@ -104,9 +113,4 @@ do
|
||||
fi
|
||||
done
|
||||
|
||||
echo "<p> Contributions <a href=\"https://github.com/AngelJumbo/gruvbox-wallpapers\">here</a>.</p>
|
||||
<p> This images are from random sites or contributions so I don't have a way to know who are their original artist.</p>
|
||||
<p> I want to keep this site as simple as possible, but if you are the creator of any of these images and you want acknowledgment I will happily add a section with your name. Just open an issue <a href=\"https://github.com/AngelJumbo/gruvbox-wallpapers/issues\">here</a>.</p>
|
||||
<p> The same goes, if you want me to remove your art.</p>
|
||||
</body>
|
||||
</html>" >> ./index.html
|
||||
write_footer ./index.html
|
||||
|
||||
Reference in New Issue
Block a user