Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
Scripts
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
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
Specification Tools
Scripts
Commits
6264950d
Commit
6264950d
authored
1 year ago
by
Miguel Angel Reina Ortega
Browse files
Options
Downloads
Patches
Plain Diff
Adding checking if document-list is found in index files
parent
bec9268b
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
updateIndex.py
+8
-4
8 additions, 4 deletions
updateIndex.py
with
8 additions
and
4 deletions
updateIndex.py
+
8
−
4
View file @
6264950d
...
@@ -29,11 +29,15 @@ def upgradeIndex(args: argparse.Namespace) -> None:
...
@@ -29,11 +29,15 @@ def upgradeIndex(args: argparse.Namespace) -> None:
dest_soup
=
BeautifulSoup
(
dest_html
,
'
html.parser
'
)
dest_soup
=
BeautifulSoup
(
dest_html
,
'
html.parser
'
)
# Find the <ul> element in both the source and destination HTML
# Find the <ul> element in both the source and destination HTML
source_ul
=
source_soup
.
find
(
'
ul
'
)
source_ul
=
source_soup
.
find
(
'
ul
'
,
id
=
'
document-list
'
)
dest_ul
=
dest_soup
.
find
(
'
ul
'
)
dest_ul
=
dest_soup
.
find
(
'
ul
'
,
id
=
'
document-list
'
)
# Copy the contents of the source <ul> to the destination <ul>
# Copy the contents of the source <ul> to the destination <ul>
if
dest_ul
and
source_ul
:
dest_ul
.
extend
(
source_ul
.
contents
)
dest_ul
.
extend
(
source_ul
.
contents
)
else
:
print
(
"
ERROR: List not found in source and destination index files...
"
)
exit
(
1
)
# Save the updated destination HTML
# Save the updated destination HTML
with
open
(
'
public/index.html
'
,
'
w
'
,
encoding
=
'
utf-8
'
)
as
dest_updated_file
:
with
open
(
'
public/index.html
'
,
'
w
'
,
encoding
=
'
utf-8
'
)
as
dest_updated_file
:
...
...
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