Skip to content

Commit a486cf7

Browse files
committed
Create script to build examples
1 parent b8dae0e commit a486cf7

File tree

18 files changed

+89
-73
lines changed

18 files changed

+89
-73
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ Gemfile.lock
1515

1616
test/log
1717
test/log/difflist.json
18-
examples/images/*
18+
examples/compiled/*.png
19+
site/examples/
20+
!site/examples/index.md
1921
examples/all-examples.json
2022
build/*
2123
!build/vega-lite-schema.json

_config.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,3 @@ kramdown:
4444
input: GFM
4545
syntax_highlighter: rouge
4646
auto_id_stripping: true
47-
48-
collections:
49-
examples:
50-
output: true
51-
permalink: /:collection/:name

_data/examples.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
{
44
"name": "bar",
55
"title": "Simple Bar Chart",
6+
"description": "A bar chart encodes quantitative values as the extent of rectangular bars.",
67
"style": "background-size: auto 110%; background-position: center center !important;"
78
},
89
{

_includes/example.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{% assign id = include.spec | replace:'/', '-' %}
2+
3+
<div id="{{id}}"></div>
4+
5+
<script>
6+
window.onload = function() {
7+
var spec = {% include_relative {{ include.spec }}.vl.json %};
8+
9+
embedExample('#{{id}}', spec, false);
10+
}
11+
</script>
12+
13+
<a href="https://vega.github.io/editor/#/examples/vega-lite/{{ include.spec }}">View this example in the online editor</a>
14+
15+
<h3 id="spec">Vega-Lite JSON Specification</h3>
16+
17+
{: .example-spec}
18+
```json
19+
{% include_relative {{ include.spec }}.vl.json %}
20+
```

_includes/example.md

Lines changed: 0 additions & 26 deletions
This file was deleted.

_includes/preview.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<a class="imagegroup" href="https://vega.github.io/editor/#/examples/vega-lite/{{ include.spec }}">
1+
<a class="imagegroup" href="{{site.baseurl}}/examples/{{ include.spec }}.html">
22
<span class="image" alt="{{ include.title | strip }}" style="background-image: url({{site.baseurl}}/examples/compiled/{{ include.spec }}.svg);{% if include.style %}{{ include.style }}{% endif %}"></span>
33
<span class="image-title">{{ include.title | strip }}</span>
44
</a>

_layouts/base.html

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,20 @@
1212
var BASEURL = window.location.origin + "{{site.baseurl}}";
1313
</script>
1414

15-
<title> {{site.title}}{% if page.title %}:{% endif %} {{page.title}} </title>
16-
<link rel="stylesheet" href="{{site.baseurl}}/site/static/syntax.css">
17-
<link rel="stylesheet" href="{{site.baseurl}}/site/static/github.css">
15+
<title>{{site.title}}{% if page.title %}:{% endif %} {{page.title}}</title>
16+
<link rel="stylesheet" href="{{ site.baseurl }}/site/static/syntax.css">
17+
<link rel="stylesheet" href="{{ site.baseurl }}/site/static/github.css">
1818
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/font/octicons.css">
19-
<link rel="stylesheet" href="{{site.baseurl}}/site/static/main.css">
19+
<link rel="stylesheet" href="{{ site.baseurl }}/site/static/main.css">
2020
{% seo %}
21+
22+
{% if page.image %}
23+
<meta name="twitter:card" content="summary_large_image" />
24+
<meta name="twitter:site" content="@vega_vis" />
25+
<meta property="og:image" content="{{ site.baseurl }}{{ page.image }}" />
26+
{% if page.description %}<meta property="og:description" content="{{ page.description }}" />{% endif %}
27+
<meta property="og:title" content="{{ page.title }}" />
28+
{% endif %}
2129
</head>
2230
<body>
2331
{{ content }}

_layouts/examples.html

Lines changed: 0 additions & 6 deletions
This file was deleted.

bin/vl2png

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
# Expects the path to a Vega-Lite specification as the first argument. Passes remaining argument to vg2png
3+
# Expects the path to a Vega-Lite specification as the first argument. Passes remaining arguments to vg2png
44

55
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
66

bin/vl2svg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
# Expects the path to a Vega-Lite specification as the first argument. Passes remaining argument to vg2svg
3+
# Expects the path to a Vega-Lite specification as the first argument. Passes remaining arguments to vg2svg
44

55
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
66

0 commit comments

Comments
 (0)