Fixed pango renderer.

This commit is contained in:
Markus Koch 2017-03-15 17:43:34 +01:00
parent 48a8f9b691
commit 07baf34a71

View File

@ -25,13 +25,24 @@ gchar *md_pango_render(gchar *markup, gint length)
g_regex_unref(regex); g_regex_unref(regex);
g_free(str); g_free(str);
regex = g_regex_new("#{2}(.*)", 0, 0, NULL); regex = g_regex_new("\\#{4}(.*)", 0, 0, NULL);
str = g_regex_replace(regex, str2, -1, 0, "<h1>\\1</h1>", 0, NULL); str = g_regex_replace(regex, str2, -1, 0, "<span font-size=\"large\">\\1</span>", 0, NULL);
g_regex_unref(regex); g_regex_unref(regex);
g_free(str2); g_free(str2);
regex = g_regex_new("#{1}(.*)", 0, 0, NULL); regex = g_regex_new("\\#{3}(.*)", 0, 0, NULL);
str2 = g_regex_replace(regex, str, -1, 0, "<h2>\\1</h2>", 0, NULL); str2 = g_regex_replace(regex, str, -1, 0, "<span font-size=\"x-large\">\\1</span>", 0, NULL);
g_regex_unref(regex);
g_free(str);
regex = g_regex_new("\\#{2}(.*)", 0, 0, NULL);
str = g_regex_replace(regex, str2, -1, 0, "<span font-size=\"xx-large\">\\1</span>", 0, NULL);
g_regex_unref(regex);
g_free(str2);
regex = g_regex_new("\\#{1}(.*)", 0, 0, NULL);
str2 = g_regex_replace(regex, str, -1, 0, "<span font_weight=\"bold\" font-size=\"xx-large\">\\1</span>",
0, NULL);
g_regex_unref(regex); g_regex_unref(regex);
g_free(str); g_free(str);