Skip to content

Commit

Permalink
Merge branch 'main' into fuse_search
Browse files Browse the repository at this point in the history
  • Loading branch information
suprith-hub authored Jun 30, 2024
2 parents 2ac69bb + 65da160 commit ab0fecb
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 29 deletions.
7 changes: 7 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ the top-level of the project:
make
```

Contributors
------------

<a href="https://github.com/intelligence-ai/learnjsonschema.com/graphs/contributors">
<img src="https://contrib.rocks/image?repo=intelligence-ai/learnjsonschema.com" />
</a>

License
-------

Expand Down
35 changes: 35 additions & 0 deletions assets/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,39 @@ document.addEventListener("DOMContentLoaded", () => {
}
});
});

const vocabularyTab = document.getElementById('sidebar-grouping-vocabulary');
const alphabeticTab = document.getElementById('sidebar-grouping-alphabetic');
const vocabularyContent = document.getElementById('vocabulary');
const alphabeticContent = document.getElementById('alphabetic');

function setSidebarGrouping(sidebarGrouping) {
if (sidebarGrouping === 'alphabetic') {
vocabularyTab.classList.remove('active');
alphabeticTab.classList.add('active');
vocabularyContent.classList.remove('show', 'active');
vocabularyContent.classList.add('d-none');
alphabeticContent.classList.add('show', 'active');
alphabeticContent.classList.remove('d-none');
} else {
alphabeticTab.classList.remove('active');
vocabularyTab.classList.add('active');
alphabeticContent.classList.remove('show', 'active');
alphabeticContent.classList.add('d-none');
vocabularyContent.classList.add('show', 'active');
vocabularyContent.classList.remove('d-none');
}
}

const sidebarGrouping = localStorage.getItem('sidebarGrouping');
setSidebarGrouping(sidebarGrouping);

vocabularyTab.addEventListener('click', function () {
localStorage.setItem('sidebarGrouping', 'vocabulary');
setSidebarGrouping('vocabulary');
});

alphabeticTab.addEventListener('click', function () {
localStorage.setItem('sidebarGrouping', 'alphabetic');
setSidebarGrouping('alphabetic');
});
5 changes: 5 additions & 0 deletions assets/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ $danger: rgba(255, 213, 213, 1);
$navbar-brand-font-size: 1.1rem;
$navbar-padding-y: 1px;
$alert-border-radius: 0;
$nav-link-padding-y: 0.5rem;

// Follow browser's preferred theme
$color-mode-type: media-query;
Expand Down Expand Up @@ -83,6 +84,10 @@ details summary::-webkit-details-marker {
min-width: 260px;
}

#sidebar-nav-pills {
font-size: $font-size-sm * 0.75;
}

// Tables with vertical headers collapse the headers by default
table tr > th[scope="row"] {
width: 1px;
Expand Down
2 changes: 1 addition & 1 deletion content/2020-12/format-annotation/format.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ The `format` keyword in JSON Schema's Format Annotation vocabulary serves to pro

When using `format` from Format Annotation, it's recommended that you provide your validation rules alongside the `format`. The implementation may choose to treat `format` as an assertion and attempt to validate the value's conformance to the specified semantics. However, this behavior must be explicitly enabled and is typically disabled by default. Implementations should document their level of support for such validation.

* `It allows for the semantic identification of certain kinds of string values. For instance, it can indicate that a string value should be interpreted as a date, email, URI, etc.
* It allows for the semantic identification of certain kinds of string values. For instance, it can indicate that a string value should be interpreted as a date, email, URI, etc.
* `format` is solely an annotation and does not enforce any validation. It's meant to provide information about the expected format of the string.
* Implementations may choose to enable format as an assertion, meaning that validation fails if the value doesn't conform to the specified format semantics. However, this is not mandatory and must be explicitly enabled.
* While users can define and use their own custom `formats` (e.g., "format": "foobar"), it's recommended to refrain from overloading the format keyword for future compatibility reasons. Instead, define custom keywords for specific validation requirements. For example in the event that you define your own "foobar" and JSON Schema subsequently chooses to define "foobar," you may encounter difficulties.
Expand Down
87 changes: 59 additions & 28 deletions layouts/partials/sidebar.html
Original file line number Diff line number Diff line change
@@ -1,41 +1,72 @@
<aside id="sidebar" class="border-end position-relative d-none d-xl-block">

<div class="px-4 py-2">
<ul class="nav nav-tabs nav-fill mt-1" id="sidebar-nav-pills">
<li class="nav-item">
<a class="nav-link active" id="sidebar-grouping-vocabulary" data-bs-toggle="pill" href="#">
By Vocabulary
</a>
</li>
<li class="nav-item">
<a class="nav-link" id="sidebar-grouping-alphabetic" data-bs-toggle="pill" href="#">
Alphabetically
</a>
</li>
</ul>
{{ $selected_dialect := index (split .RelPermalink "/") 1 }}
{{ range .Site.Sections }}
{{ $dialect := .Title }}
{{ if eq $selected_dialect $dialect }}
{{ $dialectURL := $dialect | printf "/%s" }}
<ul class="nav flex-column text-nowrap mb-4">
{{ range sort .Sections "Params.index" "asc" }}
<li class="nav-item">
{{ $vocabulary := .Title }}
{{ $vocabularyURL := (replace $vocabulary " " "-") | lower | printf "%s/%s" $dialectURL }}
<details open>
<summary class="ps-0 nav-link text-body">
<i class="bi bi-chevron-down"></i>
<a class="text-body fw-bold" href="{{ ref $ $vocabularyURL }}">{{ $vocabulary }}</a>
</summary>
<ul class="list-unstyled ms-3">
{{ range sort $.Site.RegularPages "Params.index" "asc" }}
{{ if eq .Section $dialect }}
{{ if eq .Parent.Title $vocabulary }}
{{ $keywordURL := (replace .Params.keyword "$" "") | printf "%s/%s" $vocabularyURL }}
<li>
{{ if eq $.Permalink .Permalink }}
<a class="fw-bold text-decoration-none font-monospace active" href="{{ ref $ $keywordURL }}" aria-current="true">{{ .Params.keyword }}</a>
{{ else }}
<a class="text-muted text-decoration-none font-monospace" href="{{ ref $ $keywordURL }}">{{ .Params.keyword }}</a>
{{ end }}
</li>
<div class="tab-pane fade d-none show active" id="vocabulary">
<ul class="nav flex-column text-nowrap mb-4">
{{ range sort .Sections "Params.index" "asc" }}
<li class="nav-item">
{{ $vocabulary := .Title }}
{{ $vocabularyURL := (replace $vocabulary " " "-") | lower | printf "%s/%s" $dialectURL }}
<details open>
<summary class="ps-0 nav-link text-body">
<i class="bi bi-chevron-down"></i>
<a class="text-body fw-bold" href="{{ ref $ $vocabularyURL }}">{{ $vocabulary }}</a>
</summary>
<ul class="list-unstyled ms-3">
{{ range sort $.Site.RegularPages "Params.index" "asc" }}
{{ if eq .Section $dialect }}
{{ if eq .Parent.Title $vocabulary }}
{{ $keywordURL := (replace .Params.keyword "$" "") | printf "%s/%s" $vocabularyURL }}
<li>
{{ if eq $.Permalink .Permalink }}
<a class="fw-bold text-decoration-none font-monospace active" href="{{ ref $ $keywordURL }}" aria-current="true">{{ .Params.keyword }}</a>
{{ else }}
<a class="text-muted text-decoration-none font-monospace" href="{{ ref $ $keywordURL }}">{{ .Params.keyword }}</a>
{{ end }}
</li>
{{ end }}
{{ end }}
{{ end }}
</ul>
</details>
</li>
{{ end }}
</ul>
</div>
<div class="tab-pane d-none fade" id="alphabetic">
<ul class="list-unstyled ms-3 pt-2">
{{ range sort $.Site.RegularPages "Params.keyword" "asc" }}
{{ if eq .Section $dialect }}
{{ $vocabulary := .Parent.Title }}
{{ $vocabularyURL := (replace $vocabulary " " "-") | lower | printf "%s/%s" $dialectURL }}
{{ $keywordURL := (replace .Params.keyword "$" "") | printf "%s/%s" $vocabularyURL }}
<li>
{{ if eq $.Permalink .Permalink }}
<a class="fw-bold text-decoration-none font-monospace active" href="{{ ref $ $keywordURL }}" aria-current="true">{{ .Params.keyword }}</a>
{{ else }}
<a class="text-muted text-decoration-none font-monospace" href="{{ ref $ $keywordURL }}">{{ .Params.keyword }}</a>
{{ end }}
</ul>
</details>
</li>
{{ end }}
</ul>
</li>
{{ end }}
{{ end }}
</ul>
</div>
{{ end }}
{{ end }}
</div>
Expand Down

0 comments on commit ab0fecb

Please sign in to comment.