This commit is contained in:
Matteo Bini 2024-07-21 21:07:09 +02:00
parent fe87055e6d
commit 7a52b2ee33
1 changed files with 34 additions and 2 deletions

View File

@ -6,7 +6,7 @@
/* macros */ /* macros */
#define BODY_START_SIZE 26624 /* 26 x 1024 byte = 26 KiB */ #define BODY_START_SIZE 26624 /* 26 x 1024 byte = 26 KiB */
#define CLS_MAX 8 #define CLS_MAX 16
#define DATE_LEN 10 #define DATE_LEN 10
#define FAVICON "data:image/gif;base64,R0lGODlhEAAQAKEAAAAAcP///wAAcAAAcCH5BAEKAAIALAAAAAAQABAAQAIwlBWZxxwAQWjtTQRvlZhTnGSfYT3eZ3WaE4mjGa1UasoH7c6tzYanfqmhJMKXglcAADs=" #define FAVICON "data:image/gif;base64,R0lGODlhEAAQAKEAAAAAcP///wAAcAAAcCH5BAEKAAIALAAAAAAQABAAQAIwlBWZxxwAQWjtTQRvlZhTnGSfYT3eZ3WaE4mjGa1UasoH7c6tzYanfqmhJMKXglcAADs="
#define LANG_LEN 2 #define LANG_LEN 2
@ -47,6 +47,7 @@ static void cmd_ls(void);
static void cmd_no(const char *line); static void cmd_no(const char *line);
static void cmd_p(void); static void cmd_p(void);
static void cmd_pd(const char *line); static void cmd_pd(const char *line);
static void cmd_q(const char *line);
static void cmd_st(const char *line); static void cmd_st(const char *line);
static void cmd_tm(const char *line); static void cmd_tm(const char *line);
static void cmd_ur(const char *line); static void cmd_ur(const char *line);
@ -145,6 +146,8 @@ cmd(char *line)
cmd_p(); cmd_p();
else if (!strncmp(line, "PD", cmdlen)) else if (!strncmp(line, "PD", cmdlen))
cmd_pd(line); cmd_pd(line);
else if (!strncmp(line, "Q", cmdlen))
cmd_q(line);
else if (!strncmp(line, "ST", cmdlen)) else if (!strncmp(line, "ST", cmdlen))
cmd_st(line); cmd_st(line);
else if (!strncmp(line, "TI", cmdlen)) else if (!strncmp(line, "TI", cmdlen))
@ -403,6 +406,34 @@ cmd_pd(const char *line)
strncpy(pub_date, line, DATE_LEN); strncpy(pub_date, line, DATE_LEN);
} }
void
cmd_q(const char *line)
{
char *cite;
cite = NULL;
/* move past "Q" */
line += 1;
/* move past argument, if found it */
line += stread_param(line, &cite);
if (space)
string_cat(&body, " ");
string_cat(&body, "<q");
if (strcmp(cite, "")) {
string_cat(&body, " cite=\"");
string_cat_html(&body, cite, 1);
string_cat(&body, "\"");
}
string_cat(&body, ">");
space = 0;
strcpy(closure, "</q></p>");
free(cite);
}
void void
cmd_st(const char *line) cmd_st(const char *line)
{ {
@ -412,7 +443,7 @@ cmd_st(const char *line)
if (line[0] == ' ') if (line[0] == ' ')
line++; line++;
if (space) if (space && body.str[body.len - 1] != '\'')
string_cat(&body, " "); string_cat(&body, " ");
string_cat(&body, "<strong>"); string_cat(&body, "<strong>");
string_cat(&body, line); string_cat(&body, line);
@ -667,6 +698,7 @@ main (int argc, char *argv[])
else { else {
if (space && if (space &&
line[0] != '!' && line[0] != '!' &&
line[0] != '\'' &&
line[0] != ',' && line[0] != ',' &&
line[0] != '.' && line[0] != '.' &&
line[0] != '.' && line[0] != '.' &&