Skip to content

Commit a4fd66f

Browse files
authored
Merge pull request #29 from allejo/hotfix/logic-improvements
Fix logic errors on rendering list item classes
2 parents 86254a9 + 85c533f commit a4fd66f

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
_site
22
.sass-cache
3+
.jekyll-cache
34
.jekyll-metadata
45
Gemfile.lock
56
vendor

_includes/toc.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% capture tocWorkspace %}
22
{% comment %}
3-
Version 1.0.8
3+
Version 1.0.9
44
https://github.com/allejo/jekyll-toc
55

66
"...like all things liquid - where there's a will, and ~36 hours to spare, there's usually a/some way" ~jaybe
@@ -75,16 +75,16 @@
7575
{% assign space = space | prepend: ' ' %}
7676
{% endfor %}
7777

78-
{% unless include.item_class == blank %}
78+
{% if include.item_class and include.item_class != blank %}
7979
{% capture listItemClass %}{:.{{ include.item_class | replace: '%level%', headerLevel }}}{% endcapture %}
80-
{% endunless %}
80+
{% endif %}
8181

8282
{% capture heading_body %}{% if include.sanitize %}{{ header | strip_html }}{% else %}{{ header }}{% endif %}{% endcapture %}
8383
{% capture my_toc %}{{ my_toc }}
8484
{{ space }}{{ listModifier }} {{ listItemClass }} [{{ heading_body | replace: "|", "\|" }}]({% if include.baseurl %}{{ include.baseurl }}{% endif %}#{{ html_id }}){% if include.anchor_class %}{:.{{ include.anchor_class }}}{% endif %}{% endcapture %}
8585
{% endfor %}
8686

87-
{% if include.class %}
87+
{% if include.class and include.item_class != blank %}
8888
{% capture my_toc %}{:.{{ include.class }}}
8989
{{ my_toc | lstrip }}{% endcapture %}
9090
{% endif %}

0 commit comments

Comments
 (0)