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
Annegrät Daujeumont
howto-cards
Commits
f2a7e65b
Verified
Commit
f2a7e65b
authored
2 years ago
by
Laurent Heirendt
Browse files
Options
Downloads
Patches
Plain Diff
rewrite f
parent
c294d541
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
+13
-12
13 additions, 12 deletions
.ci/generateIndex.py
with
13 additions
and
12 deletions
.ci/generateIndex.py
+
13
−
12
View file @
f2a7e65b
...
...
@@ -9,6 +9,16 @@ def line_prepender(filename, line):
f
.
seek
(
0
,
0
)
f
.
write
(
line
.
rstrip
(
'
\r\n
'
)
+
'
\n
'
+
content
)
def
get_subdirs
(
p
):
for
fname
in
os
.
listdir
(
p
):
if
os
.
path
.
isdir
(
os
.
path
.
join
(
p
,
fname
)):
yield
os
.
path
.
join
(
p
,
fname
)
def
has_subdirs
(
p
):
folders
=
list
(
get_subdirs
(
p
))
return
len
(
folders
)
!=
0
def
build_link
(
title
,
href
):
# strip the number of the title
...
...
@@ -155,15 +165,6 @@ def remove_header(localroot, root, filename):
return
n
def
folders_in
(
path_to_parent
):
for
fname
in
os
.
listdir
(
path_to_parent
):
if
os
.
path
.
isdir
(
os
.
path
.
join
(
path_to_parent
,
fname
)):
yield
os
.
path
.
join
(
path_to_parent
,
fname
)
def
has_folders
(
path_to_parent
):
folders
=
list
(
folders_in
(
path_to_parent
))
return
len
(
folders
)
!=
0
def
element_header
(
prefix
,
permalink
,
element
):
# handbook section
...
...
@@ -241,12 +242,12 @@ sections = []
# determine first the directories
for
direct
in
cardDirs
:
if
path
.
isdir
(
direct
)
and
has_
folde
rs
(
direct
):
if
path
.
isdir
(
direct
)
and
has_
subdi
rs
(
direct
):
dirs
=
os
.
listdir
(
direct
)
dirs
=
natsorted
(
dirs
)
for
d
in
dirs
:
if
d
[
0
]
!=
"
.
"
and
d
not
in
ignore
and
has_
folde
rs
(
direct
+
"
/
"
+
d
):
if
d
[
0
]
!=
"
.
"
and
d
not
in
ignore
and
has_
subdi
rs
(
direct
+
"
/
"
+
d
):
sections
.
append
(
d
)
sections
=
list
(
set
(
sections
))
...
...
@@ -270,7 +271,7 @@ for folder in cardDirs:
dirs
=
natsorted
(
dirs
)
for
d
in
dirs
:
if
d
[
0
]
!=
"
.
"
and
d
not
in
ignore
and
has_
folde
rs
(
folder
+
"
/
"
+
d
):
if
d
[
0
]
!=
"
.
"
and
d
not
in
ignore
and
has_
subdi
rs
(
folder
+
"
/
"
+
d
):
# set the header of the section
#index += "\n### " + d.replace("-", " ").capitalize() + "\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