Gehad's patches
Gehad
gehadelrobey at gmail.com
Wed Jun 4 13:47:31 PDT 2014
The attached patch move the quote function to membuffer.c with some
generalization as suggested.
some wrapper functions fix up the parameters for both save-xml and
save-html.
I didn't add save-git to make the function simpler, the quote function
in save-git is a little bit different, so I think it will complicate
things up.
also another patch for fixing the path in different platforms.
On 06/04/2014 07:15 AM, Dirk Hohndel wrote:
> On Tue, Jun 03, 2014 at 09:12:36PM +0300, Miika Turkia wrote:
>> From 684bdf422b466763045a25179b0ee022c9cb5cf3 Mon Sep 17 00:00:00 2001
>> From: Gehad elrobey <gehadelrobey at gmail.com>
>> Date: Mon, 2 Jun 2014 20:10:54 +0300
>> Subject: [PATCH 6/7] HTML: Better quoting to the export strings
>>
>> Quote the location, buddy, suit, tags and notes.
>> This prevents JS code from crashing.
>>
>> Signed-off-by: Gehad elrobey <gehadelrobey at gmail.com>
>> Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
>>
>> -char *replace_char(char *str, char replace, char *replace_by)
>> +void put_quoted(struct membuffer *b, const char *text)
>> {
>> + 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 '\'':
>> + escape = "'";
>> + break;
>> + case '\"':
>> + escape = """;
>> + break;
>> + case '\n':
>> + escape = "<br>";
>> + break;
>> + }
>> + put_bytes(b, text, (p - text - 1));
>> + if (!escape)
>> + break;
>> + put_string(b, escape);
>> + text = p;
>> }
> This is more or less verbatim the quote() function from save-xml.c.
> Why not just call that function (or have a wrapper around it)?
> I hate the idea of having basically identical quote twice.
>
> I took the other patches, this one I would like to see redone.
>
> /D
--
Regards,
Gehad Elrobey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-HTML-export-to-system-dependant-path-separator.patch
Type: text/x-patch
Size: 955 bytes
Desc: not available
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20140604/c356bd11/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-HTML-Better-quoting-to-the-export-strings.patch
Type: text/x-patch
Size: 8154 bytes
Desc: not available
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20140604/c356bd11/attachment-0001.bin>
More information about the subsurface
mailing list