Logo Search packages:      
Sourcecode: uicilibris version File versions  Download package

def uicilibris::w2book::wiki2book::sanitize (   self,
  s 
)
@return a sanitized output: get rid of <math>, &amp; etc.
processes the comments left by previous works;
processes underscores in lines where there is no maths
turns lines with math-only contents to out-of text formulas
takes in account url-like words

Definition at line 171 of file w2book.py.

                         :
        """
        @return a sanitized output: get rid of <math>, &amp; etc.
        processes the comments left by previous works;
        processes underscores in lines where there is no maths
        turns lines with math-only contents to out-of text formulas
        takes in account url-like words
        """
        s=s.replace("&quot;","\"")
        s=s.replace("&amp;lt;math&gt;", "$")
        s=s.replace("&amp;lt;/math&gt;", "$")
        s=s.replace("&amp;lt;code&gt;", "\\texttt{")
        s=s.replace("&amp;lt;/code&gt;", "}")
        s=s.replace("&amp;lt;ref&gt;", "\\footnote{")
        s=s.replace("&amp;lt;/ref&gt;", " }")
        s=s.replace("&amp;lt;references /&gt;", "")
        s=s.replace("&amp;lt;", "<")
        s=s.replace("&gt;", ">")
        s=s.replace("&amp;","\\&")
        s=s.replace("%", "\\%{}")
        s=re.sub(r"\\comment\{(.*)\}",r"%% \1",s)
        if "$" not in s:
            s=s.replace("_","\\_")
        if len(s)>2 and s[0]=="$" and s[-1]=="$":
            s="$%s$" %s
        s=re.sub(r"(http://[^ \}]+)", r"\\href{\1 }{\mbox{\1} }",s)
        return s
    

Generated by  Doxygen 1.6.0   Back to index