Don't dump more than 100 char in g_warnings about missing HTML tags errors
authorwwp <wwp@free.fr>
Fri, 13 Jan 2017 07:46:13 +0000 (08:46 +0100)
committerwwp <wwp@free.fr>
Fri, 13 Jan 2017 07:46:13 +0000 (08:46 +0100)
while parsing, unless --debug mode is set.

src/html.c

index 815f4464663d8f0c238d3a2e6503e9e49a9a63e8..fd623b1931d301352972651fbc5fd2562dd2a272 100644 (file)
@@ -579,7 +579,15 @@ static SC_HTMLTag *sc_html_get_tag(const gchar *str)
                                tmpp++;
                                attr_value = tmpp;
                                if ((p = strchr(attr_value, quote)) == NULL) {
                                tmpp++;
                                attr_value = tmpp;
                                if ((p = strchr(attr_value, quote)) == NULL) {
-                                       g_warning("sc_html_get_tag(): syntax error in tag: '%s'", str);
+                                       if (debug_get_mode()) {
+                                               g_warning("sc_html_get_tag(): syntax error in tag: '%s'",
+                                                                 str);
+                                       } else {
+                                               gchar *cut = g_strndup(str, 100);
+                                               g_warning("sc_html_get_tag(): syntax error in tag: '%s%s'",
+                                                                 cut, strlen(str)>100?"...":".");
+                                               g_free(cut);
+                                       }
                                        return tag;
                                }
                                tmpp = p;
                                        return tag;
                                }
                                tmpp = p;