mirror of
https://github.com/danog/gojekyll.git
synced 2024-11-26 19:14:40 +01:00
commands test uses own testdata
This commit is contained in:
parent
d78b0e0db2
commit
a81cd37701
@ -7,6 +7,6 @@ import (
|
||||
)
|
||||
|
||||
func TestParseAndRun(t *testing.T) {
|
||||
err := ParseAndRun([]string{"build", "-s", "../testdata/example", "-q"})
|
||||
err := ParseAndRun([]string{"build", "-s", "testdata/site", "-q"})
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
6
commands/testdata/site/_c1/c1p1.md
vendored
Normal file
6
commands/testdata/site/_c1/c1p1.md
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
title: A
|
||||
weight: 20
|
||||
---
|
||||
|
||||
A collection page.
|
6
commands/testdata/site/_c1/c1p2.md
vendored
Normal file
6
commands/testdata/site/_c1/c1p2.md
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
title: B
|
||||
weight: 30
|
||||
---
|
||||
|
||||
Another collection page.
|
4
commands/testdata/site/_c2/p3.md
vendored
Normal file
4
commands/testdata/site/_c2/p3.md
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
---
|
||||
|
||||
The page c2p1.md in another collection.
|
17
commands/testdata/site/_config.yml
vendored
Normal file
17
commands/testdata/site/_config.yml
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
title: Site Title
|
||||
description: Site description
|
||||
variable: site variable
|
||||
|
||||
collections:
|
||||
c1:
|
||||
output: true
|
||||
permalink: /:collection/:path
|
||||
c2:
|
||||
output: true
|
||||
|
||||
plugins:
|
||||
- jekyll-avatar
|
||||
- jekyll-gist
|
||||
|
||||
gist:
|
||||
noscript: false
|
2
commands/testdata/site/_data/csv_data.csv
vendored
Normal file
2
commands/testdata/site/_data/csv_data.csv
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
key,value
|
||||
1,2
|
|
1
commands/testdata/site/_data/file_data.yml
vendored
Normal file
1
commands/testdata/site/_data/file_data.yml
vendored
Normal file
@ -0,0 +1 @@
|
||||
key: data file value
|
1
commands/testdata/site/_data/json_data.json
vendored
Normal file
1
commands/testdata/site/_data/json_data.json
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"key": "json data"}
|
7
commands/testdata/site/_drafts/2017-07-01-draft.md
vendored
Executable file
7
commands/testdata/site/_drafts/2017-07-01-draft.md
vendored
Executable file
@ -0,0 +1,7 @@
|
||||
---
|
||||
---
|
||||
|
||||
{{ page.title }}
|
||||
================
|
||||
|
||||
A small giraffe.
|
8
commands/testdata/site/_layouts/archive.html
vendored
Normal file
8
commands/testdata/site/_layouts/archive.html
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
layout: default
|
||||
---
|
||||
|
||||
<!-- archive layout -->
|
||||
<h2>Archive Layout</h2>
|
||||
{{content}}
|
||||
<!-- archive layout end -->
|
2
commands/testdata/site/_layouts/code.html
vendored
Normal file
2
commands/testdata/site/_layouts/code.html
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
<link rel="stylesheet" href="assets/default.css">
|
||||
{{content}}
|
4
commands/testdata/site/_layouts/default.html
vendored
Normal file
4
commands/testdata/site/_layouts/default.html
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
<!-- default layout -->
|
||||
<h1>Default Layout: {{page.title}}</h1>
|
||||
{{content}}
|
||||
<!-- default layout end -->
|
7
commands/testdata/site/_posts/2017-06-10-birthday.md
vendored
Executable file
7
commands/testdata/site/_posts/2017-06-10-birthday.md
vendored
Executable file
@ -0,0 +1,7 @@
|
||||
---
|
||||
---
|
||||
|
||||
{{ page.title }}
|
||||
================
|
||||
|
||||
I was born on this day.
|
5
commands/testdata/site/_posts/2017-07-01-unpublished.md
vendored
Executable file
5
commands/testdata/site/_posts/2017-07-01-unpublished.md
vendored
Executable file
@ -0,0 +1,5 @@
|
||||
---
|
||||
published: false
|
||||
---
|
||||
|
||||
This page is not published.
|
4
commands/testdata/site/_posts/8017-01-01-future.md
vendored
Executable file
4
commands/testdata/site/_posts/8017-01-01-future.md
vendored
Executable file
@ -0,0 +1,4 @@
|
||||
---
|
||||
---
|
||||
|
||||
There are now three billion humans living in a ring around the Earth, and they have indeed formed into seven races, each one descended from and named after the Seven Eves who survived the events of Part 2.
|
12
commands/testdata/site/archive.md
vendored
Normal file
12
commands/testdata/site/archive.md
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
---
|
||||
layout: archive
|
||||
---
|
||||
|
||||
## Pages
|
||||
|
||||
{% assign pages = site.c1 | sort: 'weight' %}
|
||||
{% for p in pages %}
|
||||
* [{{p.title}}]({{p.url}})
|
||||
{% endfor %}
|
||||
|
||||
[An article]({% link _c1/c1p1.md %})
|
65
commands/testdata/site/assets/default.css
vendored
Normal file
65
commands/testdata/site/assets/default.css
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
.highlight .hll { background-color: #ffffcc }
|
||||
.highlight { background: #f8f8f8; }
|
||||
.highlight .c { color: #408080; font-style: italic } /* Comment */
|
||||
.highlight .err { border: 1px solid #FF0000 } /* Error */
|
||||
.highlight .k { color: #008000; font-weight: bold } /* Keyword */
|
||||
.highlight .o { color: #666666 } /* Operator */
|
||||
.highlight .ch { color: #408080; font-style: italic } /* Comment.Hashbang */
|
||||
.highlight .cm { color: #408080; font-style: italic } /* Comment.Multiline */
|
||||
.highlight .cp { color: #BC7A00 } /* Comment.Preproc */
|
||||
.highlight .cpf { color: #408080; font-style: italic } /* Comment.PreprocFile */
|
||||
.highlight .c1 { color: #408080; font-style: italic } /* Comment.Single */
|
||||
.highlight .cs { color: #408080; font-style: italic } /* Comment.Special */
|
||||
.highlight .gd { color: #A00000 } /* Generic.Deleted */
|
||||
.highlight .ge { font-style: italic } /* Generic.Emph */
|
||||
.highlight .gr { color: #FF0000 } /* Generic.Error */
|
||||
.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
|
||||
.highlight .gi { color: #00A000 } /* Generic.Inserted */
|
||||
.highlight .go { color: #888888 } /* Generic.Output */
|
||||
.highlight .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
|
||||
.highlight .gs { font-weight: bold } /* Generic.Strong */
|
||||
.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
|
||||
.highlight .gt { color: #0044DD } /* Generic.Traceback */
|
||||
.highlight .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
|
||||
.highlight .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
|
||||
.highlight .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
|
||||
.highlight .kp { color: #008000 } /* Keyword.Pseudo */
|
||||
.highlight .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
|
||||
.highlight .kt { color: #B00040 } /* Keyword.Type */
|
||||
.highlight .m { color: #666666 } /* Literal.Number */
|
||||
.highlight .s { color: #BA2121 } /* Literal.String */
|
||||
.highlight .na { color: #7D9029 } /* Name.Attribute */
|
||||
.highlight .nb { color: #008000 } /* Name.Builtin */
|
||||
.highlight .nc { color: #0000FF; font-weight: bold } /* Name.Class */
|
||||
.highlight .no { color: #880000 } /* Name.Constant */
|
||||
.highlight .nd { color: #AA22FF } /* Name.Decorator */
|
||||
.highlight .ni { color: #999999; font-weight: bold } /* Name.Entity */
|
||||
.highlight .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
|
||||
.highlight .nf { color: #0000FF } /* Name.Function */
|
||||
.highlight .nl { color: #A0A000 } /* Name.Label */
|
||||
.highlight .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
|
||||
.highlight .nt { color: #008000; font-weight: bold } /* Name.Tag */
|
||||
.highlight .nv { color: #19177C } /* Name.Variable */
|
||||
.highlight .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
|
||||
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
|
||||
.highlight .mb { color: #666666 } /* Literal.Number.Bin */
|
||||
.highlight .mf { color: #666666 } /* Literal.Number.Float */
|
||||
.highlight .mh { color: #666666 } /* Literal.Number.Hex */
|
||||
.highlight .mi { color: #666666 } /* Literal.Number.Integer */
|
||||
.highlight .mo { color: #666666 } /* Literal.Number.Oct */
|
||||
.highlight .sb { color: #BA2121 } /* Literal.String.Backtick */
|
||||
.highlight .sc { color: #BA2121 } /* Literal.String.Char */
|
||||
.highlight .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
|
||||
.highlight .s2 { color: #BA2121 } /* Literal.String.Double */
|
||||
.highlight .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
|
||||
.highlight .sh { color: #BA2121 } /* Literal.String.Heredoc */
|
||||
.highlight .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
|
||||
.highlight .sx { color: #008000 } /* Literal.String.Other */
|
||||
.highlight .sr { color: #BB6688 } /* Literal.String.Regex */
|
||||
.highlight .s1 { color: #BA2121 } /* Literal.String.Single */
|
||||
.highlight .ss { color: #19177C } /* Literal.String.Symbol */
|
||||
.highlight .bp { color: #008000 } /* Name.Builtin.Pseudo */
|
||||
.highlight .vc { color: #19177C } /* Name.Variable.Class */
|
||||
.highlight .vg { color: #19177C } /* Name.Variable.Global */
|
||||
.highlight .vi { color: #19177C } /* Name.Variable.Instance */
|
||||
.highlight .il { color: #666666 } /* Literal.Number.Integer.Long */
|
21
commands/testdata/site/collections.md
vendored
Normal file
21
commands/testdata/site/collections.md
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
---
|
||||
---
|
||||
|
||||
## Collections
|
||||
|
||||
<dl>
|
||||
{% for c in site.collections %}
|
||||
<dt> {{ c.label }}</dt>
|
||||
{% for k in c %}{% if k != 'docs' %}
|
||||
<dd>{{k}}={{c[k]}}
|
||||
{% endif %}{% endfor %}
|
||||
<dd>docs: <ul>
|
||||
{% for p in c.docs %}
|
||||
<li>{{ p.path }}
|
||||
properties: {% for k in p %}{{k}} {% endfor %}
|
||||
</li>
|
||||
<pre>{{p.content | escape}}</pre>
|
||||
{% endfor %}
|
||||
</ul></dd>
|
||||
{% endfor %}
|
||||
</dl>
|
18
commands/testdata/site/data.md
vendored
Normal file
18
commands/testdata/site/data.md
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
---
|
||||
---
|
||||
|
||||
## YAML data
|
||||
|
||||
* {{ site.data.file_data.key }}
|
||||
|
||||
## JSON data
|
||||
|
||||
{{ site.data.json_data.key }}
|
||||
|
||||
## CSV data
|
||||
|
||||
<table>
|
||||
{% for row in site.data.csv_data %}
|
||||
<tr>{% for cell in row %}<td>{{ cell }}</td>{% endfor %}</tr>
|
||||
{% endfor %}
|
||||
</table>
|
4
commands/testdata/site/empty-frontmatter.md
vendored
Normal file
4
commands/testdata/site/empty-frontmatter.md
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
---
|
||||
|
||||
Empty front matter for page at {{page.url}}.
|
BIN
commands/testdata/site/images/gopher.jpg
vendored
Normal file
BIN
commands/testdata/site/images/gopher.jpg
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 158 KiB |
27
commands/testdata/site/index.md
vendored
Normal file
27
commands/testdata/site/index.md
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
---
|
||||
permalink: /
|
||||
variable: page variable
|
||||
---
|
||||
|
||||
## Stats
|
||||
|
||||
* {{ site.pages.size }} Pages
|
||||
* {{ site.posts.size }} Posts
|
||||
* {{ site.static_files.size }} Static Files
|
||||
* {{ site.html_pages.size }} HTML Pages
|
||||
* {{ site.html_files.size }} HTML Files
|
||||
* {{ site.pages.collections }} Collections
|
||||
|
||||
## Tests
|
||||
|
||||
* [Archive]({% link archive.md %})
|
||||
* [Collections]({% link collections.md %})
|
||||
* [Markdown]({% link markdown.md %})
|
||||
* [Pages]({% link pages.md %})
|
||||
* [Plugins]({% link plugins.md %})
|
||||
* [Static file]({% link static.html %})
|
||||
* [Tags]({% link tags.md %})
|
||||
* [Variables]({% link variables.md %})
|
||||
* {{ page.variable }}
|
||||
* {{ site.variable }}
|
||||
* {{ site.data.file_data.key }}
|
20
commands/testdata/site/markdown.md
vendored
Normal file
20
commands/testdata/site/markdown.md
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
---
|
||||
|
||||
# {{page.title}}
|
||||
|
||||
A *list*:
|
||||
|
||||
- first
|
||||
- second
|
||||
- third
|
||||
|
||||
Fenced code:
|
||||
|
||||
```python
|
||||
def fib(n):
|
||||
if n < 2:
|
||||
return n
|
||||
else:
|
||||
return fib(n - 2) + fib(n - 1)
|
||||
```
|
11
commands/testdata/site/pages.md
vendored
Normal file
11
commands/testdata/site/pages.md
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
---
|
||||
---
|
||||
|
||||
# Pages
|
||||
|
||||
{% for page in site.pages %}
|
||||
* {{ page.path }}{% endfor %}
|
||||
|
||||
## Page Variables
|
||||
|
||||
{{ site.pages | first }}
|
18
commands/testdata/site/plugins.md
vendored
Normal file
18
commands/testdata/site/plugins.md
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
---
|
||||
---
|
||||
|
||||
# Plugins
|
||||
|
||||
## Avatar
|
||||
|
||||
{% avatar osteele %}
|
||||
|
||||
{% avatar user='osteele' size=24 %}
|
||||
|
||||
## Gist
|
||||
|
||||
(From <https://jekyllrb.com/docs/templates/>)
|
||||
|
||||
{% gist parkr/931c1c8d465a04042403 %}
|
||||
|
||||
{% gist parkr/931c1c8d465a04042403 jekyll-private-gist.markdown %}
|
10
commands/testdata/site/printing.md
vendored
Normal file
10
commands/testdata/site/printing.md
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
---
|
||||
---
|
||||
|
||||
true = {{ true }}
|
||||
|
||||
false = {{ false }}
|
||||
|
||||
nil = {{ nil }}
|
||||
|
||||
list = {{ "a b c" | split: ' ' }}
|
3
commands/testdata/site/static.html
vendored
Normal file
3
commands/testdata/site/static.html
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
I am a <em>static HTML</em> file.
|
||||
|
||||
There should be {{braces}} here.
|
13
commands/testdata/site/tags.md
vendored
Normal file
13
commands/testdata/site/tags.md
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
---
|
||||
layout: code
|
||||
---
|
||||
|
||||
# Tags
|
||||
|
||||
{% highlight ruby %}
|
||||
def fib(n):
|
||||
if n < 2:
|
||||
return n
|
||||
else:
|
||||
return fib(n - 2) + fib(n - 1)
|
||||
{% endhighlight %}
|
46
commands/testdata/site/variables.md
vendored
Normal file
46
commands/testdata/site/variables.md
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
---
|
||||
---
|
||||
|
||||
## Page Variables ([reference](https://jekyllrb.com/docs/variables/#page-variables))
|
||||
|
||||
| Name | Value |
|
||||
|------------|---------------------|
|
||||
| categories | {{ page.categories }} |
|
||||
| date | {{ page.date }} |
|
||||
| id | {{ page.id }} |
|
||||
| path | {{ page.path }} |
|
||||
| tags | {{ page.tags }} |
|
||||
| title | {{ page.title }} |
|
||||
| url | {{ page.url }} |
|
||||
|
||||
|
||||
{% comment %}
|
||||
TODO:
|
||||
excerpt
|
||||
content
|
||||
next
|
||||
previous
|
||||
{% endcomment %}
|
||||
|
||||
## Site Variables ([reference](https://jekyllrb.com/docs/variables/#site-variables))
|
||||
|
||||
| Name | Value | Notes |
|
||||
|-------------|----------------------|----------------------|
|
||||
| description | {{ site.description }} | (from `_config.yml`) |
|
||||
| time | {{ site.time }} | |
|
||||
| title | {{ site.title }} | (from `_config.yml`) |
|
||||
|
||||
{% comment %}
|
||||
TODO:
|
||||
pages
|
||||
posts
|
||||
related_posts
|
||||
static_files
|
||||
html_pages
|
||||
html_files
|
||||
collections
|
||||
data
|
||||
documents
|
||||
categories
|
||||
tags
|
||||
{% endcomment %}
|
Loading…
Reference in New Issue
Block a user