add table and proper attributes
All checks were successful
pyrite-dev/taiga/pipeline/head This commit looks good
All checks were successful
pyrite-dev/taiga/pipeline/head This commit looks good
This commit is contained in:
parent
ee77f4db27
commit
2900fb1fac
3 changed files with 65 additions and 27 deletions
|
|
@ -92,12 +92,24 @@ void classic_stylesheet(FILE* out, const char* top) {
|
|||
fprintf(out, " padding-left: 8px;\n");
|
||||
fprintf(out, "}\n");
|
||||
fprintf(out, "\n");
|
||||
fprintf(out, "tr.even {\n");
|
||||
fprintf(out, " background-color: #eeeeee;\n");
|
||||
fprintf(out, ".grid, .grid th, .grid td {\n");
|
||||
fprintf(out, " border: none;\n");
|
||||
fprintf(out, "}\n");
|
||||
fprintf(out, "\n");
|
||||
fprintf(out, "tr.odd {\n");
|
||||
fprintf(out, " background-color: #dddddd;\n");
|
||||
fprintf(out, ".grid th, .grid td {\n");
|
||||
fprintf(out, " text-align: left;\n");
|
||||
fprintf(out, " vertical-align: top;\n");
|
||||
fprintf(out, " padding: 2px 3px;\n");
|
||||
fprintf(out, "}\n");
|
||||
fprintf(out, "\n");
|
||||
fprintf(out, ".grid th {\n");
|
||||
fprintf(out, " background-color: #cccccc;\n");
|
||||
fprintf(out, "}\n");
|
||||
fprintf(out, "\n");
|
||||
fprintf(out, ".grid td {\n");
|
||||
fprintf(out, " background-color: #ffffff;\n");
|
||||
fprintf(out, " border-top: 1px solid #cccccc;\n");
|
||||
fprintf(out, " border-left: 1px solid #cccccc;\n");
|
||||
fprintf(out, "}\n");
|
||||
fprintf(out, "\n");
|
||||
fprintf(out, ".message-icon {\n");
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ 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];
|
||||
char text[2048];
|
||||
int add = 0;
|
||||
|
||||
tag[0] = end[0] = 0;
|
||||
|
|
@ -92,24 +93,33 @@ void default_body(FILE* out, const char* top, xl_node_t* element, int indent) {
|
|||
} else if(strcmp(element->name, "fixme") == 0 || /**/
|
||||
strcmp(element->name, "warning") == 0 || /**/
|
||||
strcmp(element->name, "note") == 0) {
|
||||
char* text = "";
|
||||
char* say = "";
|
||||
char author[2048];
|
||||
char* attr;
|
||||
|
||||
author[0] = 0;
|
||||
|
||||
accept_attr(text, element, "id", "class", NULL);
|
||||
|
||||
if(strcmp(element->name, "fixme") == 0) {
|
||||
text = "Fixme";
|
||||
say = "Fixme";
|
||||
|
||||
strcpy(author, " ()");
|
||||
if((attr = xl_get_attribute(element, "author")) != NULL) sprintf(author, " (%s)", attr);
|
||||
} else if(strcmp(element->name, "warning") == 0) {
|
||||
text = "Warning";
|
||||
say = "Warning";
|
||||
} else if(strcmp(element->name, "note") == 0) {
|
||||
text = "Note";
|
||||
say = "Note";
|
||||
}
|
||||
|
||||
sprintf(tag + strlen(tag), "<div class=\"%s-message\">\n", element->name);
|
||||
sprintf(tag + strlen(tag), "<div class=\"%s-message\"%s>\n", element->name, text);
|
||||
sprintf(tag + strlen(tag), " <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%%\">\n");
|
||||
sprintf(tag + strlen(tag), " <tr>\n");
|
||||
sprintf(tag + strlen(tag), " <td rowspan=\"2\" class=\"message-icon\">\n");
|
||||
sprintf(tag + strlen(tag), " <img src=\"%simage/%s.png\">\n", top, element->name);
|
||||
sprintf(tag + strlen(tag), " </td>\n");
|
||||
sprintf(tag + strlen(tag), " <td>\n");
|
||||
sprintf(tag + strlen(tag), " <b>%s</b>\n", text);
|
||||
sprintf(tag + strlen(tag), " <b>%s%s</b>\n", say, author);
|
||||
sprintf(tag + strlen(tag), " </td>\n");
|
||||
sprintf(tag + strlen(tag), " </tr>\n");
|
||||
sprintf(tag + strlen(tag), " <tr>\n");
|
||||
|
|
@ -124,50 +134,62 @@ void default_body(FILE* out, const char* top, xl_node_t* element, int indent) {
|
|||
} else if(strcmp(element->name, "p") == 0 || /**/
|
||||
strcmp(element->name, "code") == 0 || /**/
|
||||
strcmp(element->name, "blockquote") == 0 || /**/
|
||||
strcmp(element->name, "ul") == 0 || /**/
|
||||
strcmp(element->name, "ol") == 0 || /**/
|
||||
strcmp(element->name, "li") == 0 || /**/
|
||||
strcmp(element->name, "dt") == 0 || /**/
|
||||
strcmp(element->name, "dd") == 0 || /**/
|
||||
strcmp(element->name, "strong") == 0 || /**/
|
||||
strcmp(element->name, "sub") == 0 || /**/
|
||||
strcmp(element->name, "sup") == 0 || /**/
|
||||
strcmp(element->name, "tr") == 0) {
|
||||
sprintf(tag, "<%s>", element->name);
|
||||
strcmp(element->name, "tr") == 0 || /**/
|
||||
strcmp(element->name, "em") == 0) {
|
||||
accept_attr(text, element, "id", "class", NULL);
|
||||
|
||||
sprintf(tag, "<%s%s>", element->name, text);
|
||||
|
||||
sprintf(end, "</%s>", element->name);
|
||||
} else if(strcmp(element->name, "ul") == 0 || /**/
|
||||
strcmp(element->name, "ol") == 0) {
|
||||
accept_attr(text, element, "id", "class", "spacing", NULL);
|
||||
|
||||
sprintf(tag, "<%s%s>", element->name, text);
|
||||
|
||||
sprintf(end, "</%s>", element->name);
|
||||
} else if(strcmp(element->name, "a") == 0) {
|
||||
char text[2048];
|
||||
|
||||
accept_attr(text, element, "href", NULL);
|
||||
accept_attr(text, element, "id", "class", "href", "title", "rel", NULL);
|
||||
|
||||
sprintf(tag, "<%s%s>", element->name, text);
|
||||
|
||||
sprintf(end, "</%s>", element->name);
|
||||
} else if(strcmp(element->name, "td") == 0 || /**/
|
||||
strcmp(element->name, "th") == 0) {
|
||||
char text[2048];
|
||||
|
||||
accept_attr(text, element, "rowspan", "colspan", NULL);
|
||||
accept_attr(text, element, "id", "class", "rowspan", "colspan", NULL);
|
||||
|
||||
sprintf(tag, "<%s%s>", element->name, text);
|
||||
|
||||
sprintf(end, "</%s>", element->name);
|
||||
} else if(strcmp(element->name, "img") == 0 || /**/
|
||||
strcmp(element->name, "script") == 0) {
|
||||
char text[2048];
|
||||
} else if(strcmp(element->name, "img") == 0) {
|
||||
accept_attr(text, element, "src", "alt", "title", "height", "width", "id", "class", NULL);
|
||||
|
||||
accept_attr(text, element, "src", NULL);
|
||||
sprintf(tag, "<%s%s>", element->name, text);
|
||||
|
||||
sprintf(end, "</%s>", element->name);
|
||||
} else if(strcmp(element->name, "script") == 0) {
|
||||
accept_attr(text, element, "src", "type", NULL);
|
||||
|
||||
sprintf(tag, "<%s%s>", element->name, text);
|
||||
|
||||
sprintf(end, "</%s>", element->name);
|
||||
} else if(strcmp(element->name, "table") == 0) {
|
||||
sprintf(tag, "<%s>", element->name);
|
||||
accept_attr(text, element, "id", "class", NULL);
|
||||
|
||||
sprintf(tag, "<%s%s class=\"grid\" width=\"100%%\" cellpadding=\"3\" cellspacing=\"2\" border=\"1\">", element->name, text);
|
||||
|
||||
sprintf(end, "</%s>", element->name);
|
||||
} else if(strcmp(element->name, "hr") == 0) {
|
||||
sprintf(tag, "<%s>", element->name);
|
||||
} else if(strcmp(element->name, "hr") == 0 || /**/
|
||||
strcmp(element->name, "br") == 0) {
|
||||
accept_attr(text, element, "id", "class", NULL);
|
||||
|
||||
sprintf(tag, "<%s%text>", element->name, text);
|
||||
}
|
||||
|
||||
if(tag[0] != 0) print(out, tag, indent);
|
||||
|
|
|
|||
|
|
@ -109,6 +109,10 @@ int action_seed(int argc, char** argv) {
|
|||
fprintf(f, " <note>\n");
|
||||
fprintf(f, " Please read this!\n");
|
||||
fprintf(f, " </note>\n");
|
||||
fprintf(f, " <table>\n");
|
||||
fprintf(f, " <tr><th>Test</th><th>Test</th></tr>\n");
|
||||
fprintf(f, " <tr><td>Test</td><td>Test</td></tr>\n");
|
||||
fprintf(f, " </table>\n");
|
||||
fprintf(f, " <section title=\"Congratulations\">\n");
|
||||
fprintf(f, " <p>\n");
|
||||
fprintf(f, " You have successfully generated and rendered a website using Taiga - static website generator.\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue