darthapo-stratus 0.3 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog +41 -0
- data/Manifest +15 -36
- data/Readme.markdown +4 -0
- data/examples/dev-blog/config/defaults/{article.html → article.default.html} +0 -0
- data/{test/fixtures/site → examples/dev-blog}/config/defaults/page.default.html +0 -0
- data/examples/dev-blog/config/defaults/{page.html → post.default.html} +0 -0
- data/examples/dev-blog/themes/default/styles/main.css +1 -1
- data/examples/dev-blog/themes/default/templates/posts/content.html +4 -5
- data/lib/stratus.rb +1 -0
- data/lib/stratus/filters.rb +35 -1
- data/lib/stratus/generator/builder.rb +32 -8
- data/lib/stratus/generator/context.rb +28 -25
- data/lib/stratus/generator/renderer.rb +5 -2
- data/lib/stratus/logging.rb +28 -2
- data/lib/stratus/resources.rb +4 -2
- data/lib/stratus/resources/base.rb +15 -5
- data/lib/stratus/resources/content.rb +3 -1
- data/lib/stratus/tasks/app/boilerplate/config/content.yaml +19 -0
- data/lib/stratus/tasks/app/boilerplate/config/site.yaml +5 -11
- data/lib/stratus/tasks/app/boilerplate/content/pages/home/index.html +12 -16
- data/lib/stratus/tasks/app/boilerplate/content/posts/001_welcome/index.html +37 -0
- data/lib/stratus/tasks/app/boilerplate/content/posts/002_getting-started/index.html +37 -0
- data/lib/stratus/tasks/app/boilerplate/themes/default/images/footer-bg.png +0 -0
- data/lib/stratus/tasks/app/boilerplate/themes/default/images/page-bg.png +0 -0
- data/lib/stratus/tasks/app/boilerplate/themes/default/scripts/site.js +1 -0
- data/lib/stratus/tasks/app/boilerplate/themes/default/styles/main.css +99 -2
- data/lib/stratus/tasks/app/boilerplate/themes/default/templates/layouts/main.html +18 -11
- data/lib/stratus/tasks/app/boilerplate/themes/default/templates/{objects/page.html → pages/content.html} +9 -1
- data/lib/stratus/tasks/app/boilerplate/themes/default/templates/pages/feed.xml +25 -0
- data/lib/stratus/tasks/app/boilerplate/themes/default/templates/{objects/page.index.html → pages/list.html} +1 -1
- data/lib/stratus/tasks/app/boilerplate/themes/default/templates/posts/content.html +19 -0
- data/lib/stratus/tasks/app/boilerplate/themes/default/templates/posts/feed.xml +25 -0
- data/lib/stratus/tasks/app/boilerplate/themes/default/templates/posts/list.html +14 -0
- data/lib/stratus/tasks/site/site.rake +5 -0
- data/lib/stratus/version.rb +1 -1
- data/stratus.gemspec +3 -3
- metadata +17 -38
- data/examples/dev-blog/config/defaults/content.html +0 -7
- data/examples/dev-blog/config/defaults/post.html +0 -10
- data/lib/stratus/tasks/app/boilerplate/themes/default/templates/objects/post.html +0 -22
- data/lib/stratus/tasks/app/boilerplate/themes/default/templates/objects/post.index.html +0 -10
- data/test/fixtures/site/StratusSite +0 -26
- data/test/fixtures/site/config/defaults/article.default.html +0 -7
- data/test/fixtures/site/config/defaults/content.default.html +0 -7
- data/test/fixtures/site/config/defaults/post.default.html +0 -10
- data/test/fixtures/site/config/site.yaml +0 -36
- data/test/fixtures/site/content/articles/001_im-the-title/index.html +0 -10
- data/test/fixtures/site/content/pages/about/index.html +0 -7
- data/test/fixtures/site/content/pages/home/index.html +0 -37
- data/test/fixtures/site/content/pages/projects/index.html +0 -6
- data/test/fixtures/site/content/posts/001_new-blog/dom.js +0 -123
- data/test/fixtures/site/content/posts/001_new-blog/index.html +0 -24
- data/test/fixtures/site/content/posts/001_new-blog/old.html +0 -18
- data/test/fixtures/site/content/posts/002_fun-for-the-whole-family/index.html +0 -12
- data/test/fixtures/site/content/posts/002_fun-for-the-whole-family/snippet_one.rb +0 -5
- data/test/fixtures/site/content/posts/003_life-is-quite-fun-really/index.html +0 -12
- data/test/fixtures/site/themes/default/scripts/code_highlighter.js +0 -188
- data/test/fixtures/site/themes/default/scripts/code_syntax.js +0 -92
- data/test/fixtures/site/themes/default/styles/code_syntax.css +0 -68
- data/test/fixtures/site/themes/default/styles/main.css +0 -66
- data/test/fixtures/site/themes/default/templates/layouts/main.html +0 -36
- data/test/fixtures/site/themes/default/templates/objects/article.html +0 -7
- data/test/fixtures/site/themes/default/templates/objects/article.index.html +0 -8
- data/test/fixtures/site/themes/default/templates/objects/feed.xml +0 -25
- data/test/fixtures/site/themes/default/templates/objects/page.html +0 -7
- data/test/fixtures/site/themes/default/templates/objects/page.index.html +0 -10
- data/test/fixtures/site/themes/default/templates/objects/post.html +0 -22
- data/test/fixtures/site/themes/default/templates/objects/post.index.html +0 -10
@@ -4,7 +4,9 @@ class Content < Base
|
|
4
4
|
|
5
5
|
def validate!
|
6
6
|
raise StandardError.new("Posts must have a publish-date! #{content_path}") if (!metadata.has_key?(:publish_date) and collection_type == 'posts')
|
7
|
-
|
7
|
+
# pp self
|
8
|
+
# return false if it's future dated...
|
9
|
+
[(metadata[:publish_date] < Time.now), "Publish date is in the future..."]
|
8
10
|
end
|
9
11
|
|
10
12
|
def full_path
|
@@ -0,0 +1,19 @@
|
|
1
|
+
default:
|
2
|
+
local_slug: 'index' # index | date | none
|
3
|
+
slug_format: '###'
|
4
|
+
sort: 'index'
|
5
|
+
reverse: false
|
6
|
+
feed: true
|
7
|
+
|
8
|
+
# Override per content type
|
9
|
+
|
10
|
+
pages:
|
11
|
+
sort: 'title'
|
12
|
+
local_slug: 'none'
|
13
|
+
|
14
|
+
posts:
|
15
|
+
local_slug: 'index'
|
16
|
+
remote_slug: 'date'
|
17
|
+
slug_format: '%Y-%m-%d'
|
18
|
+
sort: 'publish_date'
|
19
|
+
reverse: true
|
@@ -4,6 +4,11 @@ site:
|
|
4
4
|
theme: "default"
|
5
5
|
copyright: "© 2008 Me. All rights reserved."
|
6
6
|
homepage: "pages/home"
|
7
|
+
base_url: "http://my.site"
|
8
|
+
theme: "default"
|
9
|
+
author:
|
10
|
+
name: "Me"
|
11
|
+
email: "my@email.com"
|
7
12
|
|
8
13
|
generator:
|
9
14
|
output: 'www'
|
@@ -12,16 +17,5 @@ generator:
|
|
12
17
|
cleanup_tags: true
|
13
18
|
force_xhtml: false
|
14
19
|
|
15
|
-
content:
|
16
|
-
local_slug: 'index' # index | date | none
|
17
|
-
slug_format: '###'
|
18
|
-
|
19
|
-
pages:
|
20
|
-
local_slug: 'none'
|
21
|
-
|
22
|
-
posts:
|
23
|
-
remote_slug: 'date'
|
24
|
-
slug_format: '%Y-%m-%d'
|
25
|
-
|
26
20
|
stratus: # Don't touch this section!
|
27
21
|
version: 0.3
|
@@ -1,35 +1,31 @@
|
|
1
1
|
<head>
|
2
2
|
<title>Welcome!</title>
|
3
3
|
<meta name="layout" content="main"/>
|
4
|
+
<meta name="skip_wrapper" content="true" type="bool"/>
|
4
5
|
</head>
|
5
6
|
<body>
|
6
|
-
<h1>Blog Entries:</h1>
|
7
7
|
<div class="home">
|
8
8
|
|
9
9
|
{% for post in posts limit:1 %}
|
10
10
|
<div class="post summary">
|
11
11
|
<h2>{{ post.title }}</h2>
|
12
|
+
<div class="meta">Published on {{ post.publish_date | short_date }}.</div>
|
12
13
|
<div class="body">
|
13
14
|
{{ post.summary }}
|
14
15
|
<p><a href="{{ post | uri_rel }}">Read more...</a></p>
|
15
16
|
</div>
|
16
|
-
<div class="meta">Published on {{ post.publish_date | short_date }}.</div>
|
17
17
|
</div>
|
18
18
|
{% endfor %}
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
<
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
<span class="meta">{{ post.publish_date | short_date }}</span>
|
30
|
-
</h4>
|
31
|
-
</div>
|
32
|
-
{% endfor %}
|
19
|
+
|
20
|
+
<h3>Recently...</h3>
|
21
|
+
<ul class="post-list">
|
22
|
+
{% for post in posts limit:5 offset:1 %}
|
23
|
+
<li class="post">
|
24
|
+
<span class="meta">{{ post.publish_date | short_date }}</span>
|
25
|
+
<a href="{{ post | uri }}">{{ post.title }}</a>
|
26
|
+
</li>
|
27
|
+
{% endfor %}
|
28
|
+
</ul>
|
33
29
|
|
34
30
|
</div>
|
35
31
|
</body>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<head>
|
2
|
+
<title>Welcome!</title>
|
3
|
+
<meta name="publish-date" content="2008-12-18 20:06"/>
|
4
|
+
</head>
|
5
|
+
<summary>
|
6
|
+
<p>Hello, and welcome to your new stratus site!</p>
|
7
|
+
</summary>
|
8
|
+
<body>
|
9
|
+
{% markdown %}
|
10
|
+
Here's some things to keep in mind:
|
11
|
+
|
12
|
+
* The homepage is under `pages/home`
|
13
|
+
* You can create new collections of content via:
|
14
|
+
|
15
|
+
stratus new:collection COLLECTION_NAME
|
16
|
+
|
17
|
+
* You can adjust the settings (for feeds, default sorting, and sluglines) in `config/content.yaml`
|
18
|
+
* You specify the site's title, subtitle, author, url and more in `config/site.yaml`
|
19
|
+
* If you want to customize the default (boilerplate) content that's created you can modify the templates in `config/defaults/COLLECTION_TYPE.html`
|
20
|
+
* The `StratusSite` file is actually a Rakefile, so you can add your own tasks there
|
21
|
+
|
22
|
+
### Some Helpful Tags/Filters
|
23
|
+
|
24
|
+
Liquid is used for the templating system. Stratus comes with a few custom tags and filters to help out.
|
25
|
+
|
26
|
+
`sourcecode`
|
27
|
+
: Both a tag and filter. If used as a tag, you can specify the language type. If used as a filter and you specify an attachment, it'll put it's contents inline. It's built for use with [CodeHighlighter][].
|
28
|
+
|
29
|
+
`uri`
|
30
|
+
: Generates a URI for the specified content object or collection.
|
31
|
+
|
32
|
+
`url`
|
33
|
+
: Generates a full URL (based on the url defined in `config/site.yaml`) for the specified content object or collection.
|
34
|
+
|
35
|
+
[CodeHighlighter]: http://
|
36
|
+
{% endmarkdown %}
|
37
|
+
</body>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<head>
|
2
|
+
<title>Getting Started</title>
|
3
|
+
<meta name="publish-date" content="2008-12-18 20:00"/>
|
4
|
+
</head>
|
5
|
+
<summary>
|
6
|
+
<p>Hello, and welcome to your new stratus site!</p>
|
7
|
+
</summary>
|
8
|
+
<body>
|
9
|
+
{% markdown %}
|
10
|
+
Here's some things to keep in mind:
|
11
|
+
|
12
|
+
* The homepage is under `pages/home`
|
13
|
+
* You can create new collections of content via:
|
14
|
+
|
15
|
+
stratus new:collection COLLECTION_NAME
|
16
|
+
|
17
|
+
* You can adjust the settings (for feeds, default sorting, and sluglines) in `config/content.yaml`
|
18
|
+
* You specify the site's title, subtitle, author, url and more in `config/site.yaml`
|
19
|
+
* If you want to customize the default (boilerplate) content that's created you can modify the templates in `config/defaults/COLLECTION_TYPE.html`
|
20
|
+
* The `StratusSite` file is actually a Rakefile, so you can add your own tasks there
|
21
|
+
|
22
|
+
### Some Helpful Tags/Filters
|
23
|
+
|
24
|
+
Liquid is used for the templating system. Stratus comes with a few custom tags and filters to help out.
|
25
|
+
|
26
|
+
`sourcecode`
|
27
|
+
: Both a tag and filter. If used as a tag, you can specify the language type. If used as a filter and you specify an attachment, it'll put it's contents inline. It's built for use with [CodeHighlighter][].
|
28
|
+
|
29
|
+
`uri`
|
30
|
+
: Generates a URI for the specified content object or collection.
|
31
|
+
|
32
|
+
`url`
|
33
|
+
: Generates a full URL (based on the url defined in `config/site.yaml`) for the specified content object or collection.
|
34
|
+
|
35
|
+
[CodeHighlighter]: http://
|
36
|
+
{% endmarkdown %}
|
37
|
+
</body>
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
// You can put your own custom js functions here...
|
@@ -1,12 +1,109 @@
|
|
1
1
|
/*
|
2
|
-
Just a default CSS file -- blow it away and start fresh!
|
2
|
+
Just a default CSS file -- Feel free to blow it away and start fresh!
|
3
3
|
*/
|
4
4
|
|
5
|
+
/** {
|
6
|
+
margin: 0px;
|
7
|
+
padding: 0px;
|
8
|
+
vertical-align: middle;
|
9
|
+
}
|
10
|
+
*/
|
11
|
+
HTML {
|
12
|
+
background-color: #C4D0DB;
|
13
|
+
margin: 0px;
|
14
|
+
padding: 0px;
|
15
|
+
}
|
16
|
+
|
5
17
|
BODY {
|
18
|
+
background: #FFF url(../images/page-bg.png) top left repeat-x;
|
6
19
|
font-family: tahoma, sans-serif;
|
20
|
+
text-align: center;
|
21
|
+
margin: 0px;
|
22
|
+
padding: 0px;
|
23
|
+
}
|
24
|
+
|
25
|
+
h1, h2, h3, h4, h5, h6 {
|
26
|
+
margin-bottom: 0px;
|
27
|
+
padding-bottom: 0px;
|
28
|
+
font-family: Georgia, Sans-Serif;
|
7
29
|
}
|
8
30
|
|
9
31
|
.page-container {
|
10
32
|
width: 700px;
|
11
33
|
margin: 0 auto;
|
12
|
-
|
34
|
+
text-align: left;
|
35
|
+
}
|
36
|
+
|
37
|
+
#header {
|
38
|
+
padding-top: 15px;
|
39
|
+
font-family: Georgia, Sans-Serif;
|
40
|
+
}
|
41
|
+
#header h1 {
|
42
|
+
text-align: center;
|
43
|
+
font-size: 72px;
|
44
|
+
font-weight: normal;
|
45
|
+
color: #999999;
|
46
|
+
margin: 0px;
|
47
|
+
padding: 0px;
|
48
|
+
}
|
49
|
+
#header h1 span {
|
50
|
+
color: #666666;
|
51
|
+
}
|
52
|
+
#header .subtitle {
|
53
|
+
text-align: center;
|
54
|
+
font-size: 11px;
|
55
|
+
color: #666;
|
56
|
+
}
|
57
|
+
#header .subtitle A {
|
58
|
+
color: #666;
|
59
|
+
}
|
60
|
+
|
61
|
+
#sidebar {
|
62
|
+
width: 150px;
|
63
|
+
background: #F0F0F0;
|
64
|
+
border: 1px solid #DDD;
|
65
|
+
float: left;
|
66
|
+
-webkit-border-radius: 10px;
|
67
|
+
-moz-border-radius: 10px;
|
68
|
+
}
|
69
|
+
|
70
|
+
#contents {
|
71
|
+
margin-left: 175px;
|
72
|
+
}
|
73
|
+
.post .meta {
|
74
|
+
color: #999;
|
75
|
+
font-size: 85%;
|
76
|
+
font-weight: normal;
|
77
|
+
}
|
78
|
+
.post-list {
|
79
|
+
list-style: none;
|
80
|
+
margin: 0px;
|
81
|
+
padding: 10px 0px;
|
82
|
+
}
|
83
|
+
LI.post {
|
84
|
+
list-style: none;
|
85
|
+
margin: 0px;
|
86
|
+
padding: 5px;
|
87
|
+
}
|
88
|
+
LI.post .meta {
|
89
|
+
display: inline-block;
|
90
|
+
width: 100px;
|
91
|
+
text-align: right;
|
92
|
+
}
|
93
|
+
|
94
|
+
#footer {
|
95
|
+
clear: both;
|
96
|
+
margin-top: 25px;
|
97
|
+
padding-top: 25px;
|
98
|
+
background: #C4D0DB url(../images/footer-bg.png) top left repeat-x;
|
99
|
+
font-size: 13px;
|
100
|
+
color: #495E72;
|
101
|
+
height: 125px;
|
102
|
+
}
|
103
|
+
#footer .page-container {
|
104
|
+
text-align: center;
|
105
|
+
}
|
106
|
+
#footer a {
|
107
|
+
padding: 5px 0px;
|
108
|
+
color: #495E72;
|
109
|
+
}
|
@@ -4,27 +4,34 @@
|
|
4
4
|
<head>
|
5
5
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
6
6
|
<title>{{ site.title }}</title>
|
7
|
-
<link rel="stylesheet" href="
|
7
|
+
<link rel="stylesheet" href="/theme/styles/main.css" type="text/css" media="screen" charset="utf-8"/>
|
8
|
+
<script src="/theme/scripts/site.js" type="text/javascript" charset="utf-8"></script>
|
9
|
+
<link rel="alternate" type="application/rss+xml" title="RSS Feed" href="/posts/feed.xml" />
|
8
10
|
{{ this.head }}
|
9
11
|
</head>
|
10
|
-
<body>
|
11
|
-
<div
|
12
|
-
<div class="
|
12
|
+
<body class="{{ this.collection_type }}">
|
13
|
+
<div id="header">
|
14
|
+
<div class="page-container">
|
13
15
|
<h1>{{ site.title }}</h1>
|
14
16
|
<div class="subtitle">
|
15
17
|
{{ site.subtitle }}
|
16
18
|
</div>
|
17
19
|
</div>
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
<
|
20
|
+
</div>
|
21
|
+
<div class="page-container">
|
22
|
+
<div id="sidebar">
|
23
|
+
<ul class="navigaiton">
|
24
|
+
<li><a href="{{ page.home | uri }}">Home</a></li>
|
25
|
+
<li><a href="{{ posts | uri }}">Archive</a></li>
|
26
|
+
</ul>
|
22
27
|
</div>
|
23
|
-
<div
|
28
|
+
<div id="contents">
|
24
29
|
{{ content }}
|
25
30
|
</div>
|
26
|
-
|
27
|
-
|
31
|
+
</div>
|
32
|
+
<div id="footer">
|
33
|
+
<div class="page-container">
|
34
|
+
{{ site.copyright }} Sited generated with <a href="http://darthapo.github.com/stratus">Stratus</a>
|
28
35
|
</div>
|
29
36
|
</div>
|
30
37
|
</body>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<meta name="layout" content=""/>
|
2
|
+
<?xml version="1.0" encoding="utf-8"?>
|
3
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
4
|
+
|
5
|
+
<title>{{ site.title }}</title>
|
6
|
+
<link href="{{ '/pages/feed.xml' | url }}" rel="self"/>
|
7
|
+
<link href="{{ '' | url }}/"/>
|
8
|
+
<updated>{{ site.time | date_to_xmlschema }}</updated>
|
9
|
+
<id>{{ '' | url }}/</id>
|
10
|
+
<author>
|
11
|
+
<name>{{ site.author.name }}</name>
|
12
|
+
<email>{{ site.author.email }}</email>
|
13
|
+
</author>
|
14
|
+
|
15
|
+
{% for content in pages %}
|
16
|
+
<entry>
|
17
|
+
<title>{{ content.title }}</title>
|
18
|
+
<link href="{{ content | url }}"/>
|
19
|
+
<updated>{{ content.publish_date | date_to_xmlschema }}</updated>
|
20
|
+
<id>{{ content | url }}</id>
|
21
|
+
<content type="html">{{ content.summary | xml_escape }}</content>
|
22
|
+
</entry>
|
23
|
+
{% endfor %}
|
24
|
+
|
25
|
+
</feed>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<meta name="layout" content="main"/>
|
2
|
+
<div class="post">
|
3
|
+
<h2>{{ this.title }}</h2>
|
4
|
+
<div class="meta">
|
5
|
+
Published on {{ this.publish_date | short_date }}.
|
6
|
+
</div>
|
7
|
+
<div class="body">
|
8
|
+
{{ this.body }}
|
9
|
+
</div>
|
10
|
+
</div>
|
11
|
+
<div class="pager">
|
12
|
+
{% if this.next %}
|
13
|
+
<a href="{{ this.next | uri }}">« {{ this.next.title }}</a>
|
14
|
+
{% endif %}
|
15
|
+
<!-- <a href="{{ page.home | uri }}">Home</a> -->
|
16
|
+
{% if this.prev %}
|
17
|
+
<a href="{{ this.prev | uri }}">{{ this.prev.title }} »</a>
|
18
|
+
{% endif %}
|
19
|
+
</div>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<meta name="layout" content=""/>
|
2
|
+
<?xml version="1.0" encoding="utf-8"?>
|
3
|
+
<feed xmlns="http://www.w3.org/2005/Atom">
|
4
|
+
|
5
|
+
<title>{{ site.title }}</title>
|
6
|
+
<link href="{{ '/posts/feed.xml' | url }}" rel="self"/>
|
7
|
+
<link href="{{ '' | url }}/"/>
|
8
|
+
<updated>{{ site.time | date_to_xmlschema }}</updated>
|
9
|
+
<id>{{ '' | url }}/</id>
|
10
|
+
<author>
|
11
|
+
<name>{{ site.author.name }}</name>
|
12
|
+
<email>{{ site.author.email }}</email>
|
13
|
+
</author>
|
14
|
+
|
15
|
+
{% for content in posts %}
|
16
|
+
<entry>
|
17
|
+
<title>{{ content.title }}</title>
|
18
|
+
<link href="{{ content | url }}"/>
|
19
|
+
<updated>{{ content.publish_date | date_to_xmlschema }}</updated>
|
20
|
+
<id>{{ content | url }}</id>
|
21
|
+
<content type="html">{{ content.summary | xml_escape }}</content>
|
22
|
+
</entry>
|
23
|
+
{% endfor %}
|
24
|
+
|
25
|
+
</feed>
|