This commit is contained in:
parent
de036d46aa
commit
36d7eb30cb
10 changed files with 246 additions and 115 deletions
|
|
@ -23,33 +23,40 @@ static int parse_file(const char* top, const char* full) {
|
|||
xl_node_t** nodes2;
|
||||
int has_own_icon = 0;
|
||||
|
||||
if(handle->root != NULL) node = handle->root->first_child;
|
||||
if(handle->root != NULL)
|
||||
node = handle->root->first_child;
|
||||
while(node != NULL) {
|
||||
if(node->type == XL_NODE_NODE && strcmp(node->name, "header") == 0) {
|
||||
xl_node_t* n = node->first_child;
|
||||
|
||||
while(n != NULL) {
|
||||
if(n->type == XL_NODE_NODE && strcmp(n->name, "title") == 0) {
|
||||
if(title != NULL) free(title);
|
||||
if(title != NULL)
|
||||
free(title);
|
||||
title = u_strdup(n->text);
|
||||
}
|
||||
n = n->next;
|
||||
}
|
||||
|
||||
header = node;
|
||||
} else if(node->type == XL_NODE_NODE && strcmp(node->name, "body") == 0) {
|
||||
} else if(node->type == XL_NODE_NODE &&
|
||||
strcmp(node->name, "body") == 0) {
|
||||
body = node;
|
||||
}
|
||||
|
||||
node = node->next;
|
||||
}
|
||||
|
||||
if(title == NULL) title = u_strdup("Untitled");
|
||||
if(title == NULL)
|
||||
title = u_strdup("Untitled");
|
||||
|
||||
fprintf(f, "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n");
|
||||
fprintf(f,
|
||||
"<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 "
|
||||
"Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n");
|
||||
fprintf(f, "<html>\n");
|
||||
fprintf(f, " <head>\n");
|
||||
fprintf(f, " <meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\">\n");
|
||||
fprintf(f, " <meta http-equiv=\"Content-Type\" "
|
||||
"content=\"text/html;charset=UTF-8\">\n");
|
||||
fprintf(f, " <title>%s</title>\n", title);
|
||||
|
||||
if((nodes = xl_get_path(header, "link")) != NULL) {
|
||||
|
|
@ -69,7 +76,8 @@ static int parse_file(const char* top, const char* full) {
|
|||
|
||||
classic_head(f, top, header);
|
||||
|
||||
if(!has_own_icon && (nodes = xl_get_path(skinconf->root, "favicon")) != NULL) {
|
||||
if(!has_own_icon &&
|
||||
(nodes = xl_get_path(skinconf->root, "favicon")) != NULL) {
|
||||
if(nodes[0]->text != NULL) {
|
||||
char* p = u_path(top, nodes[0]->text);
|
||||
fprintf(f, " <link rel=\"icon\" href=\"%s\">\n", p);
|
||||
|
|
@ -92,7 +100,8 @@ static int parse_file(const char* top, const char* full) {
|
|||
st = 0;
|
||||
}
|
||||
|
||||
if(handle != NULL) xl_close(handle);
|
||||
if(handle != NULL)
|
||||
xl_close(handle);
|
||||
|
||||
return st;
|
||||
}
|
||||
|
|
@ -100,14 +109,16 @@ static int parse_file(const char* top, const char* full) {
|
|||
int process(const char* top, const char* out, const char* full) {
|
||||
char* fn = strrchr(full, '/');
|
||||
|
||||
if(fn != NULL) fn = fn + 1;
|
||||
if(fn != NULL)
|
||||
fn = fn + 1;
|
||||
|
||||
if(fn != NULL) {
|
||||
char* n;
|
||||
char* p;
|
||||
|
||||
fn = u_strdup(fn);
|
||||
if((n = strrchr(fn, '.')) != NULL) n[0] = 0;
|
||||
if((n = strrchr(fn, '.')) != NULL)
|
||||
n[0] = 0;
|
||||
|
||||
p = u_strvacat(out, fn, ".html", NULL);
|
||||
if((f = fopen(p, "w")) != NULL) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue