*.cgi
*.swp
html.c
+manual.inc
tags
dl.small dt {
width: 4em;
}
+
+/* Asciidoc */
+.asciidoc p {
+ margin-top: 0.7em;
+}
+.asciidoc li p,
+.asciidoc td p {
+ margin-top: 0em;
+}
+.asciidoc .hdlist table {
+ padding-left: 1em;
+}
without any license fees or royalties.</p>
<% } %>
+<% void print_manual(void) { %>
+ <div class="asciidoc">
+ <% print_file("manual.inc"); %>
+ </div>
+<% } %>
+
<% void print_news(void) { %>
<!-- It's not really spring anymore :/ -->
<!-- <p class="quote">Now that it's spring again, progress on AWeather is continuing.</p> -->
extern page_t special[];
/* Global functions */
+void print_file(char *file);
void print_header(void);
void print_page(const page_t *which);
/* Pages */
void print_about(void);
+void print_manual(void);
void print_news(void);
void print_oldnews(void);
void print_screenshots(void);
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "html.h"
/* Page data */
page_t header[] = {
{"about", "About", print_about, 0.7, NULL},
+ {"manual", "Manual", print_manual, 0.5, NULL},
{"news", "News", print_news, 0.3, NULL},
{"screenshots", "Screenshots", print_screenshots, 0.5, NULL},
{"download", "Download", print_download, 0.7, NULL},
const page_t *index = &special[0];
const page_t *notfound = &special[2];
+/* Helper functions */
+void print_file(char *file)
+{
+ char data[512];
+ FILE *fd = fopen(file, "r");
+ while (!feof(fd)) {
+ size_t size = fread(data, 1, sizeof(data), fd);
+ fwrite(data, 1, size, stdout);
+ }
+}
+
/* Main */
int main(int argc, char **argv)
{
CT=/scratch/ct/ct
CFLAGS='--std=c99 -Wall'
+all:V: index.cgi manual.inc
+
index.cgi: index.o html.o
gcc $CFLAGS -o $target $prereq $PKG_LIBS
%.c: %.ct
$CT -o $target $prereq
+manual.inc: ../docs/manual.ad
+ asciidoc -s -a toc -a numbered -b xhtml11 -o- $prereq \
+ | awk -f toc.awk > $target
+
clean:V:
rm -f *.o *.cgi html.c
push:V:
user=spenceal
dest=/home/lug/htdocs/proj/aweather/
+ serv=lug.rose-hulman.edu
rsync -uavz .htaccess \
- $user@lug.rose-hulman.edu:$dest
+ $user@$serv:$dest
rsync -uavz --delete \
--exclude '*~' \
--exclude '.*' \
- index.cgi images screens data \
- $user@lug.rose-hulman.edu:$dest
+ index.cgi manual.inc images screens data \
+ $user@$serv:$dest
--- /dev/null
+// {
+ if (match($0, /<h[0-9] id="([^"]*)">([0-9.]* *)([^<]*)<\/h[0-9]>/, arr)) {
+ id = arr[1];
+ num = arr[2];
+ txt = arr[3];
+ toc = toc "\n" "<li>" num "<a href=\"#" id "\">" txt "</a></li>"
+ body = body "\n" "<a id=\"" id "\"></a>"
+ }
+ body = body "\n" $0
+}
+
+END {
+ print "<h2>Table of Contents</h2>";
+ print "<ul style=\"list-style:none;\">" toc "</ul>";
+ print body;
+}