1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
|
def translate(text):
#spezielles
text = text.replace("\\br", "<p>")
#deutsche Umlaute und Sonderzeichen
text = text.replace("\\\"a", "ä")
text = text.replace("\\\"o", "ö")
text = text.replace("\\\"u", "ü")
text = text.replace("\\\"A", "Ä")
text = text.replace("\\\"O", "Ö")
text = text.replace("\\\"U", "Ü")
text = text.replace("\\3", "ß")
text = text.replace("\\ss", "ß")
#escapen spezieller Zeichen
text = text.replace("\\colon", ":")
text = text.replace("\\dot", ".")
text = text.replace("\\at", "@")
text = text.replace("\\pipe", "|")
text = text.replace("\\dollar", "$")
text = text.replace("\\quote", "\"")
text = text.replace("\\backslash", "\\")
#Vergleiche
text = text.replace("\\neq", "≠")
text = text.replace("\\approx", "≈")
text = text.replace("\\equiv", "≡")
text = text.replace("\\leq", "≤")
text = text.replace("\\geq", "≥")
#Binaere Operatoren
text = text.replace("\\pm", "±") #"<font face=\"symbol\">±</font>")
text = text.replace("\\times", "×") #"<font face=\"symbol\">´</font>")
text = text.replace("\\cdot", "·") #"<font face=\"symbol\">×</font>")
text = text.replace("\\div", "÷") #"<font face=\"symbol\">¸</font>")
text = text.replace("\\ast", "*")
text = text.replace("\\circ", "○") #"<font face=\"symbol\">°</font>")
text = text.replace("\\otimes", "<font face=\"symbol\">Ä</font>")
text = text.replace("\\oplus", "<font face=\"symbol\">Å</font>")
#Logik
text = text.replace("\\exists", "<font face=\"symbol\">$</font>")
text = text.replace("\\forall", "<font face=\"symbol\">"</font>")
text = text.replace("\\neg", "<font face=\"symbol\">Ø</font>")
text = text.replace("\\vee", "<font face=\"symbol\">Ú</font>")
text = text.replace("\\wedge", "<font face=\"symbol\">Ù</font>")
#Mengenlehre
text = text.replace("\\in", "<font face=\"symbol\">Î</font>")
text = text.replace("\\ni", "<font face=\"symbol\">'</font>")
text = text.replace("\\notin", "<font face=\"symbol\">Ï</font>")
text = text.replace("\\cup", "<font face=\"symbol\">È</font>")
text = text.replace("\\cap", "<font face=\"symbol\">Ç</font>")
text = text.replace("\\subset", "<font face=\"symbol\">Ì</font>")
text = text.replace("\\supset", "<font face=\"symbol\">É</font>")
text = text.replace("\\subseteq", "<font face=\"symbol\">Í</font>")
text = text.replace("\\supseteq", "<font face=\"symbol\">Ê</font>")
#Pfeile
text = text.replace("\\leftarrow", "←")
text = text.replace("\\rightarrow", "→")
text = text.replace("\\leftrightarrow", "↔")
text = text.replace("\\Leftarrow", "<font face=\"symbol\">Ü</font>")
text = text.replace("\\Rightarrow", "<font face=\"symbol\">Þ</font>")
text = text.replace("\\Leftrightarrow", "<font face=\"symbol\">Û</font>")
#Spezielle Zeichen
text = text.replace("\\infty", "∞")
text = text.replace("\\ldots", "...")
text = text.replace("\\squared", "²")
text = text.replace("\\cubic", "³")
#Griechische Buchstaben
text = text.replace("\\Gamma", "Γ")
text = text.replace("\\Delta", "Δ")
text = text.replace("\\Theta", "Θ")
text = text.replace("\\Lambda", "Λ")
text = text.replace("\\Xi", "Ξ")
text = text.replace("\\Pi", "Π")
text = text.replace("\\Sigma", "Σ")
text = text.replace("\\Phi", "Φ")
text = text.replace("\\Psi", "Ψ")
text = text.replace("\\Omega", "Ω")
text = text.replace("\\alpha", "α")
text = text.replace("\\beta", "β")
text = text.replace("\\gamma", "γ")
text = text.replace("\\delta", "δ")
text = text.replace("\\epsilon", "ε")
text = text.replace("\\zeta", "ζ")
text = text.replace("\\eta", "η")
text = text.replace("\\theta", "θ")
text = text.replace("\\iota", "ι")
text = text.replace("\\kappa", "κ")
text = text.replace("\\lambda", "λ")
text = text.replace("\\mu", "μ")
text = text.replace("\\nu", "ν")
text = text.replace("\\xi", "ξ")
text = text.replace("\\omicron", "ο")
text = text.replace("\\pi", "π")
text = text.replace("\\rho", "ρ")
text = text.replace("\\varsigma", "ς")
text = text.replace("\\sigma", "σ")
text = text.replace("\\tau", "τ")
text = text.replace("\\upsilon", "υ")
text = text.replace("\\phi", "φ")
text = text.replace("\\chi", "χ")
text = text.replace("\\psi", "ψ")
text = text.replace("\\omega", "ω")
return text
|