~tardypad/tardypad.me

9a719902cae7c7e65221d982e89e0acb2e4f0a12 — Damien Tardy-Panis 1 year, 6 months ago 8cfc4a3
check: build the index.html automatically
3 files changed, 20 insertions(+), 1 deletions(-)

M sites/check/Makefile
M sites/check/root/index.html
A sites/check/templates/index.html
M sites/check/Makefile => sites/check/Makefile +3 -0
@@ 1,5 1,6 @@
build:
	mkdir -p build
	rm -f build/links
	find lists -type f | sort | xargs -n1 basename | while read l; do \
		TITLE=$$( sed -n '1s/^# //p' lists/$$l ); \
		ID=0; \


@@ 9,7 10,9 @@ build:
			sed -e "s/{ID}/$$ID/g" -e "s/{ITEM}/$$i/g" templates/item.html >> build/items; \
		done; \
		sed -e "s/{TITLE}/$$TITLE/g" -e '/{ITEMS}/ {r build/items' -e 'd }' templates/list.html > root/$$l.html; \
		printf '<a href="%s">%s</a>\n' $$l "$$TITLE" >> build/links; \
	done
	sed -e '/{LINKS}/ {r build/links' -e 'd }' templates/index.html > root/index.html

deploy:
	rsync -az --delete root/ surg:/usr/local/www/check/

M sites/check/root/index.html => sites/check/root/index.html +1 -1
@@ 9,7 9,7 @@
        <main>
            <h1>Checklists</h1>
            <nav>
                <a href="system-updates">System updates</a>
<a href="system-updates">System updates</a>
            </nav>
        </main>
    </body>

A sites/check/templates/index.html => sites/check/templates/index.html +16 -0
@@ 0,0 1,16 @@
<html lang="en">
    <head>
        <title>tardypad checklists</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="stylesheet" href="style.css">
    </head>
    <body>
        <main>
            <h1>Checklists</h1>
            <nav>
{LINKS}
            </nav>
        </main>
    </body>
</html>