Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Macao Legacy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
MACAO
Macao Legacy
Commits
a39c5550
Commit
a39c5550
authored
2 months ago
by
David Rouquet
Browse files
Options
Downloads
Patches
Plain Diff
Replace strings in MD
parent
90130c9b
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tetras_extraction/script/src/transform.py
+11
-3
11 additions, 3 deletions
tetras_extraction/script/src/transform.py
with
11 additions
and
3 deletions
tetras_extraction/script/src/transform.py
+
11
−
3
View file @
a39c5550
...
@@ -76,7 +76,7 @@ def postEditMD(str):
...
@@ -76,7 +76,7 @@ def postEditMD(str):
regexIMG
=
re
.
compile
(
r
"
@IMAGESTART.*?@IMAGEEND
"
)
regexIMG
=
re
.
compile
(
r
"
@IMAGESTART.*?@IMAGEEND
"
)
for
imageElt
in
regexIMG
.
findall
(
str
):
for
imageElt
in
regexIMG
.
findall
(
str
):
imgFilename
=
imageElt
.
replace
(
"
@IMAGESTART
"
,
""
).
replace
(
"
@IMAGEEND
"
,
""
).
replace
(
r
"
\_
"
,
"
_
"
)
imgFilename
=
imageElt
.
replace
(
"
@IMAGESTART
"
,
""
).
replace
(
"
@IMAGEEND
"
,
""
).
replace
(
r
"
\_
"
,
"
_
"
)
imgHtml
=
'
<img
style=
"
vertical-align:middle;
"
src=
"
/macao-hugo/media/
'
+
imgFilename
+
'"
id=
"'
+
imgFilename
+
'"
/>
'
imgHtml
=
'
<img
class=
"
inlineImage
"
src=
"
/macao-hugo/media/
'
+
imgFilename
+
'"
id=
"'
+
imgFilename
+
'"
/>
'
str
=
str
.
replace
(
imageElt
,
imgHtml
)
str
=
str
.
replace
(
imageElt
,
imgHtml
)
###################################################
###################################################
...
@@ -91,13 +91,21 @@ def postEditMD(str):
...
@@ -91,13 +91,21 @@ def postEditMD(str):
if
'
@COMMENTIDSTART
'
in
str
:
if
'
@COMMENTIDSTART
'
in
str
:
str
=
str
.
replace
(
'
@COMMENTIDSTART@
'
,
'
<div class=
"
commentaireInfo
"
commentaireId=
"'
).
replace
(
'
@COMMENTIDEND
'
,
'"
>
'
)
+
'
</div>
'
str
=
str
.
replace
(
'
@COMMENTIDSTART@
'
,
'
<div class=
"
commentaireInfo
"
commentaireId=
"'
).
replace
(
'
@COMMENTIDEND
'
,
'"
>
'
)
+
'
</div>
'
###################################################
###################################################
# Add html for images and fix media paths
# Add html for images and fix media paths
###################################################
regexIMG
=
re
.
compile
(
r
"
!\[\]\(\.\./media/(.*?)\)
"
)
regexIMG
=
re
.
compile
(
r
"
!\[\]\(\.\./media/(.*?)\)
"
)
str
=
regexIMG
.
sub
(
r
"
<img src=
'
/macao-hugo/media/\1
'
>
"
,
str
)
str
=
regexIMG
.
sub
(
r
"
<img src=
'
/macao-hugo/media/\1
'
>
"
,
str
)
###################################################
# Some global string replacement
###################################################
str
=
str
.
replace
(
"""
Pour vous enregistrer ou interrompre
l
'
enregistrement, cliquez sur le bouton rouge.
Pour vous réécouter, cliquez sur la flèche
noire.
"""
,
""
)
str
=
str
.
replace
(
"
hauts-parleurs
"
,
"
flèches
"
)
return
(
str
)
return
(
str
)
...
...
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