-
Notifications
You must be signed in to change notification settings - Fork 1
/
moduleLink.html
30 lines (30 loc) · 1.78 KB
/
moduleLink.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{%- if include.moduleId and include.path and include.title -%}
{%- if current_module_version == nil -%}
{%- include common/assignCurrentModule.html -%}
{%- endif -%}
{%- if current_module_version -%}
{%- assign module = site.data.modules[include.moduleId] -%}
{%- if module -%}
{%- if module.versions -%}
{%- assign default_version = module.versions | where_exp: "version", "version.default" | first -%}
{%- unless default_version -%}
{%- assign default_version = module.versions | first -%}
{%- endunless -%}
{%- assign traversed = "" | split: "," -%}
{%- capture depending_version_path -%}{%- include common/getDependencyVersionPath.html current_module_version=current_module_version target=module targetModuleId=include.moduleId traversed=traversed -%}{%- endcapture -%}
{%- if depending_version_path == "" -%}
{%- assign depending_version_path = default_version.path -%}
{%- endif -%}
<a href="{{site.url}}/{{module.basepath}}/{{depending_version_path}}/{{include.path}}">{{include.title}}</a>
{%- else -%}
<a href="{{site.url}}/{{module.basepath}}/{{include.path}}">{{include.title}}</a>
{%- endif -%}
{%- else -%}
<span class="badge bg-danger" title="Tuntematon moduli '{{include.moduleId}}'">[Linkitysvirhe]</span>
{%- endif -%}
{%- else -%}
<span class="badge bg-danger" title="Linkkiä ei voi muodostaa, lähdemodulin versio ei tiedossa">[Linkitysvirhe]</span>
{%- endif -%}
{%- else -%}
<span class="badge bg-danger" title="Joko moduleId, path tai title puuttuvat">[Linkitysvirhe]</span>
{%- endif -%}