Skip to content

Instantly share code, notes, and snippets.

@ailtonbsj
Last active May 8, 2024 19:08
Show Gist options
  • Save ailtonbsj/7285f8acb1e7bafae44de488cfd38d39 to your computer and use it in GitHub Desktop.
Save ailtonbsj/7285f8acb1e7bafae44de488cfd38d39 to your computer and use it in GitHub Desktop.
Hackers for good HTML Reporter
#!/bin/bash
#
# USAGE: h4g-html-reporter.sh > module.html
#
# Folders structure:
# .
# ├── 1.1
# │   ├── 1.png
# │   ├── 6.png
# ├── 1.2
# │   ├── 2.png
# │   ├── 8.png
cat << EOF
<style>
@media print {
.pagebreak { page-break-before: always; }
div { break-inside: avoid; }
}
</style>
EOF
ls -1d */ | cut -d/ -f1 | sort -n | while read activity; do
echo "<h1 class=\"pagebreak\">Atividade $activity</h1>"
ls -1 $activity/ | sort -n | while read screen; do
screenName="$(echo $screen | cut -d. -f1)"
echo "<div>"
echo "<h2>Passo $screenName</h2>"
echo "<img src=\"$activity/$screen\" width=\"100%\" />"
echo "</div>"
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment