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
93910af0
Verified
Commit
93910af0
authored
3 years ago
by
Laurent Heirendt
Browse files
Options
Downloads
Patches
Plain Diff
add title and description support
parent
f73b4926
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
-8
19 additions, 8 deletions
.ci/generateIndex.py
with
19 additions
and
8 deletions
.ci/generateIndex.py
+
19
−
8
View file @
93910af0
...
...
@@ -56,21 +56,23 @@ def build_section_start(title, shortcut):
def
build_section_end
():
return
"
\t\t
</ul>
\n\t
</div>
"
def
save_
order
(
localroot
,
root
,
filename
):
order
=
""
def
save_
tag
(
localroot
,
root
,
filename
,
tag
):
return_tag
=
""
os
.
chdir
(
root
)
length_tag
=
len
(
tag
)
with
open
(
filename
,
'
r
'
)
as
f
:
for
line
in
f
:
# check for the start of the section
if
line
[
0
:
6
]
==
"
order
:
"
:
order
=
line
[
7
:]
if
line
[
0
:
length_tag
+
1
]
==
tag
+
"
:
"
:
return_tag
=
line
[
length_tag
+
2
:]
break
# change back to the local root
os
.
chdir
(
localroot
)
return
order
.
rstrip
()
return
return_tag
.
rstrip
()
def
get_ignore
():
return
[
"
404.html
"
,
...
...
@@ -147,7 +149,7 @@ def remove_header(localroot, root, filename):
return
n
def
generate_header
(
folder
,
permalink
,
shortcut
,
order
,
legacy_from
):
def
generate_header
(
folder
,
permalink
,
shortcut
,
order
,
legacy_from
,
title
,
description
):
header
=
"
---
\n
"
if
len
(
order
)
>
0
:
...
...
@@ -167,6 +169,13 @@ def generate_header(folder, permalink, shortcut, order, legacy_from):
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
"
# add the title and description
if
len
(
title
)
>
0
:
header
+=
"
title:
"
+
title
+
"
\n
"
if
len
(
description
)
>
0
:
header
+=
"
description:
"
+
description
+
"
\n
"
# include the legacy section
if
len
(
legacy_from
)
>
0
:
for
item
in
legacy_from
:
...
...
@@ -254,8 +263,10 @@ for folder in cardDirs:
print
(
"
> Generating header for:
"
+
fileName
)
# save order and legacy section
order
=
save_
order
(
localroot
,
root
,
file
)
order
=
save_
tag
(
localroot
,
root
,
file
,
"
order
"
)
legacy_from
=
save_legacy_from
(
localroot
,
root
,
file
)
title
=
save_tag
(
localroot
,
root
,
file
,
"
title
"
)
description
=
save_tag
(
localroot
,
root
,
file
,
"
description
"
)
# remove the previous header
n
=
remove_header
(
localroot
,
root
,
file
)
...
...
@@ -289,7 +300,7 @@ for folder in cardDirs:
orderArr
[
indexS
]
=
[]
# generate the header for each card
header
=
generate_header
(
folder
,
permalink
,
shortcut
,
order
,
legacy_from
)
header
=
generate_header
(
folder
,
permalink
,
shortcut
,
order
,
legacy_from
,
title
,
description
)
# add autogenerated links to whitelist
whiteList
+=
generate_whitelist_entry
(
folder
,
permalink
,
shortcut
)
...
...
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