aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthe little girl <yui@blekksprut.net>2016-11-11 17:20:58 +0100
committerbie <bie@pha.hk>2016-11-11 17:20:58 +0100
commit6a279ed8e1e93919f8a25edf11be889c5ad86c53 (patch)
treef3401cb5e59d3837e8e42a18ccf1bb557956caec
parent46c0f611aaee5aecfd2dc3c3ae84c74cbd7dab0c (diff)
downloadukulele-6a279ed8e1e93919f8a25edf11be889c5ad86c53.tar.xz
bedre subwikistøtte
-rw-r--r--ukulele.c30
-rw-r--r--ukulele.css27
2 files changed, 52 insertions, 5 deletions
diff --git a/ukulele.c b/ukulele.c
index 277903f..6d9d611 100644
--- a/ukulele.c
+++ b/ukulele.c
@@ -33,17 +33,37 @@ int writable(char *path) {
return 0;
}
-void head(char *page, char *link, char *what) {
+void head(char *page, char *link, char *dest) {
printf("Content-Type: text/html; charset=utf-8\n\n");
printf("<!doctype html>\n");
printf("<title>%s · %s</title>\n", title, page);
printf("<link rel='stylesheet' type='text/css' href='%s/ukulele.css'>\n", base);
printf("<script src='%s/ukulele.js'></script>\n", base);
printf("<h1>");
- if(link && what && !strcmp(what, "rediger"))
- printf("<a data-text='%s' href='%s'>%s</a>", what, link, page);
- else if(link && what)
- printf("<a data-text='%s' href='%s/%s'>%s</a>", what, base, link, page);
+
+
+ int segments = 0;
+ int segment;
+ char *e;
+ char *p = page;
+ while((p = strchr(p, '/')) != 0) segments++, p++;
+ p = page;
+ for(int i = 0; i < segments; i++) {
+ e = strchr(p, '/');
+ printf("<a class='no' href='%s/%.*s'>%.*s</a>", base, e - p, p, e - p, p);
+ p = e;
+ }
+ char *final;
+ if(segments) {
+ final = strrchr(page, '/');
+ if(*final+1) printf("/"), final++;
+ } else {
+ final = page;
+ }
+ if(link && dest && !strcmp(dest, "rediger"))
+ printf("<a data-text='%s' href='%s'>%s</a>", dest, link, final);
+ else if(link && dest)
+ printf("<a data-text='%s' href='%s/%s'>%s</a>", dest, base, link, final);
else
printf("%s", page);
printf("</h1>\n");
diff --git a/ukulele.css b/ukulele.css
index d1d17dc..a65eec9 100644
--- a/ukulele.css
+++ b/ukulele.css
@@ -13,6 +13,7 @@ tr:nth-child(2n) { background: #fff; }
a { text-decoration: none; color: red; }
a:hover, a:visited { color: Crimson; }
h1 a:hover:after { content: " »" attr(data-text); color: #aaa; }
+h1 a.no:hover:after { content: none; }
pre { border: 1px dotted gray; padding: 0.5em; background: GhostWhite; }
textarea { font-family: monospace; }
tt { font-weight: bold; }
@@ -29,3 +30,29 @@ tt { font-weight: bold; }
img { image-rendering: optimizeSpeed; image-rendering: -moz-crisp-edges; image-rendering: -o-crisp-edges; image-rendering: -webkit-optimize-contrast; image-rendering: optimize-contrast; image-rendering: crisp-edges; image-rendering: pixelated; -ms-interpolation-mdoe: nearest-neighbor; max-width: 100%; }
+.third { float: left; width: 33%; }
+.fourth { float: left; width: 25%; }
+.clear { clear: both; }
+
+.left { float: left; margin: 0 15px 0 0; }
+.middle { margin: 0 auto; }
+.middle table { margin: 0 auto; }
+.center { text-align: center; }
+.imagebox p { margin: 0; }
+.imagebox img { border: 3px solid #555; margin-bottom: 1em; }
+
+blockquote { font-style: italic; }
+blockquote .source { font-style: normal; font-weight: bold; }
+
+a[href^="http://"]:not([href*="kyber.io"]):after,
+a[href^="https://"]:not([href*="kyber.io"]):after {
+ content: ' ➹';
+ font-size: x-small;
+ vertical-align: top;
+ color: #aaa;
+}
+
+h3 { margin-top: 0; }
+
+.f { float: right; }
+.image box img + br { margin: 0; }