diff options
author | Gehad elrobey <gehadelrobey@gmail.com> | 2014-06-02 20:10:54 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-06-06 10:08:09 -0700 |
commit | 464a611d8d5dbef8c3d62320f7b89e6c4ffaab53 (patch) | |
tree | b4c5e4a1221a9a3576215677ce762d5daf1bea7c /save-xml.c | |
parent | 1120379b2bcdc2d941bb2e036bacf34d226e74a1 (diff) | |
download | subsurface-464a611d8d5dbef8c3d62320f7b89e6c4ffaab53.tar.gz |
HTML: Better quoting to the export strings
Move the quote function to membuffer.c and adding wrappers that call
it from both xml and html exporters to get rid of redundancy.
Quote the location, buddy, suit, tags and notes This
prevents js code from crashing.
[Miika Turkia: minor whitespace and code fix]
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'save-xml.c')
-rw-r--r-- | save-xml.c | 45 |
1 files changed, 2 insertions, 43 deletions
diff --git a/save-xml.c b/save-xml.c index d48d0ef08..9f2c2b46a 100644 --- a/save-xml.c +++ b/save-xml.c @@ -23,49 +23,8 @@ */ static void quote(struct membuffer *b, const char *text, int is_attribute) { - const char *p = text; - - for (;;) { - const char *escape; - - switch (*p++) { - default: - continue; - case 0: - escape = NULL; - break; - case 1 ... 8: - case 11: - case 12: - case 14 ... 31: - escape = "?"; - break; - case '<': - escape = "<"; - break; - case '>': - escape = ">"; - break; - case '&': - escape = "&"; - break; - case '\'': - if (!is_attribute) - continue; - escape = "'"; - break; - case '\"': - if (!is_attribute) - continue; - escape = """; - break; - } - put_bytes(b, text, (p - text - 1)); - if (!escape) - break; - put_string(b, escape); - text = p; - } + int is_html = 0; + put_quoted(b, text, is_attribute, is_html); } static void show_utf8(struct membuffer *b, const char *text, const char *pre, const char *post, int is_attribute) |