summaryrefslogtreecommitdiff
path: root/_includes/git-wiki
diff options
context:
space:
mode:
authorYehonal <yehonal.azeroth@gmail.com>2020-01-12 19:26:36 +0100
committerYehonal <yehonal.azeroth@gmail.com>2020-01-12 19:26:36 +0100
commitee8613b3383f896aaf49fb693d20761c90bec0ec (patch)
treeced5c72dc4b61c68d2c5f8ec9f4b00c3367652de /_includes/git-wiki
parent33429ab077e1739bd616d637c3beed863c7d1cfc (diff)
parent865e801950d4062fcab0a9a2de0bce3b8b2e39e4 (diff)
downloadwiki-ee8613b3383f896aaf49fb693d20761c90bec0ec.tar.gz
wiki-ee8613b3383f896aaf49fb693d20761c90bec0ec.tar.bz2
wiki-ee8613b3383f896aaf49fb693d20761c90bec0ec.zip
Merge branch 'master' of https://github.com/Drassil/git-wiki-theme
Diffstat (limited to '_includes/git-wiki')
-rw-r--r--_includes/git-wiki/components/copyrights/copyrights.html4
-rw-r--r--_includes/git-wiki/components/logo/logo.html2
-rw-r--r--_includes/git-wiki/components/toc/toc-lib.html33
-rw-r--r--_includes/git-wiki/components/toc/toc.html5
-rw-r--r--_includes/git-wiki/defines/defines.html2
-rw-r--r--_includes/git-wiki/sections/head/scripts.html2
-rw-r--r--_includes/git-wiki/sections/header/header.html2
-rw-r--r--_includes/git-wiki/sections/tail/tail.html12
8 files changed, 42 insertions, 20 deletions
diff --git a/_includes/git-wiki/components/copyrights/copyrights.html b/_includes/git-wiki/components/copyrights/copyrights.html
index 8a2841e..dd15f9f 100644
--- a/_includes/git-wiki/components/copyrights/copyrights.html
+++ b/_includes/git-wiki/components/copyrights/copyrights.html
@@ -2,10 +2,10 @@
<div class="git-wiki-copyrights">
<p>This project is maintained by <a href="{{ site.github.owner_url }}">{{ site.github.owner_name }}</a></p>
{% endif %}
- <p><small>Hosted on GitHub Pages &mdash; Powered by <a href="https://github.com/Drassil/git-wiki">Git-Wiki v{{
+ <p><small>Hosted on GitHub Pages &mdash; Powered by <a href="https://github.com/Drassil/git-wiki-theme">Git-Wiki v{{
version }}</a> </p>
{% if site.github.is_project_page %}
<p class="view"><a href="{{ site.github.repository_url }}">View the Project on GitHub <small>{{ github_name }}</small></a></p>
</div>
-{% endif %} \ No newline at end of file
+{% endif %}
diff --git a/_includes/git-wiki/components/logo/logo.html b/_includes/git-wiki/components/logo/logo.html
index 375b06b..e7ad94a 100644
--- a/_includes/git-wiki/components/logo/logo.html
+++ b/_includes/git-wiki/components/logo/logo.html
@@ -1,5 +1,5 @@
<div class="git-wiki-main-logo">
- <a href="{{ '/' | relative_url }}"><img src="{{ site.logo_url }}">
+<a href="{{ '/' | relative_url }}"><img src="{{ site.logo_url | relative_url }}">
<h1>{{ site.title | default: site.github.repository_name | escape }}</h1>
</a>
<p>{{ site.description | default: site.github.project_tagline }}</p>
diff --git a/_includes/git-wiki/components/toc/toc-lib.html b/_includes/git-wiki/components/toc/toc-lib.html
index 4aa9c88..8851400 100644
--- a/_includes/git-wiki/components/toc/toc-lib.html
+++ b/_includes/git-wiki/components/toc/toc-lib.html
@@ -12,15 +12,17 @@
* html (string) - the HTML of compiled markdown generated by kramdown in Jekyll
Optional Parameters:
- * sanitize (bool) : false - when set to true, the headers will be stripped of any HTML in the TOC
- * class (string) : '' - a CSS class assigned to the TOC
- * id (string) : '' - an ID to assigned to the TOC
- * h_min (int) : 1 - the minimum TOC header level to use; any header lower than this value will be ignored
- * h_max (int) : 6 - the maximum TOC header level to use; any header greater than this value will be ignored
- * ordered (bool) : false - when set to true, an ordered list will be outputted instead of an unordered list
- * item_class (string) : '' - add custom class(es) for each list item; has support for '%level%' placeholder, which is the current heading level
- * baseurl (string) : '' - add a base url to the TOC links for when your TOC is on another page than the actual content
- * anchor_class (string) : '' - add custom class(es) for each anchor element
+ * title (string) : Contents: - title for the TOC
+ * minHeaders (int) : 1 - minimum number of headers required to show the TOC
+ * sanitize (bool) : false - when set to true, the headers will be stripped of any HTML in the TOC
+ * class (string) : '' - a CSS class assigned to the TOC
+ * id (string) : '' - an ID to assigned to the TOC
+ * h_min (int) : 1 - the minimum TOC header level to use; any header lower than this value will be ignored
+ * h_max (int) : 6 - the maximum TOC header level to use; any header greater than this value will be ignored
+ * ordered (bool) : false - when set to true, an ordered list will be outputted instead of an unordered list
+ * item_class (string) : '' - add custom class(es) for each list item; has support for '%level%' placeholder, which is the current heading level
+ * baseurl (string) : '' - add a base url to the TOC links for when your TOC is on another page than the actual content
+ * anchor_class (string) : '' - add custom class(es) for each anchor element
Output:
An ordered or unordered list representing the table of contents of a markdown block. This snippet will only
@@ -28,6 +30,8 @@
{% endcomment %}
{% capture my_toc %}{% endcapture %}
+ {% assign title = include.title | default: "Contents:" %}
+ {% assign minHeaders = include.minHeaders | default: 1 %}
{% assign orderedList = include.ordered | default: false %}
{% assign minHeader = include.h_min | default: 1 %}
{% assign maxHeader = include.h_max | default: 6 %}
@@ -36,6 +40,8 @@
{% capture listModifier %}{% if orderedList %}1.{% else %}-{% endif %}{% endcapture %}
+ {% assign hCount = 0 %}
+
{% for node in nodes %}
{% if node == "" %}
{% continue %}
@@ -79,6 +85,8 @@
{% capture listItemClass %}{:.{{ include.item_class | replace: '%level%', headerLevel }}}{% endcapture %}
{% endif %}
+ {% assign hCount = hCount | plus: 1 %}
+
{% capture heading_body %}{% if include.sanitize %}{{ header | strip_html }}{% else %}{{ header }}{% endif %}{% endcapture %}
{% capture my_toc %}{{ my_toc }}
{{ space }}{{ listModifier }} {{ listItemClass }} [{{ heading_body | replace: "|", "\|" }}]({% if include.baseurl %}{{ include.baseurl }}{% endif %}#{{ html_id }}){% if include.anchor_class %}{:.{{ include.anchor_class }}}{% endif %}{% endcapture %}
@@ -93,4 +101,9 @@
{% capture my_toc %}{: #{{ include.id }}}
{{ my_toc | lstrip }}{% endcapture %}
{% endif %}
-{% endcapture %}{% assign tocWorkspace = '' %}{{ my_toc | markdownify | strip }} \ No newline at end of file
+{% endcapture %}{% assign tocWorkspace = '' %}
+
+{% if hCount >= minHeaders %}
+ {{ title }}
+ {{ my_toc | markdownify | strip }}
+{% endif %} \ No newline at end of file
diff --git a/_includes/git-wiki/components/toc/toc.html b/_includes/git-wiki/components/toc/toc.html
index c354b42..7329f40 100644
--- a/_includes/git-wiki/components/toc/toc.html
+++ b/_includes/git-wiki/components/toc/toc.html
@@ -2,10 +2,7 @@
{% include {{ site.inc_before_toc }} %}
{% endif %}
-<div>
- <p>Contents:</p>
- {% include git-wiki/components/toc/toc-lib.html html=content sanitize=true class="inline_toc" id="git-wiki-toc" h_min=1 h_max=3 ordered=1 %}
-</div>
+{% include git-wiki/components/toc/toc-lib.html title="Contents:" minHeaders=1 html=content sanitize=true class="inline_toc" id="git-wiki-toc" h_min=1 h_max=3 ordered=1 %}
{% if site.inc_after_toc %}
{% include {{ site.inc_after_toc }} %}
diff --git a/_includes/git-wiki/defines/defines.html b/_includes/git-wiki/defines/defines.html
index a91df14..6400403 100644
--- a/_includes/git-wiki/defines/defines.html
+++ b/_includes/git-wiki/defines/defines.html
@@ -1,4 +1,4 @@
-{% assign version = "2.5.1" %}
+{% assign version = "2.5.3" %}
{% capture lchar %}{{page.url | slice: -1, 1}}{% endcapture %}
{% capture url %}
{% if lchar == "/" %}{{page.url}}index.html{% else %}{{ page.url | default: 'index.html' }}{% endif%}
diff --git a/_includes/git-wiki/sections/head/scripts.html b/_includes/git-wiki/sections/head/scripts.html
index 9cf23f3..9497626 100644
--- a/_includes/git-wiki/sections/head/scripts.html
+++ b/_includes/git-wiki/sections/head/scripts.html
@@ -4,7 +4,7 @@
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
-<script src="{{ '/assets/js/red-links.js' | relative_url }}"></script>
+<script src="{{ '/assets/js/checkLinks.js' | relative_url }}"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
diff --git a/_includes/git-wiki/sections/header/header.html b/_includes/git-wiki/sections/header/header.html
index 38ec85b..ffbea44 100644
--- a/_includes/git-wiki/sections/header/header.html
+++ b/_includes/git-wiki/sections/header/header.html
@@ -2,7 +2,7 @@
<button class="w3-button w3-teal" onclick="sidebar_toggle()">&#9776;</button>
<a href="{{ '/' | relative_url }}">
{% if site.logo_url %}
- <img src="{{ site.logo_url }}" width="20px">
+ <img src="{{ site.logo_url | relative_url }}" width="20px">
{% endif %}
{{ site.title | escape }}
</a>
diff --git a/_includes/git-wiki/sections/tail/tail.html b/_includes/git-wiki/sections/tail/tail.html
index 692867f..f5944c9 100644
--- a/_includes/git-wiki/sections/tail/tail.html
+++ b/_includes/git-wiki/sections/tail/tail.html
@@ -18,6 +18,18 @@
</script>
{% endif %}
+{% assign items = site.html_pages %}
+{% for page in items %}
+{% assign url = page.url | relative_url %}
+{% assign urls = urls | append: url | append: "," %}
+{% endfor %}
+
+<script type="text/javascript">
+ $(document).ready(function () {
+ $(document.body).checkLinks("{{ urls }}".split(","));
+ });
+</script>
+
{% if site.inc_after_tail %}
{% include {{ site.inc_after_tail }} %}
{% endif %}