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
a125c9a0
Verified
Commit
a125c9a0
authored
3 years ago
by
Laurent Heirendt
Browse files
Options
Downloads
Patches
Plain Diff
exceptions for subfolders of handbook
parent
886a10cc
No related branches found
No related tags found
2 merge requests
!314
[release] Regular merge of develop
,
!313
fix script for handbook links
Pipeline
#48019
passed
3 years ago
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.ci/generateIndex.py
+27
-2
27 additions, 2 deletions
.ci/generateIndex.py
with
27 additions
and
2 deletions
.ci/generateIndex.py
+
27
−
2
View file @
a125c9a0
...
...
@@ -20,6 +20,15 @@ def build_link(title, href):
return
f
'
\t\t\t
<li><a href=
"
{
href
}
"
>
{
title
}
</a></li>
\n
'
def
root_handbook
(
href
):
# remove sym link reference in href
if
(
'
handbook-additional
'
in
href
):
href
=
href
.
replace
(
'
handbook-additional
'
,
'
handbook
'
).
strip
()
elif
(
'
handbook-annexes
'
in
href
):
href
=
href
.
replace
(
'
handbook-annexes
'
,
'
handbook
'
).
strip
()
return
href
def
build_section_start
(
title
,
shortcut
):
title
=
title
.
replace
(
"
Gdpr
"
,
"
GDPR
"
)
...
...
@@ -129,6 +138,9 @@ for folder in cardDirs:
print
(
"
> Generating header for:
"
+
fileName
)
# remove the previous header
#if "handbook" in fileName:
# remove_header(localroot, root, file, 10)
#else:
remove_header
(
localroot
,
root
,
file
,
8
)
# generate a permalink
...
...
@@ -147,10 +159,16 @@ for folder in cardDirs:
header
=
"
---
\n
"
header
+=
"
layout: page
\n
"
header
+=
"
permalink:
"
+
permalink
+
"
\n
"
header
+=
"
shortcut:
"
+
shortcut
+
"
\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
"
header
+=
"
---
"
# add autogenerated links to whitelist
...
...
@@ -158,6 +176,9 @@ for folder in cardDirs:
whiteList
+=
"
/?
"
+
shortcut
+
"
\n
"
whiteList
+=
"
/cards/
"
+
shortcut
+
"
\n
"
whiteList
+=
"
/
"
+
folder
+
"
/cards/
"
+
shortcut
+
"
\n
"
if
"
handbook-annexes
"
in
permalink
or
"
handbook-additional
"
in
permalink
:
whiteList
+=
"
- /cards/
"
+
root_handbook
(
shortcut
)
+
"
\n
"
whiteList
+=
"
- /
"
+
folder
+
"
/cards/
"
+
root_handbook
(
shortcut
)
+
"
\n
"
# add the header properly speaking
line_prepender
(
fileName
,
header
)
...
...
@@ -165,7 +186,11 @@ for folder in cardDirs:
# open file and get the title after the header
count
=
0
title
=
""
bp
=
9
if
"
handbook-annexes
"
in
permalink
or
"
handbook-additional
"
in
permalink
:
bp
=
11
else
:
bp
=
9
with
open
(
fileName
,
'
r
'
)
as
f
:
for
line
in
f
:
count
+=
1
...
...
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