Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
howto-cards LEGACY VERSION
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
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
Model registry
Operate
Environments
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
R3
howto-cards LEGACY VERSION
Commits
7ef66171
Verified
Commit
7ef66171
authored
3 years ago
by
Laurent Heirendt
Browse files
Options
Downloads
Patches
Plain Diff
split generation of header into separate function
parent
3a830b7b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!354
[release] Regular merge of develop
,
!347
Move lab cards external
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.ci/generateIndex.py
+32
-29
32 additions, 29 deletions
.ci/generateIndex.py
with
32 additions
and
29 deletions
.ci/generateIndex.py
+
32
−
29
View file @
7ef66171
...
...
@@ -147,6 +147,35 @@ def remove_header(localroot, root, filename):
return
n
def
generate_header
(
folder
,
permalink
,
shortcut
,
order
):
header
=
"
---
\n
"
if
len
(
order
)
>
0
:
header
+=
"
order:
"
+
str
(
order
)
+
"
\n
"
header
+=
"
layout: page
\n
"
header
+=
"
permalink:
"
+
permalink
+
"
\n
"
header
+=
"
shortcut:
"
+
root_handbook
(
shortcut
)
+
"
\n
"
header
+=
"
redirect_from:
\n
"
header
+=
"
- /cards/
"
+
shortcut
+
"
\n
"
header
+=
"
- /
"
+
folder
+
"
/cards/
"
+
shortcut
+
"
\n
"
# special case of handbook
if
"
handbook-annexes
"
in
permalink
or
"
handbook-additional
"
in
permalink
:
header
+=
"
- /cards/
"
+
root_handbook
(
shortcut
)
+
"
\n
"
header
+=
"
- /
"
+
folder
+
"
/cards/
"
+
root_handbook
(
shortcut
)
+
"
\n
"
# after moving lab cards
if
"
lab-software
"
in
permalink
or
"
lab-equipment
"
in
permalink
or
"
lab-hsa
"
in
permalink
:
header
+=
"
- /cards/
"
+
root_lab
(
shortcut
)
+
"
\n
"
header
+=
"
- /
"
+
folder
+
"
/cards/
"
+
root_lab
(
shortcut
)
+
"
\n
"
# include the legacy section
if
len
(
legacy_from
)
>
0
:
for
item
in
legacy_from
:
header
+=
str
(
item
)
else
:
header
+=
"
---
"
return
header
# loop through the entire internal tree
localroot
=
os
.
getcwd
()
...
...
@@ -228,14 +257,8 @@ for folder in cardDirs:
# replace the / with a :
shortcut
=
re
.
sub
(
'
/
'
,
'
:
'
,
shortcut
)
# define the header for each card
header
=
"
---
\n
"
if
len
(
order
)
>
0
:
header
+=
"
order:
"
+
str
(
order
)
+
"
\n
"
# append the order of the card
# find the maximum of existing orders
# find the maximum of existing orders
if
folderFlag
:
if
len
(
orderArr
[
indexS
])
>
0
:
maxOrder
=
max
(
orderArr
[
indexS
])
...
...
@@ -250,28 +273,8 @@ for folder in cardDirs:
else
:
orderArr
[
indexS
]
=
[]
header
+=
"
layout: page
\n
"
header
+=
"
permalink:
"
+
permalink
+
"
\n
"
header
+=
"
shortcut:
"
+
root_handbook
(
shortcut
)
+
"
\n
"
header
+=
"
redirect_from:
\n
"
header
+=
"
- /cards/
"
+
shortcut
+
"
\n
"
header
+=
"
- /
"
+
folder
+
"
/cards/
"
+
shortcut
+
"
\n
"
# special case of handbook
if
"
handbook-annexes
"
in
permalink
or
"
handbook-additional
"
in
permalink
:
header
+=
"
- /cards/
"
+
root_handbook
(
shortcut
)
+
"
\n
"
header
+=
"
- /
"
+
folder
+
"
/cards/
"
+
root_handbook
(
shortcut
)
+
"
\n
"
# after moving lab cards
if
"
lab-software
"
in
permalink
or
"
lab-equipment
"
in
permalink
or
"
lab-hsa
"
in
permalink
:
header
+=
"
- /cards/
"
+
root_lab
(
shortcut
)
+
"
\n
"
header
+=
"
- /
"
+
folder
+
"
/cards/
"
+
root_lab
(
shortcut
)
+
"
\n
"
# include the legacy section
if
len
(
legacy_from
)
>
0
:
for
item
in
legacy_from
:
header
+=
str
(
item
)
else
:
header
+=
"
---
"
# generate the header for each card
header
=
generate_header
(
folder
,
permalink
,
shortcut
,
order
)
# add autogenerated links to whitelist
whiteList
+=
permalink
+
"
\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