add header/footer, basic css, full site index

This commit is contained in:
opFez 2021-07-30 17:47:55 +02:00
parent 0bfc745f31
commit 14ef028f13
7 changed files with 50 additions and 18 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
format
site/*

View File

@ -14,23 +14,13 @@ die(char *msg)
/* header/footer */
void
write_header(FILE *output)
write_file(FILE *output, char *input)
{
fprintf(output,
"<!DOCTYPE html>\n"
"<html>\n"
"<body>\n"
);
}
void
write_footer(FILE *output)
{
fprintf(output,
"\n"
"</body>\n"
"</html>\n"
);
FILE *f = fopen(input, "r");
char c;
while ((c = fgetc(f)) != EOF)
fputc(c, output);
fclose(f);
}
@ -243,9 +233,9 @@ main(int argc, char *argv[])
out = fopen(argv[2], "w");
}
write_header(out);
write_file(out, "resources/header.html");
format(in_collapsed, out);
write_footer(out);
write_file(out, "resources/footer.html");
fclose(in_initial);
fclose(out);

17
gen.sh
View File

@ -1,7 +1,24 @@
#!/bin/sh
gen_site_index() {
indexfile=site/site-index.html
cat resources/header.html > $indexfile
echo Generating full site index...
for file in site/*; do
bn=$(basename $file .html)
echo "<p><a href=\"$bn.html\">{$bn}</a>" >> $indexfile
done
cat resources/footer.html >> $indexfile
}
for file in site-src/*; do
bn=$(basename $file .src)
echo "Converting $bn..."
./format $file site/$bn.html
done
gen_site_index

2
resources/footer.html Normal file
View File

@ -0,0 +1,2 @@
</body>
</html>

6
resources/header.html Normal file
View File

@ -0,0 +1,6 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<link rel="stylesheet" href="resources/style.css">
<body>

13
resources/style.css Normal file
View File

@ -0,0 +1,13 @@
body {
color: #ddd;
background: #000;
}
a {
color: #ddd;
}
a:hover {
color: #000;
background: #ddd;
}

View File

@ -1,3 +1,5 @@
* Index
Welcome to {codex}.
{site-index Full site index.}