fix format
All checks were successful
pyrite-dev/taiga/pipeline/head This commit looks good

This commit is contained in:
Nishi 2026-03-08 22:32:33 +09:00
commit 55aa66a7db
Signed by: nishi
GPG key ID: 27EF69B208EB9343
12 changed files with 143 additions and 209 deletions

View file

@ -23,8 +23,7 @@ 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;
@ -39,8 +38,7 @@ static int parse_file(const char* top, const char* full) {
}
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;
}
@ -50,13 +48,10 @@ static int parse_file(const char* top, const char* full) {
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) {
@ -74,10 +69,9 @@ static int parse_file(const char* top, const char* full) {
free(nodes);
}
classic_head(f, top, header);
site_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);
@ -89,7 +83,7 @@ static int parse_file(const char* top, const char* full) {
fprintf(f, " </head>\n");
fprintf(f, " <body>\n");
classic_body(f, top, title, body);
site_body(f, top, title, body);
fprintf(f, " </body>\n");
fprintf(f, "</html>\n");
@ -100,8 +94,7 @@ 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;
}
@ -109,16 +102,14 @@ 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) {