Skip to content

Commit 6f620fa

Browse files
committed
docs: add profile registration template, site pages, example profile
1 parent 170b579 commit 6f620fa

21 files changed

+1127
-98
lines changed

_config.yml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,21 @@ whitelist:
1313
- jekyll-sitemap
1414
- jekyll-feed
1515
- jekyll-seo-tag
16-
- jekyll-gist
1716
- jemoji
1817
incremental: false
1918
gist:
2019
noscript: false
20+
2121
# customize github pages
2222
quiet: false
2323
markdown: kramdown
2424
highlighter: rouge
2525
kramdown:
2626
input: GFM
2727
hard_wrap: false
28-
auto_ids: false
28+
auto_ids: true
29+
auto_id_prefix: auto-id-
30+
auto_id_stripping: true
2931
template: '' # cannot customize
3032
math_engine: mathjax # cannot customize
3133
syntax_highligher: rouge # cannot customize
@@ -48,6 +50,9 @@ port: 9876
4850
collections:
4951
format:
5052
output: true
53+
profiles:
54+
output: true
55+
permalink: /:collection/:path
5156

5257
defaults:
5358
- scope:
@@ -57,6 +62,20 @@ defaults:
5762
layout: page
5863
show_sidebar: true
5964
is_spec_page: true
65+
- scope:
66+
path: ""
67+
type: "profiles"
68+
values:
69+
layout: profile_error
70+
is_spec_page: false
71+
show_sidebar: false
72+
- scope:
73+
path: "*/*/*/index.md"
74+
type: "profiles"
75+
values:
76+
layout: profile
77+
is_spec_page: false
78+
show_sidebar: true
6079

6180
latest_version: 1.0
6281
excerpt_separator: ""
@@ -84,3 +103,12 @@ quicklinks:
84103
url: /format/
85104
- title: Contribute on GitHub
86105
url: https://github.com/json-api/json-api
106+
107+
profile_categories:
108+
- Pagination
109+
# these are some other potential categories.
110+
# Uncomment them if you're adding a profile in one of these categories.
111+
# - Filtering
112+
# - Actions/Hypermedia
113+
# - Data Modeling
114+
# - Deep Querying

_format/1.1/index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2222,6 +2222,11 @@ supported as well.
22222222
3. alter the JSON structure of any concept defined in this specification,
22232223
including to allow a superset of JSON structures.
22242224

2225+
2226+
> If you create your own profile, you are **strongly encouraged to [register](/extensions/#profile-registration)
2227+
> it** with the JSON API [profile registry](/extensions/), so that others can
2228+
> find and reuse it.
2229+
22252230
#### <a href="#profiles-updating" id="profiles-updating" class="headerlink"></a> Revising a Profile
22262231

22272232
Profiles **MAY** be revised over time, e.g., to add new capabilities. However,

_includes/global_head_assets.html

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<meta charset="utf-8">
2+
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
3+
<meta name="viewport" content="width=device-width, initial-scale=1">
4+
<link href="/stylesheets/normalize.css" rel="stylesheet" type="text/css" />
5+
<link href="/stylesheets/all.css" rel="stylesheet" type="text/css" />
6+
<link href="/stylesheets/print.css" media="print" rel="stylesheet" type="text/css" />
7+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
8+
<script src="/javascripts/all.js" type="text/javascript"></script>
9+
<script src="/javascripts/highlight.pack.js"></script>
10+
<script>hljs.configure({classPrefix: ''}); hljs.initHighlightingOnLoad();</script>
11+
12+
<link rel="apple-touch-icon" sizes="57x57" href="/alt-favicons/apple-touch-icon-57x57.png">
13+
<link rel="apple-touch-icon" sizes="60x60" href="/alt-favicons/apple-touch-icon-60x60.png">
14+
<link rel="apple-touch-icon" sizes="72x72" href="/alt-favicons/apple-touch-icon-72x72.png">
15+
<link rel="apple-touch-icon" sizes="76x76" href="/alt-favicons/apple-touch-icon-76x76.png">
16+
<link rel="apple-touch-icon" sizes="114x114" href="/alt-favicons/apple-touch-icon-114x114.png">
17+
<link rel="apple-touch-icon" sizes="120x120" href="/alt-favicons/apple-touch-icon-120x120.png">
18+
<link rel="apple-touch-icon" sizes="144x144" href="/alt-favicons/apple-touch-icon-144x144.png">
19+
<link rel="apple-touch-icon" sizes="152x152" href="/alt-favicons/apple-touch-icon-152x152.png">
20+
<link rel="apple-touch-icon" sizes="180x180" href="/alt-favicons/apple-touch-icon-180x180.png">
21+
<link rel="icon" type="image/png" href="/alt-favicons/favicon-32x32.png" sizes="32x32">
22+
<link rel="icon" type="image/png" href="/alt-favicons/favicon-194x194.png" sizes="194x194">
23+
<link rel="icon" type="image/png" href="/alt-favicons/favicon-96x96.png" sizes="96x96">
24+
<link rel="icon" type="image/png" href="/alt-favicons/android-chrome-192x192.png" sizes="192x192">
25+
<link rel="icon" type="image/png" href="/alt-favicons/favicon-16x16.png" sizes="16x16">
26+
<link rel="manifest" href="/alt-favicons/manifest.json">
27+
<link rel="mask-icon" href="/alt-favicons/safari-pinned-tab.svg" color="#0b4e22">
28+
<link rel="shortcut icon" href="/favicon.ico">
29+
<meta name="msapplication-TileColor" content="#da532c">
30+
<meta name="msapplication-TileImage" content="/alt-favicons/mstile-144x144.png">
31+
<meta name="msapplication-config" content="/alt-favicons/browserconfig.xml">
32+
<meta name="theme-color" content="#0b4e22">

_includes/global_html_footer.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<footer>
2+
<div class="site-wrapper">
3+
<span>Built with <a href="https://jekyllrb.com/">Jekyll</a> and <a href="http://softwaremaniacs.org/soft/highlight/en/">Highlight.js</a></span>
4+
<span class="license">
5+
<a rel="license" href="https://creativecommons.org/publicdomain/zero/1.0/"><img src="https://licensebuttons.net/p/zero/1.0/88x31.png" style="border- style: none;" alt="CC0" /></a>
6+
</span>
7+
<span class="social-links">
8+
<a class="twitter" href="https://twitter.com/jsonapi"><i class="icon-twitter"></i><span>Twitter</span></a>
9+
<a class="github" href="https://github.com/json-api"><i class="icon-github"></i><span>GitHub</span></a>
10+
<a class="forum" href="https://discuss.jsonapi.org"><i class="icon-forum"></i><span>Discussion Forum</span></a>
11+
</span>
12+
</div>
13+
</footer>
14+
<script>
15+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
16+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
17+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
18+
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
19+
20+
ga('create', 'UA-40609539-1', 'jsonapi.org');
21+
ga('send', 'pageview');
22+
23+
</script>

_includes/header_offset_2.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{% comment %}
2+
When we embed the markdown from a user-provided profile specification
3+
inside the profile layout, we need to increment each heading level by 2.
4+
Kramdown, our markdown parser, provides a `header_offset` option, but
5+
Jekyll only allows us to set that globally -- and setting it globally
6+
to two would break our other pages. So, this include lets us take arbitrary
7+
HTML (from rendered markdown) and does some liquid string replacements
8+
to offset its headings. This is pretty janky (even more so because liquid
9+
only allows us to do literal string replacement, not regex replacement),
10+
but I think it *should* work robustly, thanks to the fact that angle
11+
brackets (i.e., `<` and `>`) aren't supposed to appear in HTML unencoded,
12+
and I imagine Kramdown respects that.
13+
{% endcomment %}
14+
{{ include.content
15+
| replace: "<h5", "<h6x"
16+
| replace: "<h4", "<h6x"
17+
| replace: "<h3", "<h5x"
18+
| replace: "<h2", "<h4x"
19+
| replace: "<h1", "<h3x"
20+
| replace: "</h1>", "</h3x>"
21+
| replace: "</h2>", "</h4x>"
22+
| replace: "</h3>", "</h5x>"
23+
| replace: "</h4>", "</h6x>"
24+
| replace: "</h5>", "</h6x>"
25+
| replace: "<h3x", "<h3"
26+
| replace: "<h4x", "<h4"
27+
| replace: "<h5x", "<h5"
28+
| replace: "<h6x", "<h6"
29+
| replace: "</h3x>", "</h3>"
30+
| replace: "</h4x>", "</h4>"
31+
| replace: "</h5x>", "</h5>"
32+
| replace: "</h6x>", "</h6>"
33+
}}

_includes/profile_url.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{% comment %}
2+
Takes the page object for a JSON:API profile spec and returns its url.
3+
This file can't have whitespace outside this comment block or else the
4+
output will be corrupted.
5+
{% endcomment %}{{ include.page.url | absolute_url | split: "/" | where_exp: "item", "item != 'index'" | join: "/" }}/

_includes/site_navigation.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<nav class="site-nav">
2+
<div class="nav-inner">
3+
<ul>
4+
{% assign url = page.url|remove:'index.html' %}
5+
{% for link in site.navigation %}
6+
<li {% if url == link.url or url contains "/profiles/" and link.url contains "/extensions" %}class="active"{% endif %}><a href="{{link.url}}" title="{{link.title}}">{{link.title}}</a></li>
7+
{% endfor %}
8+
<li class="version">
9+
<a href="/format/#status" class="pill">v{{ site.latest_version }} <span class="stable">Stable</span></a>
10+
</li>
11+
</ul>
12+
</div>
13+
</nav>

_layouts/page.html

Lines changed: 9 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<!doctype html>
22
<html>
33
<head>
4-
<meta charset="utf-8">
5-
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
6-
<meta name="viewport" content="width=device-width, initial-scale=1">
4+
{% include global_head_assets.html %}
75

86
{% comment %}
97
Below, we're either dealing with a generic page or a page from the
@@ -20,57 +18,15 @@
2018
{% else %}
2119
{% assign page_title = page.title %}
2220
{% endif %}
23-
<title>JSON API &mdash; {{page_title|strip }}</title>
24-
25-
<link href="/stylesheets/normalize.css" rel="stylesheet" type="text/css" />
26-
<link href="/stylesheets/all.css" rel="stylesheet" type="text/css" />
27-
<link href="/stylesheets/print.css" media="print" rel="stylesheet" type="text/css" />
28-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
29-
<script src="/javascripts/all.js" type="text/javascript"></script>
30-
<script src="/javascripts/highlight.pack.js"></script>
31-
<script>hljs.configure({classPrefix: ''}); hljs.initHighlightingOnLoad();</script>
32-
33-
<link rel="apple-touch-icon" sizes="57x57" href="/alt-favicons/apple-touch-icon-57x57.png">
34-
<link rel="apple-touch-icon" sizes="60x60" href="/alt-favicons/apple-touch-icon-60x60.png">
35-
<link rel="apple-touch-icon" sizes="72x72" href="/alt-favicons/apple-touch-icon-72x72.png">
36-
<link rel="apple-touch-icon" sizes="76x76" href="/alt-favicons/apple-touch-icon-76x76.png">
37-
<link rel="apple-touch-icon" sizes="114x114" href="/alt-favicons/apple-touch-icon-114x114.png">
38-
<link rel="apple-touch-icon" sizes="120x120" href="/alt-favicons/apple-touch-icon-120x120.png">
39-
<link rel="apple-touch-icon" sizes="144x144" href="/alt-favicons/apple-touch-icon-144x144.png">
40-
<link rel="apple-touch-icon" sizes="152x152" href="/alt-favicons/apple-touch-icon-152x152.png">
41-
<link rel="apple-touch-icon" sizes="180x180" href="/alt-favicons/apple-touch-icon-180x180.png">
42-
<link rel="icon" type="image/png" href="/alt-favicons/favicon-32x32.png" sizes="32x32">
43-
<link rel="icon" type="image/png" href="/alt-favicons/favicon-194x194.png" sizes="194x194">
44-
<link rel="icon" type="image/png" href="/alt-favicons/favicon-96x96.png" sizes="96x96">
45-
<link rel="icon" type="image/png" href="/alt-favicons/android-chrome-192x192.png" sizes="192x192">
46-
<link rel="icon" type="image/png" href="/alt-favicons/favicon-16x16.png" sizes="16x16">
47-
<link rel="manifest" href="/alt-favicons/manifest.json">
48-
<link rel="mask-icon" href="/alt-favicons/safari-pinned-tab.svg" color="#0b4e22">
49-
<link rel="shortcut icon" href="/favicon.ico">
50-
<meta name="msapplication-TileColor" content="#da532c">
51-
<meta name="msapplication-TileImage" content="/alt-favicons/mstile-144x144.png">
52-
<meta name="msapplication-config" content="/alt-favicons/browserconfig.xml">
53-
<meta name="theme-color" content="#0b4e22">
21+
<title>JSON API &mdash; {{ page_title|strip }}</title>
5422
</head>
5523

5624
<body>
57-
<nav class="site-nav">
58-
<div class="nav-inner">
59-
<ul>
60-
{% assign url = page.url|remove:'index.html' %}
61-
{% for link in site.navigation %}
62-
<li {% if url == link.url %}class="active"{% endif %}><a href="{{link.url}}" title="{{link.title}}">{{link.title}}</a></li>
63-
{% endfor %}
64-
<li class="version">
65-
<a href="/format/#status" class="pill">v{{ site.latest_version }} <span class="stable">Stable</span></a>
66-
</li>
67-
</ul>
68-
</div>
69-
</nav>
25+
{% include site_navigation.html %}
7026
{% if page.show_masthead %}
7127
<header>
7228
<div class="content">
73-
<h1>JSON API</h1>
29+
<h1 id="json-api">JSON API</h1>
7430
<h2>A specification for building APIs in JSON</h2>
7531
<div class="quicklinks">
7632
{% for link in site.quicklinks %}
@@ -103,7 +59,8 @@ <h2>A specification for building APIs in JSON</h2>
10359
Upcoming Version (v{{ site.latest_version|plus:0.1 }})
10460
</option>
10561
<optgroup label="Old Versions/Permalinks">
106-
{% for spec_draft in site.format|sort:'version' %}
62+
{% assign sorted_formats = site.format|sort:'version' %}
63+
{% for spec_draft in sorted_formats %}
10764
{% if spec_draft.version and spec_draft.path contains 'index' %}
10865
<option value="/format/{{spec_draft.version}}"
10966
{% if page.version == spec_draft.version %}selected{% endif%}
@@ -121,7 +78,7 @@ <h1 class="sidebar-top">{{ page_title }}</h1>
12178
</nav>
12279
</div>
12380
{% endif %}
124-
<div class="content">
81+
<main class="content">
12582
{% unless page.show_masthead %}
12683
<h1>
12784
{{ page_title }}
@@ -136,31 +93,9 @@ <h1>
13693
{% endif %}
13794
{{ content }}
13895
</section>
139-
</div>
96+
</main>
14097
</div>
141-
<footer>
142-
<div class="site-wrapper">
143-
<span>Built with <a href="https://jekyllrb.com/">Jekyll</a> and <a href="http://softwaremaniacs.org/soft/highlight/en/">Highlight.js</a></span>
144-
<span class="license">
145-
<a rel="license" href="https://creativecommons.org/publicdomain/zero/1.0/"><img src="https://licensebuttons.net/p/zero/1.0/88x31.png" style="border- style: none;" alt="CC0" /></a>
146-
</span>
147-
<span class="social-links">
148-
<a class="twitter" href="https://twitter.com/jsonapi"><i class="icon-twitter"></i><span>Twitter</span></a>
149-
<a class="github" href="https://github.com/json-api"><i class="icon-github"></i><span>GitHub</span></a>
150-
<a class="forum" href="https://discuss.jsonapi.org"><i class="icon-forum"></i><span>Discussion Forum</span></a>
151-
</span>
152-
</div>
153-
</footer>
154-
<script>
155-
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
156-
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
157-
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
158-
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
159-
160-
ga('create', 'UA-40609539-1', 'jsonapi.org');
161-
ga('send', 'pageview');
162-
163-
</script>
98+
{% include global_html_footer.html %}
16499
</body>
165100

166101
</html>

_layouts/profile.html

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
{% include global_head_assets.html %}
5+
{% capture page_title %}&ldquo;{{ page.name | smartify }}&rdquo; Profile{% endcapture %}
6+
<title>JSON API &mdash; {{ page_title|strip }}</title>
7+
</head>
8+
9+
<body>
10+
{% include site_navigation.html %}
11+
<div class="site-wrapper">
12+
<div class="sidebar">
13+
<nav class="document-outline" id="document-outline">
14+
<h1 class="sidebar-top">{{ page.name }}</h1>
15+
</nav>
16+
</div>
17+
<main class="content profile-page">
18+
<h1>
19+
{{ page_title }}
20+
</h1>
21+
<section>
22+
<h2><a href="#profile-intro" id="profile-intro" class="headerlink"></a>Introduction</h2>
23+
<p>This is the specification of <a href="http://jsonapi.org/format/1.1/#profiles">a profile</a> for the JSON:API specification.</p>
24+
<p>The url for this profile is <code>{% include profile_url.md page=page %}</code>.</p>
25+
26+
{% capture extended_description_markdown %}
27+
{{ page.extended_description | markdownify }}
28+
{% endcapture %}
29+
{% include header_offset_2.md content=extended_description_markdown %}
30+
</section>
31+
{% if page.minimum_jsonapi_version > 1.0 %}
32+
<section>
33+
<h2>
34+
<a href="#profile-jsonapi-req" id="profile-jsonapi-req" class="headerlink"></a>
35+
Minimum JSON:API Version
36+
</h2>
37+
38+
<p>This profile requires at least JSON:API version {{ page.minimum_jsonapi_version }}.</p>
39+
{% capture minimum_version_markdown %}
40+
{{ page.minimum_jsonapi_version_explanation | markdownify }}
41+
{% endcapture %}
42+
{% include header_offset_2.md content=minimum_version_markdown %}
43+
</section>
44+
{% endif %}
45+
<section id="profile-spec-container">
46+
<h2><a href="#profile-spec" id="profile-spec" class="headerlink"></a>Specification</h2>
47+
{% include header_offset_2.md content=content %}
48+
</section>
49+
<section>
50+
<h2><a href="#profile-contact" id="profile-contact" class="headerlink"></a>Contact the Author</h2>
51+
{% if page.discussion_url %}
52+
<p>To discuss or ask questions about this extension, visit
53+
<a href="{{ page.discussion_url }}">{{ page.discussion_url }}</a>.</p>
54+
<p>You can also contact the author directly:</p>
55+
{% endif %}
56+
<address>
57+
{{ page.author_name }}<br/>
58+
<a href="mailto:{{ page.author_email }}">{{ page.author_email }}</a><br/>
59+
{% if page.author_website %}
60+
<a href="{{ page.author_website }}">{{ page.author_website }}</a><br/>
61+
{% endif %}
62+
{% if page.author_phone %}
63+
<a href="tel:{{ page.author_phone }}">{{ page.author_phone }}</a><br/>
64+
{% endif %}
65+
</address>
66+
</section>
67+
</main>
68+
</div>
69+
{% include global_html_footer.html %}
70+
</body>
71+
</html>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy