From e9ff6987a32bfdabfd490cc5ce78fb1676b8e8e3 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 1 Oct 2019 20:20:18 +0200 Subject: write_para: Escape special chars in the run text --- libstorycode/storycode.c | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) (limited to 'libstorycode') diff --git a/libstorycode/storycode.c b/libstorycode/storycode.c index c682d15..ced5bac 100644 --- a/libstorycode/storycode.c +++ b/libstorycode/storycode.c @@ -115,12 +115,53 @@ static void write_run_border(GOutputStream *fh, enum text_run_type t) } +static char *escape_text(const char *in) +{ + int i, j; + size_t len; + size_t nl = 0; + size_t np = 0; + const char *esc = "*/_"; + size_t n_esc = 3; + char *out; + + len = strlen(in); + for ( i=0; i