add theme
All checks were successful
pyrite-dev/taiga/pipeline/head This commit looks good

This commit is contained in:
Nishi 2026-03-09 00:09:35 +09:00
commit bc940fdee9
Signed by: nishi
GPG key ID: 27EF69B208EB9343
9 changed files with 372 additions and 40 deletions

View file

@ -84,25 +84,50 @@ static int scan(const char* top, const char* path) {
site_body = x##_body;
int action_site(int argc, char** argv) {
int st = 0;
FILE* css;
int st = 0;
FILE* css;
xl_node_t** nodes;
io_mkdir("build", 0755);
USE_THEME(simple);
if((skinconf = xl_open_file("site/skinconf.xml")) == NULL ||
!xl_parse(skinconf)) {
if((skinconf = xl_open_file("site/skinconf.xml")) == NULL || !xl_parse(skinconf)) {
fprintf(stderr, "Failed to parse site/skinconf.xml!\n");
st = 1;
goto cleanup;
}
USE_THEME(classic);
if((nodes = xl_get_path(skinconf->root, "skin")) != NULL) {
if(nodes[0]->text != NULL) {
if(strcmp(nodes[0]->text, "classic") == 0) {
USE_THEME(classic);
} else if(strcmp(nodes[0]->text, "simple") == 0) {
USE_THEME(simple);
} else {
fprintf(stderr, "Unknown skin: %s\n", nodes[0]->text);
st = 1;
goto cleanup;
}
}
free(nodes);
}
if((css = fopen("build/style.css", "w")) == NULL) {
st = 1;
goto cleanup;
}
site_stylesheet(css, "build/");
if((nodes = xl_get_path(skinconf->root, "extra-css")) != NULL) {
if(nodes[0]->text != NULL) {
fwrite("\n", 1, 1, css);
fwrite(nodes[0]->text, 1, strlen(nodes[0]->text), css);
}
free(nodes);
}
fclose(css);
if(!scan("", "")) {