Skip to content
Snippets Groups Projects
Commit d6a8d106 authored by Mathieu Loiseau's avatar Mathieu Loiseau
Browse files

id + remove floats

parent 26be2f42
No related branches found
No related tags found
No related merge requests found
...@@ -65,7 +65,7 @@ class Quizz: ...@@ -65,7 +65,7 @@ class Quizz:
class Question: class Question:
def __init__(self,xmlQ,c,n,f): def __init__(self,xmlQ,c,n,f):
self.folder = f self.folder = f
self.id = mlang_2_multiling(xmlQ.find("name/text").text,"en")+f".{n}" self.id = c+"."+mlang_2_multiling(xmlQ.find("name/text").text,"en")+f".{n}"
self.q = strip_tags(mlang_2_multiling(xmlQ.find("questiontext/text").text), self.folder,self.id) self.q = strip_tags(mlang_2_multiling(xmlQ.find("questiontext/text").text), self.folder,self.id)
self.category = c self.category = c
self.env = "todo:"+xmlQ.attrib["type"] self.env = "todo:"+xmlQ.attrib["type"]
......
...@@ -22,13 +22,7 @@ def process_listings(txt, folder="",q="q"): ...@@ -22,13 +22,7 @@ def process_listings(txt, folder="",q="q"):
def remove_moodle_cdata(txt, folder, q): def remove_moodle_cdata(txt, folder, q):
global unsafe global unsafe
txt = process_listings(txt, folder, q) txt = process_listings(txt, folder, q)
res = sub(r'<img src="[^/]*/([^"]*)" (alt="([^"]*)")?[^>]*>', r"""\\begin{figure}[h!] res = sub(r'<img src="[^/]*/([^"]*)" (alt="([^"]*)")?[^>]*>', r"""\\\\\\includegraphics[width=0.8\\linewidth]{Images/\1}""",txt).replace("<![CDATA[","").replace("]]>","").replace("<strong>","\\emph{").replace("</strong>","}")
\\begin{center}
\\includegraphics[width=0.8\\linewidth]{Images/\1}
\\end{center}
\\caption{\3}
\\end{figure}
""",txt).replace("<![CDATA[","").replace("]]>","").replace("<strong>","\\emph{").replace("</strong>","}")
if unsafe: if unsafe:
res = res.replace('<span style="font:monospace">',"\lstinline[language=python]|").replace('<span style="font-family:monospace">',"\lstinline[language=python]|").replace('<span style="font-family=monospace">',"\lstinline[language=python]|").replace("</span>","|") res = res.replace('<span style="font:monospace">',"\lstinline[language=python]|").replace('<span style="font-family:monospace">',"\lstinline[language=python]|").replace('<span style="font-family=monospace">',"\lstinline[language=python]|").replace("</span>","|")
return res return res
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment