1
0
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:
Oliver Steele 2017-07-26 10:01:26 -04:00
parent d78b0e0db2
commit a81cd37701
29 changed files with 343 additions and 1 deletions

View File

@ -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
View File

@ -0,0 +1,6 @@
---
title: A
weight: 20
---
A collection page.

6
commands/testdata/site/_c1/c1p2.md vendored Normal file
View File

@ -0,0 +1,6 @@
---
title: B
weight: 30
---
Another collection page.

4
commands/testdata/site/_c2/p3.md vendored Normal file
View File

@ -0,0 +1,4 @@
---
---
The page c2p1.md in another collection.

17
commands/testdata/site/_config.yml vendored Normal file
View 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

View File

@ -0,0 +1,2 @@
key,value
1,2
1 key value
2 1 2

View File

@ -0,0 +1 @@
key: data file value

View File

@ -0,0 +1 @@
{"key": "json data"}

View File

@ -0,0 +1,7 @@
---
---
{{ page.title }}
================
A small giraffe.

View File

@ -0,0 +1,8 @@
---
layout: default
---
<!-- archive layout -->
<h2>Archive Layout</h2>
{{content}}
<!-- archive layout end -->

View File

@ -0,0 +1,2 @@
<link rel="stylesheet" href="assets/default.css">
{{content}}

View File

@ -0,0 +1,4 @@
<!-- default layout -->
<h1>Default Layout: {{page.title}}</h1>
{{content}}
<!-- default layout end -->

View File

@ -0,0 +1,7 @@
---
---
{{ page.title }}
================
I was born on this day.

View File

@ -0,0 +1,5 @@
---
published: false
---
This page is not published.

View 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
View 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 %})

View 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
View 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
View 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>

View File

@ -0,0 +1,4 @@
---
---
Empty front matter for page at {{page.url}}.

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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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 %}