diff options
Diffstat (limited to '_includes/git-wiki/components')
| -rw-r--r-- | _includes/git-wiki/components/copyrights/copyrights.html | 4 | ||||
| -rw-r--r-- | _includes/git-wiki/components/logo/logo.html | 2 | ||||
| -rw-r--r-- | _includes/git-wiki/components/toc/toc-lib.html | 33 | ||||
| -rw-r--r-- | _includes/git-wiki/components/toc/toc.html | 5 |
4 files changed, 27 insertions, 17 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 — Powered by <a href="https://github.com/Drassil/git-wiki">Git-Wiki v{{ + <p><small>Hosted on GitHub Pages — 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 }} %} |
