summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2006-08-09 15:30:28 +0000
committerDimitri Sokolyuk <demon@dim13.org>2006-08-09 15:30:28 +0000
commit87321ba6b3131cc387e676f90a57f8985928b6e2 (patch)
tree249551c488ec0ad2ecc06d8d4ec5ffc6b92b8195
parent8b7cb963f0da1d255e92b772dd4ed5a5af0cc68b (diff)
fix options link order
add fallbacks
-rw-r--r--math/math.c8
-rw-r--r--math/mkdb.c8
-rw-r--r--math/readmeta.c3
3 files changed, 12 insertions, 7 deletions
diff --git a/math/math.c b/math/math.c
index 0f00140..d3f5ebd 100644
--- a/math/math.c
+++ b/math/math.c
@@ -150,8 +150,8 @@ pr_opts(struct meta *mp)
} *op, o[] = {
{ mp->html, "HTML", "htmlicon.gif", 'h', "View HTML version" },
{ mp->pdf, "PDF", "pdficon.gif", 'p', "View as PDF" },
- { mp->mws, "MWS", "mwicon.gif", 's', "Download Maple classic worksheet" },
{ mp->mw, "MW", "mwicon.gif", 'm', "Download Maple worksheet" },
+ { mp->mws, "MWS", "mwsicon.gif", 's', "Download Maple classic worksheet" },
{ mp->code, "CODE", "codeicon.gif", 'c', "Download Maple code" },
{ mp->email, "EMAIL", "emailicon.gif", 'e', "E-mail to a colleague" },
{ NULL, NULL, NULL, 0, NULL }
@@ -160,9 +160,9 @@ pr_opts(struct meta *mp)
puts("<p class=\"options\">");
for (op = o; op->str != NULL; ++op) {
if (*op->str != '\0') {
- printf("<a href=\"%s?id=%u&amp;jump=%c\">", sname, mp->id, op->trg);
- printf("<img alt=\"%s\" src=\"/%s/%s\" /> ", op->alt, "images", op->img);
- printf("%s</a><br />\n", op->dsc);
+ printf("<img alt=\"%s\" src=\"/%s/%s\" />\n", op->alt, "images", op->img);
+ printf("<a href=\"%s?id=%u&amp;jump=%c\">%s</a>", sname, mp->id, op->trg, op->dsc);
+ puts("<br />");
}
}
puts("</p>");
diff --git a/math/mkdb.c b/math/mkdb.c
index db07eff..f4a6469 100644
--- a/math/mkdb.c
+++ b/math/mkdb.c
@@ -96,9 +96,17 @@ walk(char **fname)
mp->pdf = strdup(p);
else if (strstr(p, ".zip") != NULL)
mp->code = strdup(p);
+ /* TODO: add doc, rtf, etc. */
}
}
+ /* fallbacks */
+ if (mp->title == NULL)
+ mp->title = mp->dir;
+ if (mp->author == NULL)
+ mp->author = strdup("unknown");
+ if (mp->language == NULL)
+ mp->language = strdup("en");
db_add(mp, parent, id);
closemeta(mp);
diff --git a/math/readmeta.c b/math/readmeta.c
index 33fc5f7..f337f1d 100644
--- a/math/readmeta.c
+++ b/math/readmeta.c
@@ -127,9 +127,6 @@ openmeta(char *fname)
free(buf);
- if (mp->language == NULL)
- mp->language = "en";
-
return mp;
}