struct _Escape
{
const char *escape;
- const char value;
+ const char *value;
};
struct _Tmp_Info
static Eina_Bool pasteimage_append(char *file, Evas_Object *entry);
+#define _PARAGRAPH_SEPARATOR "\xE2\x80\xA9"
+
/* Optimisation: Turn this into a 256 byte table:
* then can lookup in one index, not N checks */
static const Escape escapes[] = {
- { "<br>", '\n' },
- { "<\t>", '\t' },
- { "gt;", '>' },
- { "lt;", '<' },
- { "amp;", '&' },
- { "quot;", '\'' },
- { "dquot;", '"' }
+ { "<ps>", _PARAGRAPH_SEPARATOR },
+ { "<br>", "\n" },
+ { "<\t>", "\t" },
+ { "gt;", ">" },
+ { "lt;", "<" },
+ { "amp;", "&" },
+ { "quot;", "\'" },
+ { "dquot;", "\"" }
};
#define N_ESCAPES ((int)(sizeof(escapes) / sizeof(escapes[0])))
int i;
if (!p) return NULL;
- q = malloc(strlen(p) + 1);
+ q = malloc(strlen(p)+1);
if (!q) return NULL;
ret = q;
if ((p[1] == 'b') && (p[2] == 'r') &&
((p[3] == ' ') || (p[3] == '/') || (p[3] == '>')))
*q++ = '\n';
+ else if ((p[1] == 'p') && (p[2] == 's') && (p[3] == '>'))
+ {
+ strcpy(q, _PARAGRAPH_SEPARATOR);
+ q += (sizeof(_PARAGRAPH_SEPARATOR)-1);
+ }
while ((*p) && (*p != '>')) p++;
p++;
}
if (!strncmp(p,escapes[i].escape, strlen(escapes[i].escape)))
{
p += strlen(escapes[i].escape);
- *q = escapes[i].value;
- q++;
+ strcpy(q, escapes[i].value);
+ q += strlen(escapes[i].value);
break;
}
}
{
for (i = 0 ; i < N_ESCAPES ; i ++)
{
- if (*p == escapes[i].value)
+ if (*p == escapes[i].value[0])
{
- l += strlen(escapes[i].escape);
+ if (!strncmp(p, escapes[i].value, strlen(escapes[i].value)))
+ l += strlen(escapes[i].escape);
break;
}
}
{
for (i = 0; i < N_ESCAPES; i++)
{
- if (*p == escapes[i].value)
+ if (*p == escapes[i].value[0])
{
- strcpy(q, escapes[i].escape);
- q += strlen(escapes[i].escape);
- p ++;
+ if (!strncmp(p, escapes[i].value, strlen(escapes[i].value)))
+ {
+ strcpy(q, escapes[i].escape);
+ q += strlen(escapes[i].escape);
+ p += strlen(escapes[i].value);
+ }
break;
}
}