mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-14 17:45:04 +00:00
Some formatting refactoring.
This commit is contained in:
parent
88ea9b0839
commit
73323a7fc0
5 changed files with 7 additions and 9 deletions
|
@ -409,7 +409,7 @@ d_char *msg_actor(snac *snac)
|
||||||
msg = xs_dict_set(msg, "preferredUsername", snac->uid);
|
msg = xs_dict_set(msg, "preferredUsername", snac->uid);
|
||||||
msg = xs_dict_set(msg, "published", xs_dict_get(snac->config, "published"));
|
msg = xs_dict_set(msg, "published", xs_dict_get(snac->config, "published"));
|
||||||
|
|
||||||
not_really_markdown(xs_dict_get(snac->config, "bio"), &f_bio);
|
f_bio = not_really_markdown(xs_dict_get(snac->config, "bio"));
|
||||||
msg = xs_dict_set(msg, "summary", f_bio);
|
msg = xs_dict_set(msg, "summary", f_bio);
|
||||||
|
|
||||||
char *folders[] = { "inbox", "outbox", "followers", "following", NULL };
|
char *folders[] = { "inbox", "outbox", "followers", "following", NULL };
|
||||||
|
@ -548,7 +548,7 @@ d_char *msg_note(snac *snac, char *content, char *rcpts, char *in_reply_to, char
|
||||||
}
|
}
|
||||||
|
|
||||||
/* format the content */
|
/* format the content */
|
||||||
not_really_markdown(content, &fc2);
|
fc2 = not_really_markdown(content);
|
||||||
|
|
||||||
/* extract the tags */
|
/* extract the tags */
|
||||||
process_tags(fc2, &fc1, &tag);
|
process_tags(fc2, &fc1, &tag);
|
||||||
|
|
6
format.c
6
format.c
|
@ -34,7 +34,7 @@ struct {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
d_char *not_really_markdown(char *content, d_char **f_content)
|
d_char *not_really_markdown(char *content)
|
||||||
/* formats a content using some Markdown rules */
|
/* formats a content using some Markdown rules */
|
||||||
{
|
{
|
||||||
d_char *s = NULL;
|
d_char *s = NULL;
|
||||||
|
@ -149,9 +149,7 @@ d_char *not_really_markdown(char *content, d_char **f_content)
|
||||||
s = xs_replace_i(s, smileys[n].key, smileys[n].value);
|
s = xs_replace_i(s, smileys[n].key, smileys[n].value);
|
||||||
}
|
}
|
||||||
|
|
||||||
*f_content = s;
|
return s;
|
||||||
|
|
||||||
return *f_content;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
2
html.c
2
html.c
|
@ -215,7 +215,7 @@ d_char *html_user_header(snac *snac, d_char *s, int local)
|
||||||
"<div class=\"p-note snac-top-user-bio\">%s</div>\n"
|
"<div class=\"p-note snac-top-user-bio\">%s</div>\n"
|
||||||
"</div>\n";
|
"</div>\n";
|
||||||
|
|
||||||
not_really_markdown(xs_dict_get(snac->config, "bio"), &bio);
|
bio = not_really_markdown(xs_dict_get(snac->config, "bio"));
|
||||||
|
|
||||||
xs *s1 = xs_fmt(_tmpl,
|
xs *s1 = xs_fmt(_tmpl,
|
||||||
xs_dict_get(snac->config, "name"),
|
xs_dict_get(snac->config, "name"),
|
||||||
|
|
2
main.c
2
main.c
|
@ -79,7 +79,7 @@ int main(int argc, char *argv[])
|
||||||
if (strcmp(cmd, "markdown") == 0) {
|
if (strcmp(cmd, "markdown") == 0) {
|
||||||
/* undocumented, for testing only */
|
/* undocumented, for testing only */
|
||||||
xs *c = xs_readall(stdin);
|
xs *c = xs_readall(stdin);
|
||||||
xs *fc = not_really_markdown(c, &fc);
|
xs *fc = not_really_markdown(c);
|
||||||
|
|
||||||
printf("<html>\n%s\n</html>\n", fc);
|
printf("<html>\n%s\n</html>\n", fc);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
2
snac.h
2
snac.h
|
@ -135,7 +135,7 @@ int activitypub_post_handler(d_char *req, char *q_path,
|
||||||
char *payload, int p_size,
|
char *payload, int p_size,
|
||||||
char **body, int *b_size, char **ctype);
|
char **body, int *b_size, char **ctype);
|
||||||
|
|
||||||
d_char *not_really_markdown(char *content, d_char **f_content);
|
d_char *not_really_markdown(char *content);
|
||||||
d_char *sanitize(d_char *str);
|
d_char *sanitize(d_char *str);
|
||||||
|
|
||||||
int html_get_handler(d_char *req, char *q_path, char **body, int *b_size, char **ctype);
|
int html_get_handler(d_char *req, char *q_path, char **body, int *b_size, char **ctype);
|
||||||
|
|
Loading…
Reference in a new issue