iugu-docs-theme 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/README.md +50 -0
  4. data/_config.yml +35 -0
  5. data/_data/contentful/spaces/iugu.yaml +26 -0
  6. data/_data/method-colors.yml +5 -0
  7. data/_includes/alert.liquid +7 -0
  8. data/_includes/auth_data.liquid +37 -0
  9. data/_includes/dark_mode_button.liquid +31 -0
  10. data/_includes/footer.html +11 -0
  11. data/_includes/header.html +79 -0
  12. data/_includes/icons/auth.liquid +3 -0
  13. data/_includes/icons/danger.liquid +3 -0
  14. data/_includes/icons/description.liquid +3 -0
  15. data/_includes/icons/info.liquid +3 -0
  16. data/_includes/icons/money.liquid +3 -0
  17. data/_includes/icons/success.liquid +3 -0
  18. data/_includes/icons/warning.liquid +3 -0
  19. data/_includes/icons/wip.liquid +3 -0
  20. data/_includes/lixo.html +10 -0
  21. data/_includes/navigation_widget.liquid +14 -0
  22. data/_includes/openapi_ref.liquid +36 -0
  23. data/_includes/params/card.liquid +18 -0
  24. data/_includes/request/body_example.liquid +27 -0
  25. data/_includes/request/list.liquid +48 -0
  26. data/_includes/response/table.liquid +40 -0
  27. data/_includes/schema/nested_table.liquid +44 -0
  28. data/_includes/schema/table.liquid +36 -0
  29. data/_includes/search_modal.liquid +34 -0
  30. data/_includes/sidebar_menu.liquid +28 -0
  31. data/_includes/toc.html +174 -0
  32. data/_includes/toc_content.liquid +21 -0
  33. data/_includes/widget.liquid +17 -0
  34. data/_includes/widgets_base.liquid +5 -0
  35. data/_layouts/default.html +100 -0
  36. data/_layouts/page.html +5 -0
  37. data/_layouts/post.html +5 -0
  38. data/_plugins/authorization_parser.rb +51 -0
  39. data/_plugins/button_processor.rb +24 -0
  40. data/_plugins/check_required_filter.rb +48 -0
  41. data/_plugins/collapse_link_tag.rb +81 -0
  42. data/_plugins/converters/alert.rb +34 -0
  43. data/_plugins/converters/base_converter.rb +8 -0
  44. data/_plugins/converters/custom.rb +28 -0
  45. data/_plugins/converters/openapi_ref.rb +134 -0
  46. data/_plugins/converters/widget.rb +12 -0
  47. data/_plugins/doc_toc_filter.rb +27 -0
  48. data/_plugins/navigation_widget.rb +49 -0
  49. data/_plugins/response_filter.rb +28 -0
  50. data/_plugins/type_style_filter.rb +23 -0
  51. data/assets/css/application.css +5484 -0
  52. data/assets/css/highlight.css +217 -0
  53. data/assets/js/highlight_menu.js +19 -0
  54. data/assets/js/main.js +110 -0
  55. data/src/css/application.css +100 -0
  56. metadata +209 -0
@@ -0,0 +1,44 @@
1
+ {% assign name = include.property[0] %}
2
+ {% assign param = include.property[1] %}
3
+ {% if param.type == 'object' or param.type == 'array' %}
4
+ {% assign nesting = true %}
5
+ {% else %}
6
+ {% assign nesting = false %}
7
+ {% endif %}
8
+
9
+ <table class="w-full bg-slate-400/5 dark:bg-slate-600/5">
10
+ <tbody>
11
+ <tr class="hover:bg-neutral-100 dark:hover:bg-neutral-800" >
12
+ <td colspan="2" {% if nesting %} class="cursor-pointer" x-data @click="$store.{{name}}Open = ! $store.{{name}}Open"{% endif %}>
13
+ {% include params/card.liquid
14
+ name=name
15
+ item_required=param.item_required
16
+ type=param.type
17
+ description=param.description
18
+ example=param.example
19
+ nesting=nesting %}
20
+ </td>
21
+ </tr>
22
+ {% if param.type == 'object' %}
23
+ <tr>
24
+ <td colspan="2">
25
+ <div class="border-l border-dashed border-neutral-300 dark:border-neutral-700 ml-6" x-collapse x-show="Alpine.store('{{name}}Open')">
26
+ {% for prop in param.properties %}
27
+ {% include schema/nested_table.liquid property=prop %}
28
+ {% endfor %}
29
+ </div>
30
+ </td>
31
+ </tr>
32
+ {% elsif param.type == 'array' %}
33
+ <tr>
34
+ <td colspan='2'>
35
+ <div class="border-l border-dashed border-neutral-300 dark:border-neutral-700 ml-6" x-data x-collapse x-show="Alpine.store('{{name}}Open')">
36
+ {% for prop in param.items.properties %}
37
+ {% include schema/nested_table.liquid property = prop %}
38
+ {% endfor %}
39
+ </div>
40
+ </td>
41
+ </tr>
42
+ {% endif %}
43
+ </tbody>
44
+ </table>
@@ -0,0 +1,36 @@
1
+ {% if schema %}
2
+ {% assign properties = schema %}
3
+ {% elsif include.properties %}
4
+ {% assign properties = include.properties %}
5
+ {% endif %}
6
+
7
+ <div class='not-prose'>
8
+ <div class='relative border dark:border-neutral-800 dark:bg-neutral-900 rounded-xl overflow-auto'>
9
+ <div class='shadow-sm overflow-hidden'>
10
+ <table class='border-collapse table-auto w-full text-sm'>
11
+ <thead>
12
+ <tr>
13
+ <th colspan='2' class='dark:border-neutral-800 bg-neutral-100 dark:bg-neutral-800 pl-6 font-medium py-3 dark:text-slate-200 text-left'>
14
+ <p class="text-xl pb-2 font-semibold">
15
+ {{ include.title | default: "Schema" }}
16
+ {% if include.request_required %}
17
+ <i class='pt-2 text-xs text-red-500'>{% t schema.table.required %}</i>
18
+ {% endif %}
19
+ </p>
20
+ <p class="italic">{% t schema.table.content_type %}: {{ include.type }}</p>
21
+ </th>
22
+ </tr>
23
+ </thead>
24
+ <tbody x-data>
25
+ <tr>
26
+ <td>
27
+ {% for property in properties %}
28
+ {% include schema/nested_table.liquid property=property %}
29
+ {% endfor %}
30
+ </td>
31
+ </tr>
32
+ </tbody>
33
+ </table>
34
+ </div>
35
+ </div>
36
+ </div>
@@ -0,0 +1,34 @@
1
+ <div id="buttonmodal" class="bg-black/50 fixed hidden top-0 justify-center z-50 w-full h-full">
2
+ <div class="modal pt-32 h-32 w-1/3">
3
+ <input type="text" placeholder="{% t search_modal.search %}" onfocus="this.value=''" name="search" id="searchInput" class="bg-neutral-100 w-full block rounded-md text-left px-4 py-1.5 outline-none shadow-md text-neutral-500">
4
+ <div class="pt-1" id="searchResults">
5
+ </div>
6
+ </div>
7
+
8
+ <script>
9
+ const element = document.getElementById('search-modal');
10
+
11
+ element.addEventListener('click', function(event) {
12
+ event.preventDefault();
13
+ event.stopPropagation();
14
+ document.getElementById('buttonmodal').style.display = 'flex';
15
+ document.getElementById('searchInput').focus()
16
+ });
17
+
18
+ document.getElementById('buttonmodal').addEventListener('click', function(event) {
19
+ if(event.target.closest('.modal')) return;
20
+ document.getElementById('buttonmodal').style.display = 'none';
21
+ });
22
+
23
+ document.addEventListener("keydown", function(event){
24
+ if((event.ctrlKey || event.metaKey) && event.key == "k") {
25
+ element.click()
26
+ }
27
+
28
+ if(event.key == "Escape") {
29
+ document.getElementById('buttonmodal').style.display = 'none';
30
+ document.getElementById('searchInput').focus
31
+ }
32
+ });
33
+
34
+ </script>
@@ -0,0 +1,28 @@
1
+ {% assign has_toc = site.pages | find: "path", "toc.yaml" %}
2
+ <section>
3
+ <div
4
+ class="sidebar-menu z-50 p-5 top-16 bg-white dark:bg-neutral-950 w-full fixed h-full overflow-y-auto md:left-0"
5
+ :class="{ 'hidden': !open }"
6
+ x-cloak>
7
+ <div class="lg:hidden flex justify-end">
8
+ {% include dark_mode_button.liquid %}
9
+ </div>
10
+ {% if has_toc %}
11
+ {{ page.path | toc_yaml }}
12
+ {% endif %}
13
+ </div>
14
+ {% if has_toc %}
15
+ <div
16
+ x-data="$store.sidebarOpen = true"
17
+ :class="Alpine.store('sidebarOpen') ? 'w-full max-w-[25ch]' : 'w-0'"
18
+ class="sidebar-menu z-50 p-5 top-16 bg-white dark:bg-neutral-950 fixed h-full overflow-y-auto md:left-0 border-r border-r-gray-100 dark:border-r-neutral-800 hidden lg:block">
19
+ <div
20
+ @click="$store.sidebarOpen = !$store.sidebarOpen"
21
+ class="cursor-pointer w-5 h-auto absolute top-0 end-0"
22
+ title="recolher barra lateral">
23
+ <button class="arrow left" :class="{left: Alpine.store('sidebarOpen'), right: !Alpine.store('sidebarOpen')}"></button>
24
+ </div>
25
+ <div id="sidebar-links" x-show="Alpine.store('sidebarOpen')" x-collapse>{{ page.path | toc_yaml }}</div>
26
+ </div>
27
+ {% endif %}
28
+ </section>
@@ -0,0 +1,174 @@
1
+ {% capture tocWorkspace %}
2
+ {% comment %}
3
+ Copyright (c) 2017 Vladimir "allejo" Jimenez
4
+ Permission is hereby granted, free of charge, to any person
5
+ obtaining a copy of this software and associated documentation
6
+ files (the "Software"), to deal in the Software without
7
+ restriction, including without limitation the rights to use,
8
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the
10
+ Software is furnished to do so, subject to the following
11
+ conditions:
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
18
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21
+ OTHER DEALINGS IN THE SOFTWARE.
22
+ {% endcomment %}
23
+ {% comment %}
24
+ Version 1.2.0
25
+ https://github.com/allejo/jekyll-toc
26
+ "...like all things liquid - where there's a will, and ~36 hours to spare, there's usually a/some way" ~jaybe
27
+ Usage:
28
+ {% include toc.html html=content sanitize=true class="inline_toc" id="my_toc" h_min=2 h_max=3 %}
29
+ Parameters:
30
+ * html (string) - the HTML of compiled markdown generated by kramdown in Jekyll
31
+ Optional Parameters:
32
+ * sanitize (bool) : false - when set to true, the headers will be stripped of any HTML in the TOC
33
+ * class (string) : '' - a CSS class assigned to the TOC
34
+ * id (string) : '' - an ID to assigned to the TOC
35
+ * h_min (int) : 1 - the minimum TOC header level to use; any header lower than this value will be ignored
36
+ * h_max (int) : 6 - the maximum TOC header level to use; any header greater than this value will be ignored
37
+ * ordered (bool) : false - when set to true, an ordered list will be outputted instead of an unordered list
38
+ * item_class (string) : '' - add custom class(es) for each list item; has support for '%level%' placeholder, which is the current heading level
39
+ * submenu_class (string) : '' - add custom class(es) for each child group of headings; has support for '%level%' placeholder which is the current "submenu" heading level
40
+ * base_url (string) : '' - add a base url to the TOC links for when your TOC is on another page than the actual content
41
+ * anchor_class (string) : '' - add custom class(es) for each anchor element
42
+ * skip_no_ids (bool) : false - skip headers that do not have an `id` attribute
43
+ Output:
44
+ An ordered or unordered list representing the table of contents of a markdown block. This snippet will only
45
+ generate the table of contents and will NOT output the markdown given to it
46
+ {% endcomment %}
47
+
48
+ {% capture newline %}
49
+ {% endcapture %}
50
+ {% assign newline = newline | rstrip %} <!-- Remove the extra spacing but preserve the newline -->
51
+
52
+ {% capture deprecation_warnings %}{% endcapture %}
53
+
54
+ {% if include.baseurl %}
55
+ {% capture deprecation_warnings %}{{ deprecation_warnings }}<!-- jekyll-toc :: "baseurl" has been deprecated, use "base_url" instead -->{{ newline }}{% endcapture %}
56
+ {% endif %}
57
+
58
+ {% if include.skipNoIDs %}
59
+ {% capture deprecation_warnings %}{{ deprecation_warnings }}<!-- jekyll-toc :: "skipNoIDs" has been deprecated, use "skip_no_ids" instead -->{{ newline }}{% endcapture %}
60
+ {% endif %}
61
+
62
+ {% capture jekyll_toc %}{% endcapture %}
63
+ {% assign orderedList = include.ordered | default: false %}
64
+ {% assign baseURL = include.base_url | default: include.baseurl | default: '' %}
65
+ {% assign skipNoIDs = include.skip_no_ids | default: include.skipNoIDs | default: false %}
66
+ {% assign minHeader = include.h_min | default: 1 %}
67
+ {% assign maxHeader = include.h_max | default: 6 %}
68
+ {% assign nodes = include.html | strip | split: '<h' %}
69
+
70
+ {% assign firstHeader = true %}
71
+ {% assign currLevel = 0 %}
72
+ {% assign lastLevel = 0 %}
73
+
74
+ {% capture listModifier %}{% if orderedList %}ol{% else %}ul{% endif %}{% endcapture %}
75
+
76
+ {% for node in nodes %}
77
+ {% if node == "" %}
78
+ {% continue %}
79
+ {% endif %}
80
+
81
+ {% assign currLevel = node | replace: '"', '' | slice: 0, 1 | times: 1 %}
82
+
83
+ {% if currLevel < minHeader or currLevel > maxHeader %}
84
+ {% continue %}
85
+ {% endif %}
86
+
87
+ {% assign _workspace = node | split: '</h' %}
88
+
89
+ {% assign _idWorkspace = _workspace[0] | split: 'id="' %}
90
+ {% assign _idWorkspace = _idWorkspace[1] | split: '"' %}
91
+ {% assign htmlID = _idWorkspace[0] %}
92
+
93
+ {% assign _classWorkspace = _workspace[0] | split: 'class="' %}
94
+ {% assign _classWorkspace = _classWorkspace[1] | split: '"' %}
95
+ {% assign htmlClass = _classWorkspace[0] %}
96
+
97
+ {% if htmlClass contains "no_toc" %}
98
+ {% continue %}
99
+ {% endif %}
100
+
101
+ {% if firstHeader %}
102
+ {% assign minHeader = currLevel %}
103
+ {% endif %}
104
+
105
+ {% capture _hAttrToStrip %}{{ _workspace[0] | split: '>' | first }}>{% endcapture %}
106
+ {% assign header = _workspace[0] | replace: _hAttrToStrip, '' %}
107
+
108
+ {% if include.item_class and include.item_class != blank %}
109
+ {% capture listItemClass %} class="{{ include.item_class | replace: '%level%', currLevel | split: '.' | join: ' ' }}"{% endcapture %}
110
+ {% endif %}
111
+
112
+ {% if include.submenu_class and include.submenu_class != blank %}
113
+ {% assign subMenuLevel = currLevel | minus: 1 %}
114
+ {% capture subMenuClass %} class="{{ include.submenu_class | replace: '%level%', subMenuLevel | split: '.' | join: ' ' }}"{% endcapture %}
115
+ {% endif %}
116
+
117
+ {% capture anchorBody %}{% if include.sanitize %}{{ header | strip_html }}{% else %}{{ header }}{% endif %}{% endcapture %}
118
+
119
+ {% if htmlID %}
120
+ {% capture anchorAttributes %} href="{% if baseURL %}{{ baseURL }}{% endif %}#{{ htmlID }}"{% endcapture %}
121
+
122
+ {% if include.anchor_class %}
123
+ {% capture anchorAttributes %}{{ anchorAttributes }} class="{{ include.anchor_class | split: '.' | join: ' ' }}"{% endcapture %}
124
+ {% endif %}
125
+
126
+ {% capture listItem %}<a{{ anchorAttributes }}>{{ anchorBody }}</a>{% endcapture %}
127
+ {% elsif skipNoIDs == true %}
128
+ {% continue %}
129
+ {% else %}
130
+ {% capture listItem %}{{ anchorBody }}{% endcapture %}
131
+ {% endif %}
132
+
133
+ {% if currLevel > lastLevel %}
134
+ {% capture jekyll_toc %}{{ jekyll_toc }}<{{ listModifier }}{{ subMenuClass }}>{% endcapture %}
135
+ {% elsif currLevel < lastLevel %}
136
+ {% assign repeatCount = lastLevel | minus: currLevel %}
137
+
138
+ {% for i in (1..repeatCount) %}
139
+ {% capture jekyll_toc %}{{ jekyll_toc }}</li></{{ listModifier }}>{% endcapture %}
140
+ {% endfor %}
141
+
142
+ {% capture jekyll_toc %}{{ jekyll_toc }}</li>{% endcapture %}
143
+ {% else %}
144
+ {% capture jekyll_toc %}{{ jekyll_toc }}</li>{% endcapture %}
145
+ {% endif %}
146
+
147
+ {% capture jekyll_toc %}{{ jekyll_toc }}<li{{ listItemClass }}>{{ listItem }}{% endcapture %}
148
+
149
+ {% assign lastLevel = currLevel %}
150
+ {% assign firstHeader = false %}
151
+ {% endfor %}
152
+
153
+ {% assign repeatCount = minHeader | minus: 1 %}
154
+ {% assign repeatCount = lastLevel | minus: repeatCount %}
155
+ {% for i in (1..repeatCount) %}
156
+ {% capture jekyll_toc %}{{ jekyll_toc }}</li></{{ listModifier }}>{% endcapture %}
157
+ {% endfor %}
158
+
159
+ {% if jekyll_toc != '' %}
160
+ {% assign rootAttributes = '' %}
161
+ {% if include.class and include.class != blank %}
162
+ {% capture rootAttributes %} class="{{ include.class | split: '.' | join: ' ' }}"{% endcapture %}
163
+ {% endif %}
164
+
165
+ {% if include.id and include.id != blank %}
166
+ {% capture rootAttributes %}{{ rootAttributes }} id="{{ include.id }}"{% endcapture %}
167
+ {% endif %}
168
+
169
+ {% if rootAttributes %}
170
+ {% assign nodes = jekyll_toc | split: '>' %}
171
+ {% capture jekyll_toc %}<{{ listModifier }}{{ rootAttributes }}>{{ nodes | shift | join: '>' }}>{% endcapture %}
172
+ {% endif %}
173
+ {% endif %}
174
+ {% endcapture %}{% assign tocWorkspace = '' %}{{ deprecation_warnings }}{{ jekyll_toc -}}
@@ -0,0 +1,21 @@
1
+ {% if include.subsection %}
2
+ {% assign tree = include.subsection %}
3
+ {% else %}
4
+ {% assign tree = nav_h %}
5
+ {% endif %}
6
+
7
+ {% for branch in tree %}
8
+ {% if branch.title %}
9
+ <li class="py-1 flex border-l-4 hover:border-neutral-800 justify-between border-neutral-100 dark:border-neutral-900 hover:dark:border-neutral-200 hover:text-black hover:dark:text-white text-neutral-600 dark:text-neutral-400">
10
+ <a class="pl-2 toc-h1 font-medium" href="{{ site.baseurl }}{{ branch.url }}"> {{ branch.title }}</a>
11
+ {% if branch.method %}
12
+ <span class="font-semibold {{ site.data.method-colors[branch.method] }} uppercase text-center text-white h-5 w-12 py-0.5 px-1 rounded-md text-[10px]">{{ branch.method }}</span>
13
+ {% endif %}
14
+ </li>
15
+ {% else %}
16
+ <h2 class="py-2 uppercase text-black dark:text-white font-semibold text-md">{{ branch.section }}</h2>
17
+ <ul class="pl-2 mb-2">
18
+ {% include toc_content.liquid subsection = branch.children %}
19
+ </ul>
20
+ {% endif %}
21
+ {% endfor %}
@@ -0,0 +1,17 @@
1
+ <a href="{{include.app.url}}" class="m-0 no-underline">
2
+ <li class="flex flex-row justify-between rounded-lg my-0 hover:bg-neutral-50 dark:hover:bg-neutral-700 border border-neutral-100 dark:border-neutral-700 bg-white dark:bg-neutral-800 shadow h-32">
3
+ {% if include.app.logo %}
4
+ <img src="{{include.app.logo }}" class="h-16 md:h-20 m-4 md:m-5 self-center">
5
+ {% else %}
6
+ <div class="h-16 md:h-20 aspect-square m-4 md:m-5 rounded-full bg-blue-500 flex-shrink-0 flex justify-center self-center items-center">
7
+ <span class="text-3xl lg:text-4xl text-white dark:text-black">{{include.app.name | truncate: 2, ""}}</span>
8
+ </div>
9
+ {% endif %}
10
+ <div class="w-2/3 flex p-4">
11
+ <div class="flex flex-1 w-full flex-col">
12
+ <p class="mb-1 mt-0 text-md lg:text-lg font-bold text-neutral-900 dark:text-neutral-100">{{include.app.name | capitalize}}</p>
13
+ <p class="text-sm my-0 line-clamp-3 text-neutral-500 dark:text-neutral-300">{{include.app.description}}</p>
14
+ </div>
15
+ </div>
16
+ </li>
17
+ </a>
@@ -0,0 +1,5 @@
1
+ <ul role="list" class="grid grid-cols-1 gap-5 sm:grid-cols-2 md:grid-cols-2 lg:grid-cols-3 px-6">
2
+ {% for app in content.apps %}
3
+ {% include widget.liquid app=app%}
4
+ {% endfor %}
5
+ </ul>
@@ -0,0 +1,100 @@
1
+ <!DOCTYPE html>
2
+ <html lang="{{ site.lang | default: "en-US" }}" class="light">
3
+ <head>
4
+ <meta name="viewport" content="width=device-width, initial-scale=1">
5
+ <meta charset="utf-8">
6
+ <title>{{ page.title }} - {{ site.title }}</title>
7
+ <link rel="stylesheet" href="{{ "/assets/css/application.css" | absolute_url }}">
8
+ <link rel="stylesheet" href="{{ "/assets/css/highlight.css" | absolute_url }}">
9
+ <script type="module" src="{{ "/assets/js/main.js" | absolute_url }}"></script>
10
+ <script src="{{ "/assets/js/highlight_menu.js" | absolute_url }}"></script>
11
+ <script src="https://rawcdn.githack.com/nextapps-de/flexsearch/0.7.31/dist/flexsearch.bundle.js"></script>
12
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/markdown-it/13.0.1/markdown-it.min.js"></script>
13
+
14
+ <script type="module">
15
+ import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
16
+ </script>
17
+ <script defer src="https://cdn.jsdelivr.net/npm/@alpinejs/collapse@3.x.x/dist/cdn.min.js"></script>
18
+ <script src="//unpkg.com/alpinejs" defer></script>
19
+
20
+ {% assign reversed_posts = site.posts | reverse %}
21
+
22
+ {% if reversed_posts %}
23
+ <link rel="next" href="{{site.baseurl}}{{reversed_posts.first.url}}" />
24
+ {% endif %}
25
+
26
+ <script type="text/javascript">
27
+ window.addEventListener('DOMContentLoaded', () => {
28
+
29
+ var firstEl = document.querySelector("#toc .toc-entry a");
30
+ if (firstEl) {
31
+ // document.querySelectorAll(`.toc-ref .title`).forEach( j => { j.textContent = firstEl.textContent } )
32
+ }
33
+ document.querySelectorAll("#toc .toc-entry a").forEach( entry => {
34
+ entry.addEventListener("click", e => {
35
+ document.querySelectorAll("#toc .toc-entry a").forEach( j => { j.className = "" })
36
+ e.target.className = "active";
37
+ document.querySelectorAll(`.toc-ref .title`).forEach( j => { j.textContent = e.target.textContent } )
38
+ });
39
+ });
40
+
41
+ const observer = new IntersectionObserver(entries => {
42
+ entries.every(entry => {
43
+ const id = entry.target.getAttribute('id');
44
+ if (entry.intersectionRatio > 0) {
45
+ let el = document.querySelector(`#toc li a[href="#${id}"]`);
46
+ if (el) {
47
+ document.querySelectorAll(`#toc li a`).forEach( e => e.classList.remove('active') );
48
+ el.classList.add('active');
49
+ document.querySelectorAll(`.toc-ref .title`).forEach( e => e.innerHTML = entry.target.textContent );
50
+ return false;
51
+ }
52
+ return true;
53
+ }
54
+ });
55
+ });
56
+
57
+ // Track all sections that have an `id` applied
58
+ document.querySelectorAll('h1[id],h2[id],h3[id],h4[id],h5[id]').forEach((section) => {
59
+ observer.observe(section);
60
+ });
61
+
62
+ });
63
+ </script>
64
+ </head>
65
+ <body class="dark:bg-black">
66
+ <div class="relative bg-white dark:bg-neutral-950 ml-auto mr-auto">
67
+ {%- include header.html -%}
68
+ {% assign has_toc = site.pages | find: "path", "toc.yaml" %}
69
+ {% if has_toc %}
70
+ {% assign left_margin = 'lg:ml-[25ch]' %}
71
+ {% endif %}
72
+ {% if page.toc %}
73
+ {% assign right_margin = 'md:mr-[22ch]' %}
74
+ {% endif %}
75
+ <div x-data :class="{'lg:ml-[2ch]': !$store.sidebarOpen, 'lg:ml-[25ch]': $store.sidebarOpen }" class="{{ left_margin }} {{right_margin}} ">
76
+ <article class="antialiased prose max-w-[120ch] ml-auto mr-auto px-10 mb-10 dark:prose-invert prose-headings:font-semibold prose-code:text-gray-500 prose-pre:bg-neutral-800">
77
+ {{ content }}
78
+ {% if reversed_posts %}
79
+ <a href="{{site.baseurl}}{{reversed_posts.first.url}}" class="navigation navigation-next navigation-unique" aria-label="Next page: {{reversed_posts.first.title}}">
80
+ <i class="fa fa-angle-right"></i>
81
+ </a>
82
+ {% endif %}
83
+ {{ page.url | navigation }}
84
+ </article>
85
+ </div>
86
+ <div x-data="{scrollBackTop: false}" x-cloak>
87
+ <button
88
+ x-show="scrollBackTop"
89
+ x-on:scroll.document="scrollBackTop = (document.documentElement.scrollTop > 500) ? true : false"
90
+ @click="window.scrollTo({top: 0, behavior: 'smooth'})"
91
+ aria-label="Back to top"
92
+ class="fixed w-10 h-10 rounded-full z-50 bottom-0 right-0 p-2 mx-5 my-5 dark:bg-gray-500 text-white bg-gray-200 hover:bg-gray-700 dark:hover:bg-slate-300 focus:outline-none">
93
+ <i class="arrow up"></i>
94
+ </button>
95
+ </div>
96
+ {%- include footer.html -%}
97
+ </div>
98
+ {% include search_modal.liquid %}
99
+ </body>
100
+ </html>
@@ -0,0 +1,5 @@
1
+ ---
2
+ layout: default
3
+ ---
4
+
5
+ {{ content }}
@@ -0,0 +1,5 @@
1
+ ---
2
+ layout: default
3
+ ---
4
+
5
+ {{ content }}
@@ -0,0 +1,51 @@
1
+ class AuthorizationParser
2
+ def self.parse(api)
3
+ new.parse(api)
4
+ end
5
+
6
+ def parse(api)
7
+ return if api.dig('components', 'securitySchemes').nil?
8
+
9
+ array = []
10
+ security_schemes = api['components']['securitySchemes']
11
+ security_schemes.each do |k, v|
12
+ obj = {'items' => {}}
13
+ obj['Title'] = k
14
+ obj['Type'] = v['type']
15
+ obj['Description'] = v['description'] if v['description']
16
+ case v['type']
17
+ when 'apiKey'
18
+ obj['items']['Name'] = v['name']
19
+ obj['items']['In'] = v['in']
20
+ when 'http'
21
+ obj['items']['HTTP'] = v['bearerFormat'] if v['bearerFormat']
22
+ obj['items']['HTTP Authorization Scheme'] = v['scheme']
23
+ when 'mutualTLS'
24
+ puts "\n\nmutualTLS security scheme parser not implemented yet\n\n"
25
+ when 'oauth2' then oauth2_parser(v, obj)
26
+ when 'openIdConnect'
27
+ puts "\n\nopenIdConnect security scheme parser not implemented yet\n\n"
28
+ end
29
+ array << obj
30
+ end
31
+ array
32
+ end
33
+
34
+ def oauth2_parser(scheme, obj)
35
+ scheme['flows'].each do |flow, flow_object|
36
+ obj['items']['Flow type'] = flow
37
+ obj['items']['Authorization URL'] = flow_object['authorizationUrl'] if flow_object['authorizationUrl']
38
+ obj['items']['Token URL'] = flow_object['tokenUrl'] if flow_object['tokenUrl']
39
+ obj['items']['Refresh URL'] = flow_object['refreshUrl'] if flow_object['refreshUrl']
40
+ obj['items']['Scopes'] = oauth2_scopes(flow_object['scopes'])
41
+ end
42
+ end
43
+
44
+ def oauth2_scopes(scopes)
45
+ result = "<ul>\n"
46
+ scopes.map do |scope, description|
47
+ result += "<li>#{scope} - #{description}</li>\n"
48
+ end
49
+ result += "</ul>\n"
50
+ end
51
+ end
@@ -0,0 +1,24 @@
1
+ module Jekyll
2
+ module Converters
3
+ class ButtonProcessor < Converter
4
+ safe true
5
+ priority :low
6
+
7
+ def matches(ext)
8
+ ext =~ /md/i
9
+ end
10
+
11
+ def output_ext(_ext)
12
+ ".html"
13
+ end
14
+
15
+ def convert(content)
16
+ content.gsub(/\$button\[(.*?)\]\[(.*?)\]\$/) do
17
+ button_text = Regexp.last_match(1)
18
+ tailwind_class = Regexp.last_match(2)
19
+ "<button class=\"rounded-md m-0 py-1 px-2 text-center text-sm font-semibold text-white shadow-sm #{tailwind_class}\">#{button_text}</button>"
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,48 @@
1
+ module Jekyll
2
+ module CheckRequiredFilter
3
+ def check_required(input, type = "request_body")
4
+ case type
5
+ when 'request_body' then schema = input.dig('content', 'application/json', 'schema')
6
+ when 'response' then schema = input[1].dig('content', 'application/json', 'schema')
7
+ end
8
+ return if schema.nil?
9
+
10
+ inject_required(schema, schema['required'] || [])
11
+ return
12
+ end
13
+
14
+ private
15
+
16
+ def inject_required(schema, requires = [])
17
+ properties = if schema['type'] == 'array'
18
+ schema['items']['anyOf'] ? [] : schema['items']['properties']
19
+ else
20
+ schema['properties']
21
+ end
22
+ if schema['allOf']
23
+ schema['allOf'].each do |item|
24
+ inject_required(item, requires)
25
+ end
26
+ end
27
+ requires |= schema['required'] if schema['required'].is_a?(Array)
28
+ while requires.is_a?(Array) && requires.any? do
29
+ key = requires.pop
30
+ next if properties&.dig(key).nil?
31
+
32
+ properties[key]['item_required'] = true
33
+ end
34
+
35
+ if !properties.nil? && properties.any?
36
+ properties.each do |key, value|
37
+ if value['type'] == 'object'
38
+ inject_required(value, value['required'])
39
+ elsif value['type'] == 'array'
40
+ inject_required(value, value['items']['required'])
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ Liquid::Template.register_filter(Jekyll::CheckRequiredFilter)