add header/footer, basic css, full site index
This commit is contained in:
parent
0bfc745f31
commit
14ef028f13
|
@ -0,0 +1,2 @@
|
|||
format
|
||||
site/*
|
26
format.c
26
format.c
|
@ -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
17
gen.sh
|
@ -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
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
</body>
|
||||
</html>
|
|
@ -0,0 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" href="resources/style.css">
|
||||
<body>
|
|
@ -0,0 +1,13 @@
|
|||
body {
|
||||
color: #ddd;
|
||||
background: #000;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #ddd;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #000;
|
||||
background: #ddd;
|
||||
}
|
|
@ -1,3 +1,5 @@
|
|||
* Index
|
||||
|
||||
Welcome to {codex}.
|
||||
|
||||
{site-index Full site index.}
|
||||
|
|
Loading…
Reference in New Issue