[wiki] [sites] build-page: make more usable for text-browsers: links, lynx, w3m || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Sun, 06 Jan 2019 16:11:51 +0100

commit f37774b0bd5b8a70094a55a6c2606ba3ba3be9d9
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Sun Jan 6 16:11:20 2019 +0100

    build-page: make more usable for text-browsers: links, lynx, w3m
    
    - highlight links.
    - surround/mark menu sections with ruler (<hr/>).

diff --git a/build-page.c b/build-page.c
index 6f0782ae..c1bcd361 100644
--- a/build-page.c
+++ b/build-page.c
_AT_@ -28,10 +28,12 @@ char *html_header =
         "</head>
"
         "
"
         "<div id=\"header\">
"
- " <a href=\"//suckless.org/\"><img src=\"//suckless.org/logo.svg\" alt=\"\"/></a>
"
+ " <a href=\"//suckless.org/\"><img src=\"//suckless.org/logo.svg\" alt=\"\"/></a>&nbsp;
"
         " <a id=\"headerLink\" href=\"//suckless.org/\">suckless.org</a>
"
+ " <span class=\"hidden\"> - </span>
"
         " <span id=\"headerSubtitle\">%1$s</span>
"
- "</div>
";
+ "</div>
"
+ "<hr class=\"hidden\"/>
";
 
 char *html_nav_bar =
         " <span class=\"right\">
"
_AT_@ -184,13 +186,17 @@ print_nav_bar(char *domain)
 
         puts("<div id=\"menu\">");
         for (d = domain_list; d->dir; ++d) {
- fputs(" <a ", stdout);
                 if (strcmp(domain, d->dir) == 0)
- fputs("class=\"thisSite\" ", stdout);
- printf("href=\"//%s/\">%s</a>
", d->dir, d->label);
+ printf(" <a href=\"//%s/\"><b>%s</b></a>
",
+ d->dir, d->label);
+ else
+ printf(" <a href=\"//%s/\">%s</a>
",
+ d->dir, d->label);
+
         }
         fputs(html_nav_bar, stdout);
         puts("</div>");
+ puts("<hr class=\"hidden\"/>");
 }
 
 int
_AT_@ -231,11 +237,16 @@ menu_panel(char *domain, char *page, char *this, int depth)
                 for (i = 0; i < depth + 1; ++i)
                         putchar(' ');
                 fputs("<li><a", stdout);
- if (page && !strncmp(newdir, page, strlen(newdir)))
- fputs(" class=\"thisPage\"", stdout);
- printf(" href=\"//%s/%s/\">", domain, newdir);
- print_name(d);
- fputs("/</a>", stdout);
+ if (page && !strncmp(newdir, page, strlen(newdir))) {
+ printf("<a href=\"//%s/%s/\"><b>", domain, newdir);
+ print_name(d);
+ fputs("/</b></a>", stdout);
+ } else {
+ printf("<a href=\"//%s/%s/\">", domain, newdir);
+ print_name(d);
+ fputs("/</a>", stdout);
+ }
+
                 if (page && !strncmp(newdir, page, strlen(newdir))) {
                         putchar('
');
                         for (i = 0; i < depth + 2; ++i)
_AT_@ -256,13 +267,15 @@ menu_panel(char *domain, char *page, char *this, int depth)
 void
 print_menu_panel(char *domain, char *page)
 {
- fputs("<div id=\"nav\">
        <ul>
        <li><a", stdout);
+ fputs("<div id=\"nav\">
        <ul>
        <li>", stdout);
         if (!page)
- fputs(" class=\"thisPage\"", stdout);
- puts(" href=\"/\">about</a></li>");
+ puts("<a href=\"/\"><b>about</b></a></li>");
+ else
+ puts("<a href=\"/\">about</a></li>");
         menu_panel(domain, page, NULL, 0);
         puts(" </ul>");
         puts("</div>");
+ puts("<hr class=\"hidden\"/>");
 }
 
 void
Received on Sun Jan 06 2019 - 16:11:51 CET

This archive was generated by hypermail 2.3.0 : Sun Jan 06 2019 - 16:12:28 CET