def fricas_md(s): import re t = fricas._eval_line_using_file(s, restart_if_needed=False, reformat=False) # cleanup plain text t=re.compile(r'\r\r').sub('\r',t,count=0) t=re.compile(r'\r').sub('\n',t,count=0) t=re.compile(r' ').sub('',t,count=0) t=re.compile(r' ').sub(' ',t,count=0) #t=re.compile(r' Compiling').sub('Compiling',t) # fix mathml overbar t=re.compile(r'¯').sub('‾',t,count=0) # cleanup FriCAS LaTeX t=re.compile(r'\\leqno\(.*\)\n').sub('',t) t=re.compile(r'\\sb ').sub('_',t,count=0) t=re.compile(r'\\sp ').sub('^',t,count=0) t=re.compile(r'\\erf ').sub(r'\\mathrm{erf}',t,count=0) t=re.compile(r'\\sech ').sub(r'\\mathrm{sech}',t,count=0) t=re.compile(r'\\tanh ').sub(r'\\mathrm{tanh}',t,count=0) # float result type to the right t=re.compile(r' *Type: (.*)\n').sub(r'
Type: \1
\n',t,count=0) #print t md(t, hide=False)