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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MACAO
Macao Legacy
Commits
efbfe7a6
Commit
efbfe7a6
authored
5 months ago
by
David Rouquet
Browse files
Options
Downloads
Patches
Plain Diff
comments and anchors
parent
5f723d6c
No related branches found
No related tags found
1 merge request
!5
Resolve "Parseur par type d'activité"
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tetras_extraction/script/src/transform.py
+21
-0
21 additions, 0 deletions
tetras_extraction/script/src/transform.py
tetras_extraction/script/templates/activite.rq
+2
-3
2 additions, 3 deletions
tetras_extraction/script/templates/activite.rq
with
23 additions
and
3 deletions
tetras_extraction/script/src/transform.py
+
21
−
0
View file @
efbfe7a6
...
...
@@ -41,6 +41,16 @@ def prepareHTMLforMD(str):
# Identify image content and add markups to identify them in the MD
regexIMG
=
re
.
compile
(
r
"
<img.*?src=\"\.\./media/(.*?)\".*?>
"
)
str
=
regexIMG
.
sub
(
r
"
@IMAGESTART\1@IMAGEEND
"
,
str
)
# Identify words supporting comments and add markups to identify them in the MD
regexANCHOR
=
re
.
compile
(
r
"
<a class=\"STY_lienComt\" href=\"javascript:CRS_afficherDetail\(
'
(.)
'
\)\" onclick=\"enrPosClic\(event,
'
.
'
\)\">(.*?)</a>
"
)
str
=
regexANCHOR
.
sub
(
r
"
@ANCHORSTART@\1@\2@ANCHOREND
"
,
str
)
# Identify anchor words with related comment id and add markups to identify them in the MD
regexANCHOR
=
re
.
compile
(
r
"
<a class=\"STY_lienComt\" href=\"javascript:CRS_afficherDetail\(
'
(.)
'
\)\" onclick=\"enrPosClic\(event,
'
.
'
\)\">(.*?)</a>
"
)
str
=
regexANCHOR
.
sub
(
r
"
@ANCHORSTART@\1@\2@ANCHOREND
"
,
str
)
# Identify comments ids and add markups to identify them in the MD
regexCOMMENTID
=
re
.
compile
(
r
"
<div id=\"divCmt(.)\" onclick=\"SPE_clicDansBulle\(event,
'
.
'
\)\">
"
)
#(.*)</div>", re.MULTILINE)
str
=
regexCOMMENTID
.
sub
(
r
"
@COMMENTIDSTART@\1@COMMENTIDEND
"
,
str
)
return
(
str
)
...
...
@@ -70,6 +80,17 @@ def postEditMD(str):
str
=
str
.
replace
(
imageElt
,
imgHtml
)
###################################################
###################################################
# Add html code to MD for comment anchors
###################################################
# First for the words supporting the comments
regexANCHOR
=
re
.
compile
(
r
"
@ANCHORSTART@(.)@(.*?)@ANCHOREND
"
)
str
=
regexANCHOR
.
sub
(
r
"
<span commentaireInfoId=
'
\1
'
>\2</span>
"
,
str
)
# For the comments themselves it is done in activite.rq
###################################################
# Add html for images and fix media paths
regexIMG
=
re
.
compile
(
r
"
!\[\]\(\.\./media/(.*?)\)
"
)
str
=
regexIMG
.
sub
(
r
"
<img src=
'
/macao-hugo/media/\1
'
>
"
,
str
)
...
...
This diff is collapsed.
Click to expand it.
tetras_extraction/script/templates/activite.rq
+
2
−
3
View file @
efbfe7a6
...
...
@@ -15,10 +15,9 @@ template mt:activite(?act) {
?desc
st
:
nl
()
'<div class="commentaireInfoGroup">'
st
:
nl
()
'<div class="commentaireInfoGroup"
hidden="True"
>'
st
:
nl
()
group
{
'<div class="commentaireInfo">'
st
:
nl
()
?info_comment
concat
(
replace
(
replace
(
?info_comment
,
'@COMMENTIDSTART@'
,
'<div class="commentaireInfo" id="'
),
'@COMMENTIDEND'
,
'">'
),
'</div>'
)
'</div>'
st
:
nl
()
}
'</div>'
st
:
nl
()
...
...
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