Commit d416dae5 authored by Markus Willman's avatar Markus Willman

handle multiple file references in supported tags (source view)

parent 5969e9f7
......@@ -217,6 +217,15 @@ body.bs-dark .header .logo-s50 {
background-color: #f8f8f8;
}
.source-container a {
color: #007bff !important;
}
.source-container a:hover {
color: #0056b3 !important;
text-decoration: underline !important;
}
.source-container code {
overflow: visible;
white-space: pre;
......
......@@ -37,12 +37,14 @@
<script>
hljs.initHighlightingOnLoad();
var sourceRefs = function(i, e) {
e = $(e).parent();
e.replaceWith(e.html().replace(
/\'([\w\/\.]+)\'((?:.*?)\%\})/gm,
"'<a class=\"src-ref\" href=\"{{base_url}}/$1?source=view\" rel=\"nofollow\">$1</a>'$2"
));
var sourceRefs = function(idx, element, passes = 1) {
element = $(element).parent();
for (var i = 0; i < passes; ++i) {
element.replaceWith(element.html().replace(
/\'([\w\/\.]+)\'((?:.*?)\%\})/gm,
"'<a class=\"src-ref\" href=\"{{base_url}}/$1?source=view\" rel=\"nofollow\">$1</a>'$2"
));
}
}
$(function () {
......@@ -55,10 +57,10 @@
});
{% if source_lang == 'twig' -%}
$('.hljs-template-tag > .hljs-name:contains(markdown)').each(sourceRefs);
$('.hljs-template-tag > .hljs-name:contains(include)').each(sourceRefs);
$('.hljs-template-tag > .hljs-name:contains(import)').each(sourceRefs);
$('.hljs-template-tag > .hljs-name:contains(extends)').each(sourceRefs);
$('.hljs-template-tag > .hljs-name:contains(markdown)').each(function (i, e) { sourceRefs(i, e, 2); });
$('.hljs-template-tag > .hljs-name:contains(include)').each(function (i, e) { sourceRefs(i, e); });
$('.hljs-template-tag > .hljs-name:contains(import)').each(function (i, e) { sourceRefs(i, e); });
$('.hljs-template-tag > .hljs-name:contains(extends)').each(function (i, e) { sourceRefs(i, e); });
{%- endif %}
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment