diff --git a/src/classic.c b/src/classic.c
index 40e2844..c0a4b27 100644
--- a/src/classic.c
+++ b/src/classic.c
@@ -111,7 +111,16 @@ void classic_stylesheet(FILE* out, const char* top) {
}
void classic_head(FILE* out, const char* top, xl_node_t* header) {
+ xl_node_t* child;
+
fprintf(out, " \n", top);
+
+ child = header->first_child;
+ while(child != NULL) {
+ default_head(out, top, child, 2);
+
+ child = child->next;
+ }
}
void classic_body(FILE* out, const char* top, const char* title, xl_node_t* body) {
@@ -181,6 +190,8 @@ void classic_body(FILE* out, const char* top, const char* title, xl_node_t* body
}
if(link == NULL) link = "https://invalid.link";
+ link = u_path(top, link);
+
sprintf(path, "%s.image", images[i]);
if((nodes = xl_get_path(skinconf->root, path)) != NULL) {
char* text = xl_get_attribute(nodes[0], "src");
@@ -193,6 +204,8 @@ void classic_body(FILE* out, const char* top, const char* title, xl_node_t* body
free(nodes);
}
+
+ free(link);
}
fprintf(out, " \n");
fprintf(out, " \n");
@@ -208,10 +221,15 @@ void classic_body(FILE* out, const char* top, const char* title, xl_node_t* body
char* name = xl_get_attribute(nodes[i], "name");
if(link == NULL) link = "https://invalid.link";
+
+ link = u_path(top, link);
+
if(title == NULL) title = link;
if(i > 0) fprintf(out, " |\n");
fprintf(out, " %s\n", link, name);
+
+ free(link);
}
free(nodes);
@@ -252,7 +270,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, 6);
+ default_body(out, top, child, 6);
child = child->next;
}
diff --git a/src/default.c b/src/default.c
index 0765c7e..5a5b572 100644
--- a/src/default.c
+++ b/src/default.c
@@ -38,7 +38,44 @@ static void accept_attr(char* text, xl_node_t* element, ...) {
}
}
-void default_node(FILE* out, const char* top, xl_node_t* element, int indent) {
+void default_head(FILE* out, const char* top, xl_node_t* element, int indent) {
+ xl_node_t* child;
+ char tag[2048];
+ char end[128];
+ int add = 0;
+
+ tag[0] = end[0] = 0;
+
+ if(element->name == NULL) return;
+
+ if(strcmp(element->name, "link") == 0) {
+ char text[2048];
+
+ accept_attr(text, element, "rel", "href", NULL);
+
+ sprintf(tag, "<%s%s>", element->name, text);
+ }
+
+ 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_head(out, top, child, indent + 1 + add);
+ } else if(child->type == XL_NODE_TEXT && child->text != NULL) {
+ /* most likely junk */
+#if 0
+ print(out, child->text, indent + 1 + add);
+#endif
+ }
+
+ child = child->next;
+ }
+
+ if(end[0] != 0) print(out, end, indent);
+}
+
+void default_body(FILE* out, const char* top, xl_node_t* element, int indent) {
xl_node_t* child;
char tag[2048]; /* enough for most cases... :) */
char end[128];
@@ -137,7 +174,7 @@ void default_node(FILE* out, const char* top, xl_node_t* element, int 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);
+ default_body(out, top, child, indent + 1 + add);
} else if(child->type == XL_NODE_TEXT && child->text != NULL) {
print(out, child->text, indent + 1 + add);
}
@@ -160,8 +197,12 @@ void default_nav(FILE* out, const char* top, xl_node_t* element, int indent) {
if((link = xl_get_attribute(element, "href")) == NULL) link = "https://invalid.link";
if((name = xl_get_attribute(element, "name")) == NULL) name = "";
+ link = u_path(top, link);
+
for(i = 0; i < indent; i++) fprintf(out, "\t");
fprintf(out, " - %s
\n", link, name);
+
+ free(link);
} else if(strcmp(element->name, "group") == 0) {
char* title;
xl_node_t* child;
diff --git a/src/process.c b/src/process.c
index 0cc1571..762dfd3 100644
--- a/src/process.c
+++ b/src/process.c
@@ -15,10 +15,13 @@ static int parse_file(const char* top, const char* full) {
}
if(st) {
- char* title = NULL;
- xl_node_t* node = NULL;
- xl_node_t* header = NULL;
- xl_node_t* body = NULL;
+ char* title = NULL;
+ xl_node_t* node = NULL;
+ xl_node_t* header = NULL;
+ xl_node_t* body = NULL;
+ xl_node_t** nodes;
+ xl_node_t** nodes2;
+ int has_own_icon = 0;
if(handle->root != NULL) node = handle->root->first_child;
while(node != NULL) {
@@ -48,7 +51,34 @@ static int parse_file(const char* top, const char* full) {
fprintf(f, "