Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
howto-cards
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Marie Fossepre
howto-cards
Commits
39b6f3ed
Verified
Commit
39b6f3ed
authored
3 years ago
by
Laurent Heirendt
Browse files
Options
Downloads
Patches
Plain Diff
introduce ignore list for headers
parent
11750294
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.ci/generateIndex.py
+19
-5
19 additions, 5 deletions
.ci/generateIndex.py
with
19 additions
and
5 deletions
.ci/generateIndex.py
+
19
−
5
View file @
39b6f3ed
...
...
@@ -49,7 +49,6 @@ def save_order(localroot, root, filename):
with
open
(
filename
,
'
r
'
)
as
f
:
for
line
in
f
:
# check for the start of the section
#print(line)
if
line
[
0
:
6
]
==
"
order:
"
:
order
=
line
[
7
:]
break
...
...
@@ -59,6 +58,19 @@ def save_order(localroot, root, filename):
return
order
.
rstrip
()
def
get_ignore
():
return
[
"
404.html
"
,
"
Gemfile
"
,
"
Gemfile.lock
"
,
"
README.md
"
,
"
_config.yml
"
,
"
_site
"
,
"
assets
"
,
"
help.md
"
,
"
index.md
"
,
"
pagination.md
"
]
def
save_legacy_from
(
localroot
,
root
,
filename
):
legacy_from
=
[]
os
.
chdir
(
root
)
...
...
@@ -124,6 +136,8 @@ def remove_header(localroot, root, filename):
# loop through the entire internal tree
localroot
=
os
.
getcwd
()
# retrieve ignore list
ignore
=
get_ignore
()
# generate the index properly speaking
cardDirs
=
[
"
internal
"
,
"
external
"
,
"
policies
"
]
...
...
@@ -136,7 +150,7 @@ for direct in cardDirs:
dirs
=
natsorted
(
dirs
)
for
d
in
dirs
:
if
d
[
0
]
!=
"
.
"
:
if
d
[
0
]
!=
"
.
"
and
d
not
in
ignore
:
sections
.
append
(
d
)
sections
=
list
(
set
(
sections
))
...
...
@@ -149,17 +163,18 @@ whiteList = ''
localIndexArr
=
[[]]
*
len
(
sections
)
orderArr
=
[[]]
*
len
(
sections
)
for
folder
in
cardDirs
:
# FolderFlag gets set to true at the first iteration
folderFlag
=
True
# check if folder exists
if
path
.
isdir
(
folder
):
if
path
.
isdir
(
folder
)
and
folder
not
in
ignore
:
dirs
=
os
.
listdir
(
folder
)
dirs
=
natsorted
(
dirs
)
for
d
in
dirs
:
if
d
[
0
]
!=
"
.
"
:
if
d
[
0
]
!=
"
.
"
and
d
not
in
ignore
:
# set the header of the section
#index += "\n### " + d.replace("-", " ").capitalize() + "\n"
...
...
@@ -167,7 +182,6 @@ for folder in cardDirs:
indexS
=
sections
.
index
(
d
)
maxOrder
=
0
#print(indexS)
if
len
(
localIndexArr
[
indexS
])
==
0
:
localIndexArr
[
indexS
]
=
[
"
\n
"
]
...
...
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