diff --git a/example/manual.clc b/example/manual.clc index c0edd1c..3f182f1 100644 --- a/example/manual.clc +++ b/example/manual.clc @@ -131,11 +131,40 @@ The description of the botton of the 2nd toolbar is shown below (from left to ri - apply the "font" shown in the "font" list to the selected text +[subsection "Basic input, [docu], and special character"] + +Basically, you can type the sentence that you want to type directly in sile. However, the document should be inside a macro call "\"docu\"". For example: + +[call noindent][font-family "Noto Sans Mono CJK TC" [str "[docu Hello world!]"]] + +It will show + +Hello world! + +However, if it's a macro name (eg. "docu, font, font-family, ..."), you have to put them between 2 quotation marks"\"". eg: + +[call noindent][font-family "Noto Sans Mono CJK TC" "[docu \"docu\"]"] + +It will show + +"docu" + +To type brackets \[ & \], you should type \\\[ & \\\] respectively; and to type blackslash \\, you should type \\\\. To type quotation mark \", you should type \\\". A word or a sentence between 2 quotation marks (\") will be shown without the quotation marks. eg: [font-family "Noto Sans Mono CJK TC" "\"It will be there.\""] + +will be shown as: + +"It will be there." + +To make the quotation mark shown, you should enclose it between quotation mark \" and using \\\". [font-family "Noto Sans Mono CJK TC" "\"\\\"It will be there.\\\"\""] will be shown as: + +"\"It will be there.\"" + + + [subsection "Arimetic calculation and variable and function definition"] -[subsection "Special character"] [subsection "Font formatting"] diff --git a/example/toolbars.png b/example/toolbars.png new file mode 100644 index 0000000..6b658b3 Binary files /dev/null and b/example/toolbars.png differ diff --git a/src/Clochur/Interpreter.py b/src/Clochur/Interpreter.py index c239b1d..827b9ec 100644 --- a/src/Clochur/Interpreter.py +++ b/src/Clochur/Interpreter.py @@ -116,11 +116,12 @@ class Interpreter: string = str(string) if re.match(string_pattern, string): # reverse the escape characters - while True: - string_before = string - string = re.sub(r'\\"(.+)',r'"\1',string) - if string_before == string: - break + #while True: + # string_before = string + # string = string.replace('\\"','"') + #if string_before == string: + # break + #string = string.replace('\\"','"') return string[1:-1] else: return string @@ -133,6 +134,7 @@ class Interpreter: sexp_word = sexp["token"] sexp_word = sexp_word.replace("\\[", "[") sexp_word = sexp_word.replace("\\]", "]") + sexp_word = sexp_word.replace("\\\"", "\"") sexp_word = sexp_word.replace("\\\\", "\\") sexp_word = sexp_word.replace("&", "&") sexp_word = sexp_word.replace("<", "<") diff --git a/src/example.pdf b/src/example.pdf index 9b1eef2..ba23075 100644 Binary files a/src/example.pdf and b/src/example.pdf differ