jekyll-cessda-docs 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/README.md +52 -0
  4. data/_config.yml +59 -0
  5. data/_includes/css/custom.scss.liquid +1 -0
  6. data/_includes/css/just-the-docs.scss.liquid +8 -0
  7. data/_includes/fix_linenos.html +65 -0
  8. data/_includes/head.html +40 -0
  9. data/_includes/head_custom.html +0 -0
  10. data/_includes/js/custom.js +0 -0
  11. data/_includes/nav.html +100 -0
  12. data/_includes/title.html +5 -0
  13. data/_includes/vendor/anchor_headings.html +144 -0
  14. data/_layouts/about.html +5 -0
  15. data/_layouts/default.html +200 -0
  16. data/_layouts/home.html +5 -0
  17. data/_layouts/page.html +5 -0
  18. data/_layouts/post.html +5 -0
  19. data/_layouts/table_wrappers.html +7 -0
  20. data/_layouts/vendor/compress.html +10 -0
  21. data/_sass/base.scss +108 -0
  22. data/_sass/buttons.scss +118 -0
  23. data/_sass/cessda.scss +93 -0
  24. data/_sass/code.scss +334 -0
  25. data/_sass/color_schemes/dark.scss +17 -0
  26. data/_sass/color_schemes/light.scss +0 -0
  27. data/_sass/content.scss +199 -0
  28. data/_sass/custom/custom.scss +0 -0
  29. data/_sass/labels.scss +37 -0
  30. data/_sass/layout.scss +192 -0
  31. data/_sass/modules.scss +21 -0
  32. data/_sass/navigation.scss +219 -0
  33. data/_sass/print.scss +40 -0
  34. data/_sass/search.scss +323 -0
  35. data/_sass/support/_functions.scss +9 -0
  36. data/_sass/support/_variables.scss +152 -0
  37. data/_sass/support/mixins/_buttons.scss +27 -0
  38. data/_sass/support/mixins/_layout.scss +34 -0
  39. data/_sass/support/mixins/_typography.scss +84 -0
  40. data/_sass/support/mixins/mixins.scss +3 -0
  41. data/_sass/support/support.scss +3 -0
  42. data/_sass/tables.scss +58 -0
  43. data/_sass/typography.scss +64 -0
  44. data/_sass/utilities/_colors.scss +239 -0
  45. data/_sass/utilities/_layout.scss +95 -0
  46. data/_sass/utilities/_lists.scss +17 -0
  47. data/_sass/utilities/_spacing.scss +165 -0
  48. data/_sass/utilities/_typography.scss +91 -0
  49. data/_sass/utilities/utilities.scss +5 -0
  50. data/_sass/vendor/normalize.scss/README.md +78 -0
  51. data/_sass/vendor/normalize.scss/normalize.scss +427 -0
  52. data/_sass/vendor/normalize.scss/package.json +70 -0
  53. data/assets/CESSDA.png +0 -0
  54. data/assets/css/just-the-docs-dark.scss +3 -0
  55. data/assets/css/just-the-docs-default.scss +8 -0
  56. data/assets/css/just-the-docs-light.scss +3 -0
  57. data/assets/images/CESSDA.png +0 -0
  58. data/assets/images/search.svg +1 -0
  59. data/assets/js/just-the-docs.js +471 -0
  60. data/assets/js/vendor/lunr.min.js +6 -0
  61. data/assets/js/zzzz-search-data.json +72 -0
  62. metadata +118 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8d1c815bf69e499017d3415c58ed72bfb034d18af5ad2c2f815cdaaadfef3d38
4
+ data.tar.gz: 5f76adbaa36a8c84ee8d01241c5484987a594950f705511c021a470725d0b753
5
+ SHA512:
6
+ metadata.gz: 10698e65f292feb93d47674a6f651fdad62849892f8a63d9682d024d0ed80cf756c66fde6ccb32a1897ba7ef36f0112c4ee665b19ebf97024d92c11836843fd8
7
+ data.tar.gz: 8dc5fb7c40531412345bedce4ade96b58043956abeae28aefbd298f243d9208f652ea82e41a37ab51332ec9b7d51e4014debf4bd61202d4fce54b82c6d3daaff
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 openconcept
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,52 @@
1
+ # jekyll-cessda-docs
2
+
3
+ Welcome to your new Jekyll theme! In this directory, you'll find the files you need to be able to package up your theme into a gem. Put your layouts in `_layouts`, your includes in `_includes`, your sass files in `_sass` and any other assets in `assets`.
4
+
5
+ To experiment with this code, add some sample content and run `bundle exec jekyll serve` – this directory is setup just like a Jekyll site!
6
+
7
+ TODO: Delete this and the text above, and describe your gem
8
+
9
+
10
+ ## Installation
11
+
12
+ Add this line to your Jekyll site's `Gemfile`:
13
+
14
+ ```ruby
15
+ gem "jekyll-cessda-docs"
16
+ ```
17
+
18
+ And add this line to your Jekyll site's `_config.yml`:
19
+
20
+ ```yaml
21
+ theme: jekyll-cessda-docs
22
+ ```
23
+
24
+ And then execute:
25
+
26
+ $ bundle
27
+
28
+ Or install it yourself as:
29
+
30
+ $ gem install jekyll-cessda-docs
31
+
32
+ ## Usage
33
+
34
+ TODO: Write usage instructions here. Describe your available layouts, includes, sass and/or assets.
35
+
36
+ ## Contributing
37
+
38
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/hello. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
39
+
40
+ ## Development
41
+
42
+ To set up your environment to develop this theme, run `bundle install`.
43
+
44
+ Your theme is setup just like a normal Jekyll site! To test your theme, run `bundle exec jekyll serve` and open your browser at `http://localhost:4000`. This starts a Jekyll server using your theme. Add pages, documents, data, etc. like normal to test your theme's contents. As you make modifications to your theme and to your content, your site will regenerate and you should see the changes in the browser after a refresh, just like normal.
45
+
46
+ When your theme is released, only the files in `_layouts`, `_includes`, `_sass` and `assets` tracked with Git will be bundled.
47
+ To add a custom directory to your theme-gem, please edit the regexp in `jekyll-cessda-docs.gemspec` accordingly.
48
+
49
+ ## License
50
+
51
+ The theme is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
52
+
@@ -0,0 +1,59 @@
1
+ # CESSDA Technical Guidelines
2
+ ---
3
+ # If you make changes here, you need to restart Jekyll to apply them
4
+ title: CESSDA Technical Guidelines
5
+ baseurl: /
6
+ logo: assets/CESSDA.png
7
+ color_scheme: cessda
8
+
9
+ # Theme
10
+ #theme: just-the-docs
11
+ theme: jekyll-cessda-docs
12
+ search_enabled: true
13
+
14
+ plugins:
15
+ - jekyll-seo-tag
16
+
17
+ defaults:
18
+ -
19
+ scope:
20
+ path: "**/*.md"
21
+ type: "pages"
22
+ values:
23
+ permalink: /:path/:basename:output_ext
24
+ layout: "page"
25
+
26
+ technical-reference:
27
+ version: "v0.2"
28
+ url: "https://technical-reference.readthedocs.io/en/v0.2/"
29
+
30
+ # Exclude from processing.
31
+ # The following items will not be processed, by default.
32
+ # Any item listed under the `exclude:` key here will be automatically added
33
+ # to the internal "default list".
34
+ #
35
+ # Excluded items can be processed by explicitly listing the directories or
36
+ # their entries' file path in the `include:` list.
37
+ #
38
+ # Individual pages that are e.g. in draft format can be hidden
39
+ # using 'published: false' in the Front Matter.
40
+ #
41
+ exclude:
42
+ - .sass-cache/
43
+ - .jekyll-cache/
44
+ - Dockerfile
45
+ - Jenkinsfile
46
+ - gemfiles/
47
+ - Gemfile
48
+ - Gemfile.lock
49
+ - Rakefile
50
+ - nginx/
51
+ - node_modules/
52
+ - README.md
53
+ - CONTRIBUTING.md
54
+ - CHANGELOG.md
55
+ - vendor/bundle/
56
+ - vendor/cache/
57
+ - vendor/gems/
58
+ - vendor/ruby/
59
+ - scripts/
@@ -0,0 +1 @@
1
+ @import "./custom/custom";
@@ -0,0 +1,8 @@
1
+ {% if site.logo %}
2
+ $logo: "{{ site.logo | absolute_url }}";
3
+ {% endif %}
4
+ @import "./support/support";
5
+ @import "./color_schemes/{{ include.color_scheme }}";
6
+ @import "./modules";
7
+ @import "./custom/custom";
8
+
@@ -0,0 +1,65 @@
1
+ {%- comment -%}
2
+ This file can be used to fix the HTML produced by Jekyll for highlighted
3
+ code with line numbers.
4
+
5
+ It works with `{% highlight some_language linenos %}...{% endhighlight %}`
6
+ and with the Kramdown option to add line numbers to fenced code.
7
+
8
+ The implementation was derived from the workaround provided by
9
+ Dmitry Hrabrov (DeXP) at
10
+ https://github.com/penibelst/jekyll-compress-html/issues/71#issuecomment-188144901
11
+
12
+ EXPLANATION
13
+
14
+ The HTML produced by Rouge highlighting with lie numbers is of the form
15
+ `code table`. Jekyll (<= 4.1.1) always wraps the highlighted HTML
16
+ with `pre`. This wrapping is not only unnecessary, but also transforms
17
+ the conforming HTML produced by Rouge to non-conforming HTML, which
18
+ results in HTML validation error reports.
19
+
20
+ The fix removes the outer `pre` tags whenever they contain the pattern
21
+ `<table class="rouge-table">`.
22
+
23
+ Apart from avoiding HTML validation errors, the fix allows the use of
24
+ the [Jekyll layout for compressing HTML](http://jch.penibelst.de),
25
+ which relies on `pre` tags not being nested, according to
26
+ https://github.com/penibelst/jekyll-compress-html/issues/71#issuecomment-172069842
27
+
28
+ USAGE
29
+
30
+ (Any names can be used for `some_var` and `some_language`.)
31
+
32
+ {% capture some_var %}
33
+ {% highlight some_language linenos %}
34
+ Some code
35
+ {% endhighlight %}
36
+ {% endcapture %}
37
+ {% include fix_linenos.html code=some_var %}
38
+
39
+ For code fences:
40
+
41
+ {% capture some_var %}
42
+ ```some_language
43
+ Some code
44
+ ```
45
+ {% endcapture %}
46
+ {% assign some_var = some_var | markdownify %}
47
+ {% include fix_linenos.html code=some_var %}
48
+
49
+ CAVEATS
50
+
51
+ The above does not work when `Some code` happens to contain the matched string
52
+ `<table class="rouge-table">`.
53
+
54
+ The use of this file overwrites the variable `fix_linenos_code` with `nil`.
55
+
56
+ {%- endcomment -%}
57
+
58
+ {% assign fix_linenos_code = include.code %}
59
+ {% if fix_linenos_code contains '<table class="rouge-table">' %}
60
+ {% assign fix_linenos_code = fix_linenos_code | replace: '<pre class="highlight">', '<pre>' %}
61
+ {% assign fix_linenos_code = fix_linenos_code | replace: "<pre><code", "<code" %}
62
+ {% assign fix_linenos_code = fix_linenos_code | replace: "</code></pre>", "</code>" %}
63
+ {% endif %}
64
+ {{ fix_linenos_code }}
65
+ {% assign fix_linenos_code = nil %}
@@ -0,0 +1,40 @@
1
+ <head>
2
+ <meta charset="UTF-8">
3
+ <meta http-equiv="X-UA-Compatible" content="IE=Edge">
4
+
5
+ {% unless site.plugins contains "jekyll-seo-tag" %}
6
+ <title>{{ page.title }} - {{ site.title }}</title>
7
+
8
+ {% if page.description %}
9
+ <meta name="Description" content="{{ page.description }}">
10
+ {% endif %}
11
+ {% endunless %}
12
+
13
+ <link rel="shortcut icon" href="{{ 'favicon.ico' | relative_url }}" type="image/x-icon">
14
+
15
+ <link rel="stylesheet" href="{{ '/assets/css/just-the-docs-default.css' | relative_url }}">
16
+
17
+ {% if site.ga_tracking != nil %}
18
+ <script async src="https://www.googletagmanager.com/gtag/js?id={{ site.ga_tracking }}"></script>
19
+ <script>
20
+ window.dataLayer = window.dataLayer || [];
21
+ function gtag(){dataLayer.push(arguments);}
22
+ gtag('js', new Date());
23
+
24
+ gtag('config', '{{ site.ga_tracking }}'{% unless site.ga_tracking_anonymize_ip == nil %}, { 'anonymize_ip': true }{% endunless %});
25
+ </script>
26
+
27
+ {% endif %}
28
+
29
+ {% if site.search_enabled != false %}
30
+ <script type="text/javascript" src="{{ '/assets/js/vendor/lunr.min.js' | relative_url }}"></script>
31
+ {% endif %}
32
+ <script type="text/javascript" src="{{ '/assets/js/just-the-docs.js' | relative_url }}"></script>
33
+
34
+ <meta name="viewport" content="width=device-width, initial-scale=1">
35
+
36
+ {% seo %}
37
+
38
+ {% include head_custom.html %}
39
+
40
+ </head>
File without changes
File without changes
@@ -0,0 +1,100 @@
1
+ <ul class="nav-list nav-list-top">
2
+ {%- assign included_pages = include.pages
3
+ | where_exp:"item", "item.nav_exclude != true"
4
+ | where_exp:"item", "item.title != nil" -%}
5
+
6
+ {%- comment -%}
7
+ The values of `title` and `nav_order` can be numbers or strings.
8
+ Jekyll gives build failures when sorting on mixtures of different types,
9
+ so numbers and strings need to be sorted separately.
10
+
11
+ Here, numbers are sorted by their values, and come before all strings.
12
+ An omitted `nav_order` value is equivalent to the page's `title` value
13
+ (except that a numerical `title` value is treated as a string).
14
+
15
+ The case-sensitivity of string sorting is determined by `site.nav_sort`.
16
+ {%- endcomment -%}
17
+
18
+ {%- assign string_ordered_pages = included_pages
19
+ | where_exp:"item", "item.nav_order == nil" -%}
20
+ {%- assign nav_ordered_pages = included_pages
21
+ | where_exp:"item", "item.nav_order != nil" -%}
22
+
23
+ {%- comment -%}
24
+ The nav_ordered_pages have to be added to number_ordered_pages and
25
+ string_ordered_pages, depending on the nav_order value.
26
+ The first character of the jsonify result is `"` only for strings.
27
+ {%- endcomment -%}
28
+ {%- assign nav_ordered_groups = nav_ordered_pages
29
+ | group_by_exp:"item", "item.nav_order | jsonify | slice: 0" -%}
30
+ {%- assign number_ordered_pages = "" | split:"X" -%}
31
+ {%- for group in nav_ordered_groups -%}
32
+ {%- if group.name == '"' -%}
33
+ {%- assign string_ordered_pages = string_ordered_pages | concat: group.items -%}
34
+ {%- else -%}
35
+ {%- assign number_ordered_pages = number_ordered_pages | concat: group.items -%}
36
+ {%- endif -%}
37
+ {%- endfor -%}
38
+
39
+ {%- assign sorted_number_ordered_pages = number_ordered_pages | sort:"nav_order" -%}
40
+
41
+ {%- comment -%}
42
+ The string_ordered_pages have to be sorted by nav_order, and otherwise title
43
+ (where appending the empty string to a numeric title converts it to a string).
44
+ After grouping them by those values, the groups are sorted, then the items
45
+ of each group are concatenated.
46
+ {%- endcomment -%}
47
+ {%- assign string_ordered_groups = string_ordered_pages
48
+ | group_by_exp:"item", "item.nav_order | default: item.title | append:''" -%}
49
+ {%- if site.nav_sort == 'case_insensitive' -%}
50
+ {%- assign sorted_string_ordered_groups = string_ordered_groups | sort_natural:"name" -%}
51
+ {%- else -%}
52
+ {%- assign sorted_string_ordered_groups = string_ordered_groups | sort:"name" -%}
53
+ {%- endif -%}
54
+ {%- assign sorted_string_ordered_pages = "" | split:"X" -%}
55
+ {%- for group in sorted_string_ordered_groups -%}
56
+ {%- assign sorted_string_ordered_pages = sorted_string_ordered_pages | concat: group.items -%}
57
+ {%- endfor -%}
58
+
59
+ {%- assign pages_list = sorted_number_ordered_pages | concat: sorted_string_ordered_pages -%}
60
+
61
+ {%- for node in pages_list -%}
62
+ {%- if node.parent == nil -%}
63
+ <li class="nav-list-item{% if page.url == node.url or page.parent == node.title or page.grand_parent == node.title %} active{% endif %}">
64
+ {%- if page.parent == node.title or page.grand_parent == node.title -%}
65
+ {%- assign first_level_url = node.url | absolute_url -%}
66
+ {%- endif -%}
67
+ {%- if node.has_children -%}
68
+ <a href="#" class="nav-list-expander"><svg viewBox="0 0 24 24"><use xlink:href="#svg-arrow-right"></use></svg></a>
69
+ {%- endif -%}
70
+ <a href="{{ node.url | absolute_url }}" class="nav-list-link{% if page.url == node.url %} active{% endif %}">{{ node.title }}</a>
71
+ {%- if node.has_children -%}
72
+ {%- assign children_list = pages_list | where: "parent", node.title -%}
73
+ <ul class="nav-list ">
74
+ {%- for child in children_list -%}
75
+ <li class="nav-list-item {% if page.url == child.url or page.parent == child.title %} active{% endif %}">
76
+ {%- if page.url == child.url or page.parent == child.title -%}
77
+ {%- assign second_level_url = child.url | absolute_url -%}
78
+ {%- endif -%}
79
+ {%- if child.has_children -%}
80
+ <a href="#" class="nav-list-expander"><svg viewBox="0 0 24 24"><use xlink:href="#svg-arrow-right"></use></svg></a>
81
+ {%- endif -%}
82
+ <a href="{{ child.url | absolute_url }}" class="nav-list-link{% if page.url == child.url %} active{% endif %}">{{ child.title }}</a>
83
+ {%- if child.has_children -%}
84
+ {%- assign grand_children_list = pages_list | where: "parent", child.title | where: "grand_parent", node.title -%}
85
+ <ul class="nav-list">
86
+ {%- for grand_child in grand_children_list -%}
87
+ <li class="nav-list-item {% if page.url == grand_child.url %} active{% endif %}">
88
+ <a href="{{ grand_child.url | absolute_url }}" class="nav-list-link{% if page.url == grand_child.url %} active{% endif %}">{{ grand_child.title }}</a>
89
+ </li>
90
+ {%- endfor -%}
91
+ </ul>
92
+ {%- endif -%}
93
+ </li>
94
+ {%- endfor -%}
95
+ </ul>
96
+ {%- endif -%}
97
+ </li>
98
+ {%- endif -%}
99
+ {%- endfor -%}
100
+ </ul>
@@ -0,0 +1,5 @@
1
+ {% if site.logo %}
2
+ <div class="site-logo"></div>
3
+ {% else %}
4
+ {{ site.title }}
5
+ {% endif %}
@@ -0,0 +1,144 @@
1
+ {% capture headingsWorkspace %}
2
+ {% comment %}
3
+ Copyright (c) 2018 Vladimir "allejo" Jimenez
4
+
5
+ Permission is hereby granted, free of charge, to any person
6
+ obtaining a copy of this software and associated documentation
7
+ files (the "Software"), to deal in the Software without
8
+ restriction, including without limitation the rights to use,
9
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the
11
+ Software is furnished to do so, subject to the following
12
+ conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24
+ OTHER DEALINGS IN THE SOFTWARE.
25
+ {% endcomment %}
26
+ {% comment %}
27
+ Version 1.0.7
28
+ https://github.com/allejo/jekyll-anchor-headings
29
+
30
+ "Be the pull request you wish to see in the world." ~Ben Balter
31
+
32
+ Usage:
33
+ {% include anchor_headings.html html=content anchorBody="#" %}
34
+
35
+ Parameters:
36
+ * html (string) - the HTML of compiled markdown generated by kramdown in Jekyll
37
+
38
+ Optional Parameters:
39
+ * beforeHeading (bool) : false - Set to true if the anchor should be placed _before_ the heading's content
40
+ * anchorAttrs (string) : '' - Any custom HTML attributes that will be added to the `<a>` tag; you may NOT use `href`, `class` or `title`;
41
+ the `%heading%` and `%html_id%` placeholders are available
42
+ * anchorBody (string) : '' - The content that will be placed inside the anchor; the `%heading%` placeholder is available
43
+ * anchorClass (string) : '' - The class(es) that will be used for each anchor. Separate multiple classes with a space
44
+ * anchorTitle (string) : '' - The `title` attribute that will be used for anchors
45
+ * h_min (int) : 1 - The minimum header level to build an anchor for; any header lower than this value will be ignored
46
+ * h_max (int) : 6 - The maximum header level to build an anchor for; any header greater than this value will be ignored
47
+ * bodyPrefix (string) : '' - Anything that should be inserted inside of the heading tag _before_ its anchor and content
48
+ * bodySuffix (string) : '' - Anything that should be inserted inside of the heading tag _after_ its anchor and content
49
+
50
+ Output:
51
+ The original HTML with the addition of anchors inside of all of the h1-h6 headings.
52
+ {% endcomment %}
53
+
54
+ {% assign minHeader = include.h_min | default: 1 %}
55
+ {% assign maxHeader = include.h_max | default: 6 %}
56
+ {% assign beforeHeading = include.beforeHeading %}
57
+ {% assign nodes = include.html | split: '<h' %}
58
+
59
+ {% capture edited_headings %}{% endcapture %}
60
+
61
+ {% for _node in nodes %}
62
+ {% capture node %}{{ _node | strip }}{% endcapture %}
63
+
64
+ {% if node == "" %}
65
+ {% continue %}
66
+ {% endif %}
67
+
68
+ {% assign nextChar = node | replace: '"', '' | strip | slice: 0, 1 %}
69
+ {% assign headerLevel = nextChar | times: 1 %}
70
+
71
+ <!-- If the level is cast to 0, it means it's not a h1-h6 tag, so let's see if we need to fix it -->
72
+ {% if headerLevel == 0 %}
73
+ <!-- Split up the node based on closing angle brackets and get the first one. -->
74
+ {% assign firstChunk = node | split: '>' | first %}
75
+
76
+ <!-- If the first chunk does NOT contain a '<', that means we've broken another HTML tag that starts with 'h' -->
77
+ {% unless firstChunk contains '<' %}
78
+ {% capture node %}<h{{ node }}{% endcapture %}
79
+ {% endunless %}
80
+
81
+ {% capture edited_headings %}{{ edited_headings }}{{ node }}{% endcapture %}
82
+ {% continue %}
83
+ {% endif %}
84
+
85
+ {% capture _closingTag %}</h{{ headerLevel }}>{% endcapture %}
86
+ {% assign _workspace = node | split: _closingTag %}
87
+ {% assign _idWorkspace = _workspace[0] | split: 'id="' %}
88
+ {% assign _idWorkspace = _idWorkspace[1] | split: '"' %}
89
+ {% assign html_id = _idWorkspace[0] %}
90
+
91
+ {% capture _hAttrToStrip %}{{ _workspace[0] | split: '>' | first }}>{% endcapture %}
92
+ {% assign header = _workspace[0] | replace: _hAttrToStrip, '' %}
93
+
94
+ <!-- Build the anchor to inject for our heading -->
95
+ {% capture anchor %}{% endcapture %}
96
+
97
+ {% if html_id and headerLevel >= minHeader and headerLevel <= maxHeader %}
98
+ {% capture anchor %}href="#{{ html_id }}"{% endcapture %}
99
+
100
+ {% if include.anchorClass %}
101
+ {% capture anchor %}{{ anchor }} class="{{ include.anchorClass }}"{% endcapture %}
102
+ {% endif %}
103
+
104
+ {% if include.anchorTitle %}
105
+ {% capture anchor %}{{ anchor }} title="{{ include.anchorTitle | replace: '%heading%', header }}"{% endcapture %}
106
+ {% endif %}
107
+
108
+ {% if include.anchorAttrs %}
109
+ {% capture anchor %}{{ anchor }} {{ include.anchorAttrs | replace: '%heading%', header | replace: '%html_id%', html_id }}{% endcapture %}
110
+ {% endif %}
111
+
112
+ {% capture anchor %}<a {{ anchor }}>{{ include.anchorBody | replace: '%heading%', header | default: '' }}</a>{% endcapture %}
113
+
114
+ <!-- In order to prevent adding extra space after a heading, we'll let the 'anchor' value contain it -->
115
+ {% if beforeHeading %}
116
+ {% capture anchor %}{{ anchor }} {% endcapture %}
117
+ {% else %}
118
+ {% capture anchor %} {{ anchor }}{% endcapture %}
119
+ {% endif %}
120
+ {% endif %}
121
+
122
+ {% capture new_heading %}
123
+ <h{{ _hAttrToStrip }}
124
+ {{ include.bodyPrefix }}
125
+ {% if beforeHeading %}
126
+ {{ anchor }}{{ header }}
127
+ {% else %}
128
+ {{ header }}{{ anchor }}
129
+ {% endif %}
130
+ {{ include.bodySuffix }}
131
+ </h{{ headerLevel }}>
132
+ {% endcapture %}
133
+
134
+ <!--
135
+ If we have content after the `</hX>` tag, then we'll want to append that here so we don't lost any content.
136
+ -->
137
+ {% assign chunkCount = _workspace | size %}
138
+ {% if chunkCount > 1 %}
139
+ {% capture new_heading %}{{ new_heading }}{{ _workspace | last }}{% endcapture %}
140
+ {% endif %}
141
+
142
+ {% capture edited_headings %}{{ edited_headings }}{{ new_heading }}{% endcapture %}
143
+ {% endfor %}
144
+ {% endcapture %}{% assign headingsWorkspace = '' %}{{ edited_headings | strip }}