summaryrefslogtreecommitdiff
path: root/_includes/git-wiki/components
diff options
context:
space:
mode:
Diffstat (limited to '_includes/git-wiki/components')
-rw-r--r--_includes/git-wiki/components/action_btn/page_actions.html24
-rw-r--r--_includes/git-wiki/components/lists/page-list.html2
-rw-r--r--_includes/git-wiki/components/lists/post-list.html2
-rw-r--r--_includes/git-wiki/components/logo/logo.html2
-rw-r--r--_includes/git-wiki/components/search/se_js.html2
-rw-r--r--_includes/git-wiki/components/toc/toc-lib.html96
-rw-r--r--_includes/git-wiki/components/toc/toc.html12
7 files changed, 126 insertions, 14 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 %}