Skip to content
Snippets Groups Projects
Verified Commit 0bb3ffab authored by Jake's avatar Jake
Browse files

support softbreaks in some links

parent b4fcbb62
No related branches found
No related tags found
No related merge requests found
Pipeline #313503 passed
{%- import 'macros/content_renderer.html' as content_renderer with context -%}
{%- import 'macros/getters.html' as get with context -%}
{%- macro render_link_span(content) -%}
{%- set contentsplit = content.split('­')-%}
<span>
{%- for s in contentsplit -%}
{%- if not loop.first -%}
&shy;
{%- endif -%}
{{ s|e }}
{%- endfor -%}
</span>
{%- endmacro -%}
{%- macro render(url, content, lang, attr = None, title = None) -%}
{%- call(parsedurl, anchor, reflang, is_external, reftype, refid, refpage, tagcattitle, tagcatcolor) parse_url(url, lang) -%}
{%- set ns = namespace(relation=None, fullurl=parsedurl) -%}
......@@ -16,12 +29,12 @@
<a {{ content_renderer.render_attr(attr, lang, extra_classes=[ns.relation], extra={"href": ns.fullurl, "title": {"value":title, "escape": true}, "target": target}) }}>
{%- if content is string or content is none -%}
{%- if content is string and content|length -%}
<span>{{ content|e }}</span>
{{ render_link_span(content) }}
{%- else -%}
{%- if reftype == "tag" -%}
<span>{{ tagcattitle|e }}</span>
{{ render_link_span(tagcattitle) }}
{%- elif reftype == "slug" -%}
<span>{{ refpage.title|e }}</span>
{{ render_link_span(refpage.title) }}
{%- endif -%}
{%- endif -%}
{%- else -%}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment