diff --git a/src/classic.c b/src/classic.c index eab8bbc..bce1a73 100644 --- a/src/classic.c +++ b/src/classic.c @@ -118,7 +118,7 @@ void classic_stylesheet(FILE* out, const char* top) { fprintf(out, "}\n"); fprintf(out, "\n"); fprintf(out, ".linkgroup {\n"); - fprintf(out, " padding-left: 16px;\n"); + fprintf(out, " padding-left: 12px;\n"); fprintf(out, "}\n"); fprintf(out, "\n"); fprintf(out, ".linkgrouptitle {\n"); @@ -225,6 +225,20 @@ void classic_body(FILE* out, const char* top, const char* title, xl_node_t* body fprintf(out, " \n"); fprintf(out, " \n"); fprintf(out, "
\n"); + + if((nodes = xl_get_path(skinconf->root, "nav")) != NULL) { + int i; + + child = nodes[0]->first_child; + while(child != NULL) { + default_nav(out, top, child, 6); + + child = child->next; + } + + free(nodes); + } + fprintf(out, "
\n"); fprintf(out, " \n"); fprintf(out, " \n"); @@ -232,7 +246,7 @@ void classic_body(FILE* out, const char* top, const char* title, xl_node_t* body child = body->first_child; while(child != NULL) { - default_node(out, top, child, 0); + default_node(out, top, child, 6); child = child->next; } diff --git a/src/default.c b/src/default.c index 225a9d8..ad751ad 100644 --- a/src/default.c +++ b/src/default.c @@ -132,18 +132,58 @@ void default_node(FILE* out, const char* top, xl_node_t* element, int indent) { sprintf(tag, "<%s>", element->name); } - if(tag[0] != 0) print(out, tag, indent + 6); + if(tag[0] != 0) print(out, tag, indent); child = element->first_child; while(child != NULL) { if(child->type == XL_NODE_NODE && child->name != NULL) { default_node(out, top, child, indent + 1 + add); } else if(child->type == XL_NODE_TEXT && child->text != NULL) { - print(out, child->text, indent + 7 + add); + print(out, child->text, indent + 1 + add); } child = child->next; } - if(end[0] != 0) print(out, end, indent + 6); + if(end[0] != 0) print(out, end, indent); +} + +void default_nav(FILE* out, const char* top, xl_node_t* element, int indent) { + int i; + + if(element->name == NULL) return; + + if(strcmp(element->name, "link") == 0) { + char* link; + char* name; + + if((link = xl_get_attribute(element, "href")) == NULL) link = "https://invalid.link"; + if((name = xl_get_attribute(element, "name")) == NULL) name = ""; + + for(i = 0; i < indent; i++) fprintf(out, "\t"); + fprintf(out, " - %s
", link, name); + } else if(strcmp(element->name, "group") == 0) { + char* title; + xl_node_t* child; + + if((title = xl_get_attribute(element, "title")) == NULL) title = ""; + + if(title != NULL) { + for(i = 0; i < indent; i++) fprintf(out, "\t"); + fprintf(out, "
- %s
\n", title); + } + + for(i = 0; i < indent; i++) fprintf(out, "\t"); + fprintf(out, "
\n"); + + child = element->first_child; + while(child != NULL) { + default_nav(out, top, child, indent + 1); + + child = child->next; + } + + for(i = 0; i < indent; i++) fprintf(out, "\t"); + fprintf(out, "
\n"); + } } diff --git a/src/seed.c b/src/seed.c index a2bbd54..89555ce 100644 --- a/src/seed.c +++ b/src/seed.c @@ -27,6 +27,21 @@ int action_seed(int argc, char** argv) { fprintf(f, " \n"); fprintf(f, " \n"); fprintf(f, " \n"); + fprintf(f, " \n"); + fprintf(f, " Example Project\n"); + fprintf(f, " Example Project Description\n"); + fprintf(f, " \n"); + fprintf(f, " \n"); + fprintf(f, " \n"); fprintf(f, " \n"); fprintf(f, " Example Co, Ltd\n"); fprintf(f, " 2026\n"); diff --git a/src/taiga.h b/src/taiga.h index 3cc5103..daa886f 100644 --- a/src/taiga.h +++ b/src/taiga.h @@ -63,5 +63,6 @@ void classic_body(FILE* out, const char* top, const char* title, xl_node_t* body /* default.c */ void default_node(FILE* out, const char* top, xl_node_t* element, int indent); +void default_nav(FILE* out, const char* top, xl_node_t* element, int indent); #endif