Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MKDocs Template
Manage
Activity
Members
Labels
Plan
Issues
3
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Harbor Registry
Model registry
Analyze
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
PAGoDA
Tools
MKDocs Template
Commits
53797d4d
Verified
Commit
53797d4d
authored
4 years ago
by
Romain Deville
Browse files
Options
Downloads
Patches
Plain Diff
Better handling of subrepo in plugins.py
Improve handling of internal subrepo in plugins.py.
parent
5a1bfc05
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
templates/docs/_data/plugins.py
+28
-14
28 additions, 14 deletions
templates/docs/_data/plugins.py
with
28 additions
and
14 deletions
templates/docs/_data/plugins.py
+
28
−
14
View file @
53797d4d
...
@@ -100,6 +100,7 @@ def add_internal_to_nav(
...
@@ -100,6 +100,7 @@ def add_internal_to_nav(
"""
"""
if
nav_parent
:
if
nav_parent
:
for
i_nav
in
nav
:
for
i_nav
in
nav
:
# "nav_entry" is a key of current parsed `nav`
if
nav_parent
[
0
]
in
i_nav
:
if
nav_parent
[
0
]
in
i_nav
:
for
i_key
in
i_nav
:
for
i_key
in
i_nav
:
add_internal_to_nav
(
add_internal_to_nav
(
...
@@ -109,6 +110,16 @@ def add_internal_to_nav(
...
@@ -109,6 +110,16 @@ def add_internal_to_nav(
repo_parent
,
repo_parent
,
nav_parent
[
1
:],
nav_parent
[
1
:],
)
)
# "nav_entry" is a subkey of current parsed `nav`
elif
nav_parent
[
0
]
in
yaml
.
dump
(
i_nav
):
for
i_key
in
i_nav
:
add_internal_to_nav
(
env
,
i_nav
[
i_key
],
repo_dict
,
repo_parent
,
nav_parent
[
0
:],
)
else
:
else
:
mkdocs_path
=
env
.
project_dir
mkdocs_path
=
env
.
project_dir
for
i_parent
in
repo_parent
:
for
i_parent
in
repo_parent
:
...
@@ -153,10 +164,14 @@ def add_external_to_nav(
...
@@ -153,10 +164,14 @@ def add_external_to_nav(
repo_parent
,
repo_parent
,
nav_parent
[
1
:],
nav_parent
[
1
:],
)
)
elif
repo_dict
[
"
online_url
"
].
startswith
(
'
/
'
):
elif
repo_dict
[
"
online_url
"
].
startswith
(
"
/
"
):
nav
.
append
({
nav
.
append
(
repo_dict
[
"
nav_entry
"
]:
repo_dict
[
"
online_url
"
].
replace
(
'
/
'
,
'
../
'
,
1
)
{
})
repo_dict
[
"
nav_entry
"
]:
repo_dict
[
"
online_url
"
].
replace
(
"
/
"
,
"
../
"
,
1
)
}
)
else
:
else
:
nav
.
append
({
repo_dict
[
"
nav_entry
"
]:
repo_dict
[
"
online_url
"
]})
nav
.
append
({
repo_dict
[
"
nav_entry
"
]:
repo_dict
[
"
online_url
"
]})
...
@@ -229,13 +244,15 @@ def update_nav(
...
@@ -229,13 +244,15 @@ def update_nav(
nav_parent
.
append
(
repo_dict
[
"
nav_entry
"
])
nav_parent
.
append
(
repo_dict
[
"
nav_entry
"
])
elif
i_key
==
"
internal
"
:
elif
i_key
==
"
internal
"
:
for
i_repo
in
repo_dict
[
"
internal
"
]:
for
i_repo
in
repo_dict
[
"
internal
"
]:
add_nav_entry
(
env
.
conf
[
"
nav
"
],
nav_parent
)
if
nav_parent
[
0
]
not
in
yaml
.
dump
(
env
.
conf
[
"
nav
"
]):
add_nav_entry
(
env
.
conf
[
"
nav
"
],
nav_parent
)
add_internal_to_nav
(
add_internal_to_nav
(
env
,
env
.
conf
[
"
nav
"
],
i_repo
,
repo_parent
,
nav_parent
env
,
env
.
conf
[
"
nav
"
],
i_repo
,
repo_parent
,
nav_parent
)
)
elif
i_key
==
"
external
"
:
elif
i_key
==
"
external
"
:
for
i_repo
in
repo_dict
[
"
external
"
]:
for
i_repo
in
repo_dict
[
"
external
"
]:
add_nav_entry
(
env
.
conf
[
"
nav
"
],
nav_parent
)
if
nav_parent
[
0
]
not
in
yaml
.
dump
(
env
.
conf
[
"
nav
"
]):
add_nav_entry
(
env
.
conf
[
"
nav
"
],
nav_parent
)
add_external_to_nav
(
add_external_to_nav
(
env
,
env
.
conf
[
"
nav
"
],
i_repo
,
repo_parent
,
nav_parent
env
,
env
.
conf
[
"
nav
"
],
i_repo
,
repo_parent
,
nav_parent
)
)
...
@@ -406,9 +423,7 @@ def set_copyright(env: dict, git_repo: git.Repo) -> None:
...
@@ -406,9 +423,7 @@ def set_copyright(env: dict, git_repo: git.Repo) -> None:
curr_year
=
time
.
strftime
(
"
%Y
"
,
time
.
localtime
())
curr_year
=
time
.
strftime
(
"
%Y
"
,
time
.
localtime
())
if
first_year
==
curr_year
:
if
first_year
==
curr_year
:
env
.
variables
[
env
.
variables
[
"
date_copyright
"
]
=
f
"
Copyright ©
{
curr_year
}
"
"
date_copyright
"
]
=
f
"
Copyright ©
{
curr_year
}
"
else
:
else
:
env
.
variables
[
env
.
variables
[
"
date_copyright
"
"
date_copyright
"
...
@@ -419,7 +434,6 @@ def set_copyright(env: dict, git_repo: git.Repo) -> None:
...
@@ -419,7 +434,6 @@ def set_copyright(env: dict, git_repo: git.Repo) -> None:
]
=
f
"
{
env
.
variables
[
'
date_copyright
'
]
}
{
env
.
variables
[
'
copyright
'
]
}
"
]
=
f
"
{
env
.
variables
[
'
date_copyright
'
]
}
{
env
.
variables
[
'
copyright
'
]
}
"
def
set_repo_name
(
env
:
dict
,
repo_slug
:
str
)
->
None
:
def
set_repo_name
(
env
:
dict
,
repo_slug
:
str
)
->
None
:
"""
Update content of the `repo_name` key in `env.conf`.
"""
Update content of the `repo_name` key in `env.conf`.
...
@@ -561,7 +575,7 @@ def set_config(env: dict) -> None:
...
@@ -561,7 +575,7 @@ def set_config(env: dict) -> None:
if
"
subrepo
"
in
env
.
variables
:
if
"
subrepo
"
in
env
.
variables
:
if
(
if
(
env
.
variables
[
"
internal_subdoc
"
]
not
env
.
variables
[
"
internal_subdoc
"
]
and
"
monorepo
"
in
env
.
conf
[
"
plugins
"
]
and
"
monorepo
"
in
env
.
conf
[
"
plugins
"
]
):
):
env
.
conf
[
"
plugins
"
].
pop
(
"
monorepo
"
)
env
.
conf
[
"
plugins
"
].
pop
(
"
monorepo
"
)
...
@@ -682,7 +696,7 @@ def update_subrepo_info(
...
@@ -682,7 +696,7 @@ def update_subrepo_info(
f
"
{
INFO_CLR
}
INFO [macros] - Pulling repo
{
i_repo
[
'
name
'
]
}{
RESET_CLR
}
"
f
"
{
INFO_CLR
}
INFO [macros] - Pulling repo
{
i_repo
[
'
name
'
]
}{
RESET_CLR
}
"
)
)
git_subrepo
=
git
.
Repo
(
subrepo_root
)
git_subrepo
=
git
.
Repo
(
subrepo_root
)
git_subrepo
.
remotes
.
origin
.
pull
()
git_subrepo
.
remotes
.
origin
.
pull
(
'
master
'
)
else
:
else
:
print
(
print
(
f
"
{
INFO_CLR
}
INFO [macros] - Cloning repo
{
i_repo
[
'
name
'
]
}{
RESET_CLR
}
"
f
"
{
INFO_CLR
}
INFO [macros] - Cloning repo
{
i_repo
[
'
name
'
]
}{
RESET_CLR
}
"
...
@@ -834,8 +848,8 @@ def update_version(env: dict) -> None:
...
@@ -834,8 +848,8 @@ def update_version(env: dict) -> None:
minor
=
int
(
i_tag
[
1
])
minor
=
int
(
i_tag
[
1
])
patch
=
str
()
patch
=
str
()
for
i_remain_tag
in
i_tag
[
2
:]:
for
i_remain_tag
in
i_tag
[
2
:]:
if
i_remain_tag
and
i_remain_tag
not
in
(
""
,
"
\n
"
):
if
i_remain_tag
and
i_remain_tag
not
in
(
""
,
"
\n
"
):
i_remain_tag
=
i_remain_tag
.
replace
(
"
\n
"
,
""
)
i_remain_tag
=
i_remain_tag
.
replace
(
"
\n
"
,
""
)
if
not
patch
:
if
not
patch
:
patch
=
f
"
{
i_remain_tag
}
"
patch
=
f
"
{
i_remain_tag
}
"
else
:
else
:
...
...
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