Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Fachgruppenwebseite Metadaten
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
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
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
fginfo
Fachgruppenwebseite Metadaten
Commits
8c33aafa
Verified
Commit
8c33aafa
authored
2 years ago
by
Jake
Browse files
Options
Downloads
Patches
Plain Diff
return category info if url is slug in parse_url
parent
9d1e72e2
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
theme/templates/macros/link.html
+12
-8
12 additions, 8 deletions
theme/templates/macros/link.html
with
12 additions
and
8 deletions
theme/templates/macros/link.html
+
12
−
8
View file @
8c33aafa
...
...
@@ -2,7 +2,7 @@
{%- import 'macros/getters.html' as get with context -%}
{%- macro render(url, content, lang, attr = None, title = None) -%}
{%- call(parsedurl, anchor, reflang, is_external, reftype, refid, refpage, tagtitle, tagcolor) parse_url(url, lang) -%}
{%- call(parsedurl, anchor, reflang, is_external, reftype, refid, refpage, tag
cat
title, tagc
atc
olor) parse_url(url, lang) -%}
{%- set ns = namespace(extraclass=None, fullurl=parsedurl) -%}
{%- if anchor -%}
{%- set ns.fullurl = [parsedurl, anchor]|join('#') -%}
...
...
@@ -13,12 +13,12 @@
{%- set ns.extraclass = "internal" -%}
{%- endif -%}
<a
{{
content_renderer.render_attr
(
attr
,
lang
,
extra_classes=
[ns.extraclass],
extra=
{"href":
ns.fullurl
,
"
title
"
:
{"
value
"
:title
,
"
escape
"
:
true
}})
}}
>
{%- if content is string -%}
{%- if content|length -%}
{%- if content is string
or content is none
-%}
{%- if
content is string and
content|length -%}
{{ content|e }}
{%- else -%}
{%- if
tagtitle
-%}
{{ tagtitle|e }}
{%- if
reftype == "tag"
-%}
{{ tag
cat
title|e }}
{%- else -%}
{{ refpage.title|e }}
{%- endif -%}
...
...
@@ -31,7 +31,7 @@
{%- endmacro -%}
{#- returns: (url, anchor, reflang, is_external, reftype, refid, refpage, tagtitle, tagcolor)-#}
{#- returns: (url, anchor, reflang, is_external, reftype, refid, refpage, tag
cat
title, tagc
atc
olor)-#}
{%- macro parse_url(rawurl, lang) -%}
{%- set urlsplit = rawurl.split('#') -%}
{%- set anchor = urlsplit[1]|d(None) -%}
...
...
@@ -47,13 +47,17 @@
{%- set reftype = components[0] -%}
{%- set refid = components[1] -%}
{%- set reflang = components[2]|d(lang) -%}
{%- set ns = namespace(url=None, page=None, tagtitle=None, tagcolor=None, tagpage=None) -%}
{%- set ns = namespace(url=None, page=None, tagtitle=None, tagcolor=None, tagpage=None
, catcolor=None, cattitle=None
) -%}
{%- if reftype == "slug" -%}
{%- call(page) get.page_by_slug(refid, reflang) -%}
{%- set ns.url = [siteurl, page.url]|join('/') -%}
{%- set ns.page = page -%}
{%- call(cattitle, catcolor, caturl, catpage, catpages) get.tag_by_name(page.category, reflang) -%}
{%- set ns.cattitle = cattitle -%}
{%- set ns.catcolor = catcolor -%}
{%- endcall -%}
{%- endcall -%}
{{- caller(ns.url, anchor, reflang, False, reftype, refid, ns.page,
None, None
) -}}
{{- caller(ns.url, anchor, reflang, False, reftype, refid, ns.page,
ns.cattitle, ns.catcolor
) -}}
{%- elif reftype == "tag" -%}
{%- call(tagtitle, tagcolor, tagurl, tagpage, tagpages) get.tag_by_name(refid, reflang) -%}
{%- set ns.url = [siteurl, tagurl]|join('/') -%}
...
...
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