-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
97 lines (96 loc) · 2.69 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.1.8/semantic.min.css">
<link rel="stylesheet" type="text/css" href="jsonld-markup.css">
<style>
body { padding: 1em; }
.logo { margin-bottom: 3px; }
.code.column { background-color: rgb(51,51,51); color: white }
</style>
<title>jsonld-markup example</title>
</head>
<body>
<div class="ui middle aligned two column grid">
<div class="column">
<h4 class="ui header">
JSON-LD Markup Prettifier
</h4>
</div>
<div class="right aligned column">
from your friends at
<a href="http://science.ai/" target="_blank">
<img class="ui tiny inline image logo" src="http://science.ai/images/scienceai_logo_v1.1.1_logo.svg" alt="science.ai logo">
</a>
</div>
</div>
<div class="ui two column doubling stackable grid">
<div class="code column">
<h3 class="ui inverted header">Primary Context</h3>
<pre><code id="context">
{
"@context": {
"@base": "http://example.com/",
"@vocab": "http://schema.org/",
"id": "@id",
"sa": "http://ns.science.ai#",
"sameAs": {
"@container": "@set"
},
"founder": {
"@id": "http://schema.org/founder",
"@type": "@id",
"@container": "@list"
},
"ContributorRole": "sa:ContributorRole"
}
}
</code></pre>
</div>
<div class="code column">
<h3 class="ui inverted header">JSON-LD Document</h3>
<pre><code id="code">
{
"@context": "http://example.com/context",
"@id": "http://example.com",
"@type": "Person",
"sameAs": [
"http://twitter.com/me",
"http://facebook.com/me"
],
"version": null,
"affiliation": {
"id": "sa:corporation",
"@type": "Corporation",
"name": "Ld inc",
"address": {
"@type": "PostalAddress",
"sa:Country": "USA"
},
"founder": [
{
"@id": "http://example.com/bush",
"@type": "ContributorRole"
},
"tednelson",
"sa:engelbart"
]
},
"_id": "identifier-with-\u0001-escapes"
}
</code></pre>
</div>
</div>
<script type="text/javascript" src="index.js"></script>
<script type="text/javascript">
var $context = document.getElementById('context');
var $code = document.getElementById('code');
var ctx = JSON.parse($context.textContent.trim());
var data = JSON.parse($code.textContent.trim());
$context.innerHTML = jsonldMarkup(ctx);
$code.innerHTML = jsonldMarkup(data, ctx['@context']);
</script>
</body>
</html>