diff options
| author | Yehonal <yehonal.azeroth@gmail.com> | 2020-01-12 12:35:16 +0100 |
|---|---|---|
| committer | Yehonal <yehonal.azeroth@gmail.com> | 2020-01-12 12:35:16 +0100 |
| commit | b52d6e28f0fdb22d8e0ba2e806527612ca11927d (patch) | |
| tree | fa1fbf1b62d637d90d9941dcd0b863bd5fd5ad90 /_includes | |
| parent | fe71b57bcdf51fec4fc275d968b4377ca42b8528 (diff) | |
| parent | 294bdf6c46c22e2b0ce470de8fdf41fe9bed90ea (diff) | |
| download | wiki-b52d6e28f0fdb22d8e0ba2e806527612ca11927d.tar.gz wiki-b52d6e28f0fdb22d8e0ba2e806527612ca11927d.tar.bz2 wiki-b52d6e28f0fdb22d8e0ba2e806527612ca11927d.zip | |
Merge branch 'master' of https://github.com/Drassil/git-wiki-theme
Diffstat (limited to '_includes')
| -rw-r--r-- | _includes/git-wiki/components/action_btn/page_actions.html | 24 | ||||
| -rw-r--r-- | _includes/git-wiki/components/lists/page-list.html | 2 | ||||
| -rw-r--r-- | _includes/git-wiki/components/lists/post-list.html | 2 | ||||
| -rw-r--r-- | _includes/git-wiki/components/logo/logo.html | 2 | ||||
| -rw-r--r-- | _includes/git-wiki/components/search/se_js.html | 2 | ||||
| -rw-r--r-- | _includes/git-wiki/components/toc/toc-lib.html | 96 | ||||
| -rw-r--r-- | _includes/git-wiki/components/toc/toc.html | 12 | ||||
| -rw-r--r-- | _includes/git-wiki/defines/defines.html | 2 | ||||
| -rw-r--r-- | _includes/git-wiki/sections/content/content.html | 10 | ||||
| -rw-r--r-- | _includes/git-wiki/sections/head/scripts.html | 1 | ||||
| -rw-r--r-- | _includes/git-wiki/sections/header/header.html | 8 | ||||
| -rw-r--r-- | _includes/git-wiki/sections/tail/tail.html | 12 |
12 files changed, 134 insertions, 39 deletions
diff --git a/_includes/git-wiki/components/action_btn/page_actions.html b/_includes/git-wiki/components/action_btn/page_actions.html index 03f1d85..9902234 100644 --- a/_includes/git-wiki/components/action_btn/page_actions.html +++ b/_includes/git-wiki/components/action_btn/page_actions.html @@ -5,24 +5,28 @@ <span class="tools-element"><a target="_blank" href="{{ site.github.repository_url }}/wiki/{{url | remove: '.html' | append: ''}}/_history">History</a></span> <span class="tools-element"><a target="_blank" href="{{ site.github.repository_url }}/wiki/{{url | remove: '.html' | append: '.md'}}/">Source</a></span> {% else %} - <span class="tools-element"><a target="_blank" href="{{ site.github.repository_url }}/new/{{site.git_branch}}?filename={{ site.wiki_folder | default: 'wiki' }}/">Add + <span class="tools-element"><a target="_blank" href="{{ site.github.repository_url }}/new/{{site.git_branch | escape}}?filename={{ site.wiki_folder | default: 'wiki' }}/">Add new</a></span> - <span class="tools-element"><a target="_blank" href="{{ site.github.repository_url }}/edit/{{site.git_branch}}/{{page.path}}">Edit</a></span> - <span class="tools-element"><a target="_blank" href="{{ site.github.repository_url }}/delete/{{site.git_branch}}/{{page.path}}">Delete</a></span> - <span class="tools-element"><a target="_blank" href="{{ site.github.repository_url }}/commits/{{site.git_branch}}/{{page.path}}">History</a></span> - <span class="tools-element"><a target="_blank" href="{{ site.github.repository_url }}/blob/{{site.git_branch}}/{{page.path}}">Source</a></span> + <span class="tools-element"><a target="_blank" href="{{ site.github.repository_url }}/edit/{{site.git_branch | escape}}/{{page.path | escape}}">Edit</a></span> + {% if site.hostname == "gitlab.com" %} + <span class="tools-element"><a target="_blank" href="{{ site.github.repository_url }}/blob/{{site.git_branch | escape}}/{{page.path | escape}}">Delete</a></span> + {% else %} + <span class="tools-element"><a target="_blank" href="{{ site.github.repository_url }}/delete/{{site.git_branch | escape}}/{{page.path | escape}}">Delete</a></span> + {% endif %} + <span class="tools-element"><a target="_blank" href="{{ site.github.repository_url }}/commits/{{site.git_branch | escape}}/{{page.path | escape}}">History</a></span> + <span class="tools-element"><a target="_blank" href="{{ site.github.repository_url }}/blob/{{site.git_branch | escape}}/{{page.path | escape}}">Source</a></span> {% if site.blog_feature %} - <span class="tools-element"><a target="_blank" href="{{ site.github.repository_url }}/new/{{site.git_branch}}?filename=_posts/">Add + <span class="tools-element"><a target="_blank" href="{{ site.github.repository_url }}/new/{{site.git_branch | escape}}?filename=_posts/">Add new post</a></span> {% endif %} - {% if site.use_prose_io %} + {% if site.use_prose_io and site.hostname != "gitlab.com" %} <br> Prose.io: - <span class="tools-element"><a target="_blank" href="http://prose.io/#{{site.github.repository_nwo}}/new/{{site.git_branch}}/{{ site.wiki_folder | default: 'wiki' }}">Add + <span class="tools-element"><a target="_blank" href="http://prose.io/#{{site.github.repository_nwo}}/new/{{site.git_branch | escape}}/{{ site.wiki_folder | default: 'wiki' }}">Add new</a></span> - <span class="tools-element"><a target="_blank" href="http://prose.io/#{{site.github.repository_nwo}}/edit/{{site.git_branch}}/{{page.path}}">Edit</a></span> + <span class="tools-element"><a target="_blank" href="http://prose.io/#{{site.github.repository_nwo}}/edit/{{site.git_branch | escape}}/{{page.path | escape}}">Edit</a></span> {% if site.blog_feature %} - <span class="tools-element"><a target="_blank" href="http://prose.io/#{{site.github.repository_nwo}}/new/{{site.git_branch}}/_posts/">Add + <span class="tools-element"><a target="_blank" href="http://prose.io/#{{site.github.repository_nwo}}/new/{{site.git_branch | escape}}/_posts/">Add new post</a></span> {% endif %} {% endif %} diff --git a/_includes/git-wiki/components/lists/page-list.html b/_includes/git-wiki/components/lists/page-list.html index dea6758..8129bf0 100644 --- a/_includes/git-wiki/components/lists/page-list.html +++ b/_includes/git-wiki/components/lists/page-list.html @@ -15,7 +15,7 @@ {% if page.is_wiki_page != false and page.sitemap != false %} <li class="page-list-item"> {% assign title = page.title | default: page.name %} - <a href="{{ page.url | relative_url }}">{{title}}</a> + <a href="{{ page.url | relative_url }}">{{title | escape}}</a> </li> {% assign numPages = numPages | plus: 1 %} {% endif %} diff --git a/_includes/git-wiki/components/lists/post-list.html b/_includes/git-wiki/components/lists/post-list.html index d6fa663..579dab5 100644 --- a/_includes/git-wiki/components/lists/post-list.html +++ b/_includes/git-wiki/components/lists/post-list.html @@ -15,7 +15,7 @@ {% if post.layout != "null" and post.sitemap != false and post.title %} <li class="post-list-item"> - <a href="{{ post.url | relative_url }}">{{ post.title}}</a> + <a href="{{ post.url | relative_url }}">{{ post.title | escape }}</a> </li> {% assign numPages = numPages | plus: 1 %} {% endif %} diff --git a/_includes/git-wiki/components/logo/logo.html b/_includes/git-wiki/components/logo/logo.html index d33305e..375b06b 100644 --- a/_includes/git-wiki/components/logo/logo.html +++ b/_includes/git-wiki/components/logo/logo.html @@ -1,6 +1,6 @@ <div class="git-wiki-main-logo"> <a href="{{ '/' | relative_url }}"><img src="{{ site.logo_url }}"> - <h1>{{ site.title | default: site.github.repository_name }}</h1> + <h1>{{ site.title | default: site.github.repository_name | escape }}</h1> </a> <p>{{ site.description | default: site.github.project_tagline }}</p> </div>
\ No newline at end of file diff --git a/_includes/git-wiki/components/search/se_js.html b/_includes/git-wiki/components/search/se_js.html index 85e168c..87396be 100644 --- a/_includes/git-wiki/components/search/se_js.html +++ b/_includes/git-wiki/components/search/se_js.html @@ -4,4 +4,4 @@ </div> <!-- script pointing to jekyll-search.js --> <script src="{{ '/assets/js/simple-jekyll-search.min.js' | relative_url }}"></script> -<script async src="{{ '/searchdata.js' | relative_url }}"></script> +<script async src="{{ 'assets/js/searchdata.js' | relative_url }}"></script> diff --git a/_includes/git-wiki/components/toc/toc-lib.html b/_includes/git-wiki/components/toc/toc-lib.html new file mode 100644 index 0000000..4aa9c88 --- /dev/null +++ b/_includes/git-wiki/components/toc/toc-lib.html @@ -0,0 +1,96 @@ +{% capture tocWorkspace %} + {% comment %} + Version 1.0.9 + https://github.com/allejo/jekyll-toc + + "...like all things liquid - where there's a will, and ~36 hours to spare, there's usually a/some way" ~jaybe + + Usage: + {% include toc.html html=content sanitize=true class="inline_toc" id="my_toc" h_min=2 h_max=3 %} + + Parameters: + * 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 + + Output: + An ordered or unordered list representing the table of contents of a markdown block. This snippet will only + generate the table of contents and will NOT output the markdown given to it + {% endcomment %} + + {% capture my_toc %}{% endcapture %} + {% assign orderedList = include.ordered | default: false %} + {% assign minHeader = include.h_min | default: 1 %} + {% assign maxHeader = include.h_max | default: 6 %} + {% assign nodes = include.html | split: '<h' %} + {% assign firstHeader = true %} + + {% capture listModifier %}{% if orderedList %}1.{% else %}-{% endif %}{% endcapture %} + + {% for node in nodes %} + {% if node == "" %} + {% continue %} + {% endif %} + + {% assign headerLevel = node | replace: '"', '' | slice: 0, 1 | times: 1 %} + + {% if headerLevel < minHeader or headerLevel > maxHeader %} + {% continue %} + {% endif %} + + {% if firstHeader %} + {% assign firstHeader = false %} + {% assign minHeader = headerLevel %} + {% endif %} + + {% assign indentAmount = headerLevel | minus: minHeader %} + {% assign _workspace = node | split: '</h' %} + + {% assign _idWorkspace = _workspace[0] | split: 'id="' %} + {% assign _idWorkspace = _idWorkspace[1] | split: '"' %} + {% assign html_id = _idWorkspace[0] %} + + {% assign _classWorkspace = _workspace[0] | split: 'class="' %} + {% assign _classWorkspace = _classWorkspace[1] | split: '"' %} + {% assign html_class = _classWorkspace[0] %} + + {% if html_class contains "no_toc" %} + {% continue %} + {% endif %} + + {% capture _hAttrToStrip %}{{ _workspace[0] | split: '>' | first }}>{% endcapture %} + {% assign header = _workspace[0] | replace: _hAttrToStrip, '' %} + + {% assign space = '' %} + {% for i in (1..indentAmount) %} + {% assign space = space | prepend: ' ' %} + {% endfor %} + + {% if include.item_class and include.item_class != blank %} + {% capture listItemClass %}{:.{{ include.item_class | replace: '%level%', headerLevel }}}{% endcapture %} + {% endif %} + + {% 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 %} + {% endfor %} + + {% if include.class and include.item_class != blank %} + {% capture my_toc %}{:.{{ include.class }}} +{{ my_toc | lstrip }}{% endcapture %} + {% endif %} + + {% if include.id %} + {% capture my_toc %}{: #{{ include.id }}} +{{ my_toc | lstrip }}{% endcapture %} + {% endif %} +{% endcapture %}{% assign tocWorkspace = '' %}{{ my_toc | markdownify | strip }}
\ No newline at end of file diff --git a/_includes/git-wiki/components/toc/toc.html b/_includes/git-wiki/components/toc/toc.html new file mode 100644 index 0000000..c354b42 --- /dev/null +++ b/_includes/git-wiki/components/toc/toc.html @@ -0,0 +1,12 @@ +{% if site.inc_before_toc %} +{% 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> + +{% if site.inc_after_toc %} +{% include {{ site.inc_after_toc }} %} +{% endif %} diff --git a/_includes/git-wiki/defines/defines.html b/_includes/git-wiki/defines/defines.html index 0b47b7d..a91df14 100644 --- a/_includes/git-wiki/defines/defines.html +++ b/_includes/git-wiki/defines/defines.html @@ -1,4 +1,4 @@ -{% assign version = "2.3.1" %} +{% assign version = "2.5.1" %} {% 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/content/content.html b/_includes/git-wiki/sections/content/content.html index 73c7b5b..b356968 100644 --- a/_includes/git-wiki/sections/content/content.html +++ b/_includes/git-wiki/sections/content/content.html @@ -3,15 +3,7 @@ {% include git-wiki/sections/tools/tools.html %} - {% if site.inc_before_toc %} - {% include {{ site.inc_before_toc }} %} - {% endif %} - - <div id="git-wiki-toc"></div> - - {% if site.inc_after_toc %} - {% include {{ site.inc_after_toc }} %} - {% endif %} + {% include git-wiki/components/toc/toc.html %} {% if site.inc_before_content %} {% include {{ site.inc_before_content }} %} diff --git a/_includes/git-wiki/sections/head/scripts.html b/_includes/git-wiki/sections/head/scripts.html index 65ee4ff..9cf23f3 100644 --- a/_includes/git-wiki/sections/head/scripts.html +++ b/_includes/git-wiki/sections/head/scripts.html @@ -4,7 +4,6 @@ <script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script> -<script src="{{ '/assets/js/toc.js' | relative_url }}"></script> <script src="{{ '/assets/js/red-links.js' | relative_url }}"></script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> diff --git a/_includes/git-wiki/sections/header/header.html b/_includes/git-wiki/sections/header/header.html index 8612103..38ec85b 100644 --- a/_includes/git-wiki/sections/header/header.html +++ b/_includes/git-wiki/sections/header/header.html @@ -1,8 +1,10 @@ <div class=" w3-xlarge w3-hide-large" id="git-wiki-mobile-header"> <button class="w3-button w3-teal" onclick="sidebar_toggle()">☰</button> <a href="{{ '/' | relative_url }}"> + {% if site.logo_url %} <img src="{{ site.logo_url }}" width="20px"> - {{ site.title }} + {% endif %} + {{ site.title | escape }} </a> </div> <header class="w3-sidebar w3-bar-block w3-collapse" id="git-wiki-sidebar"> @@ -15,6 +17,8 @@ <div class="w3-hide-medium w3-hide-small"> {% if site.logo_url %} {% include git-wiki/components/logo/logo.html %} + {% else %} + <h1>{{ site.title | escape }}</h1> {% endif %} </div> @@ -50,4 +54,4 @@ $(sidebar).attr('style', 'display: block;'); } } -</script>
\ No newline at end of file +</script> diff --git a/_includes/git-wiki/sections/tail/tail.html b/_includes/git-wiki/sections/tail/tail.html index fc8d46b..692867f 100644 --- a/_includes/git-wiki/sections/tail/tail.html +++ b/_includes/git-wiki/sections/tail/tail.html @@ -18,18 +18,6 @@ </script> {% endif %} -<script type="text/javascript"> - $(document).ready(function () { - $('#git-wiki-toc').toc({ - title: '<i>Contents</i>', - showSpeed: 0, - listType: "ul", - headers: '#git-wiki-content h1, #git-wiki-content h2' - }); - $(document.body).redLinks(); - }); -</script> - {% if site.inc_after_tail %} {% include {{ site.inc_after_tail }} %} {% endif %} |
