Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5-Boxiang
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hamza
erp5-Boxiang
Commits
9c79cde0
Commit
9c79cde0
authored
Jan 25, 2019
by
Xiaowu Zhang
Committed by
Sven Franck
Jan 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_corporate_identity: make sure header list has element before access
parent
c3304c6f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_downgradeHeaders.py
...skins/erp5_corporate_identity/WebPage_downgradeHeaders.py
+8
-6
No files found.
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_downgradeHeaders.py
View file @
9c79cde0
...
...
@@ -9,11 +9,13 @@ def pushDown(level):
return
''
.
join
([
"h"
,
str
(
level
),
">"
])
for
header
in
re
.
findall
(
"<h[1-6].*</h[1-6]>"
,
content
or
""
):
tag
=
re
.
findall
(
"<(h[1-6]>)"
,
header
)[
0
]
#h2>
key
=
tag
[
1
]
content
=
content
.
replace
(
header
,
header
.
replace
(
tag
,
pushDown
(
int
(
key
)
+
(
downgrade
or
1
)))
)
header_list
=
re
.
findall
(
"<(h[1-6]>)"
,
header
)
if
len
(
header_list
):
tag
=
header_list
[
0
]
#h2>
key
=
tag
[
1
]
content
=
content
.
replace
(
header
,
header
.
replace
(
tag
,
pushDown
(
int
(
key
)
+
(
downgrade
or
1
)))
)
return
content
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment