Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moodle to amc
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mathieu Loiseau
moodle to amc
Commits
d6a8d106
Commit
d6a8d106
authored
3 years ago
by
Mathieu Loiseau
Browse files
Options
Downloads
Patches
Plain Diff
id + remove floats
parent
26be2f42
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
XML_Moodle.py
+1
-1
1 addition, 1 deletion
XML_Moodle.py
utils.py
+1
-7
1 addition, 7 deletions
utils.py
with
2 additions
and
8 deletions
XML_Moodle.py
+
1
−
1
View file @
d6a8d106
...
...
@@ -65,7 +65,7 @@ class Quizz:
class
Question
:
def
__init__
(
self
,
xmlQ
,
c
,
n
,
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
.
category
=
c
self
.
env
=
"
todo:
"
+
xmlQ
.
attrib
[
"
type
"
]
...
...
This diff is collapsed.
Click to expand it.
utils.py
+
1
−
7
View file @
d6a8d106
...
...
@@ -22,13 +22,7 @@ def process_listings(txt, folder="",q="q"):
def
remove_moodle_cdata
(
txt
,
folder
,
q
):
global
unsafe
txt
=
process_listings
(
txt
,
folder
,
q
)
res
=
sub
(
r
'
<img src=
"
[^/]*/([^
"
]*)
"
(alt=
"
([^
"
]*)
"
)?[^>]*>
'
,
r
"""
\\begin{figure}[h!]
\\begin{center}
\\includegraphics[width=0.8\\linewidth]{Images/\1}
\\end{center}
\\caption{\3}
\\end{figure}
"""
,
txt
).
replace
(
"
<![CDATA[
"
,
""
).
replace
(
"
]]>
"
,
""
).
replace
(
"
<strong>
"
,
"
\\
emph{
"
).
replace
(
"
</strong>
"
,
"
}
"
)
res
=
sub
(
r
'
<img src=
"
[^/]*/([^
"
]*)
"
(alt=
"
([^
"
]*)
"
)?[^>]*>
'
,
r
"""
\\\\\\includegraphics[width=0.8\\linewidth]{Images/\1}
"""
,
txt
).
replace
(
"
<![CDATA[
"
,
""
).
replace
(
"
]]>
"
,
""
).
replace
(
"
<strong>
"
,
"
\\
emph{
"
).
replace
(
"
</strong>
"
,
"
}
"
)
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>
"
,
"
|
"
)
return
res
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment