Edward, a simple robust static site generator for Ruby
Edward is inspired by Jekyll (Edward Hyde is the name of Dr Jekyll’s alter ego). However, Edward uses Tilt for templating instead of Liquid. The freedom provided by Tilt as well as Edwards simplicity create a very powerful environment.
At its core Edward only does one thing, given a website it will convert certain template files (called "pages") to a different format (typically .html). It has a concept of layouts and include partials, but nothing else. Other functionality may be implemented by hand.
Ruby has some very powerful templating engines like Slim, Haml, Erb and AsciiDoc. This project tries to leverage these tools as much as possible.
|
Warning
|
Edward is still unstable and being actively worked on |
Getting started
$ gem install mr-edward
$ edward serveLayouts
You may place layouts in _layouts. Layouts call yield to get their inner content.
// _layouts/default.slim
doctype html
html
head
title = @page[:title]
style == include "style.css.str", background_color: @page[:style, :background_color] || "red"
body == yieldLayouts may optionally use [_front_matter].
Layouts may be nested. Just use another layout attribute in your layout.
---
# _layouts/post.slim
layout: default.slim
title: <%= @page[:post, :title] %>
tags: [post]
---
h1#title = @page[:post. :title]
span#date = @page[:post, :date]
.post_content == yieldPartials
You may place partials in _include/.
/* _include/style.css.str */
#{
if local[:red_text]
'* {color: red}'
end
}
body {
background-color: #{local[:background_color]};
}Standalone asciidoc
You can create standalone asciidoc pages (without a layout) using the standalone option.
---
# index.html.adoc
options:
standalone: true
---
:linkcss:
:stylesdir: css
= My Website---
# css/asciidoctor.css.erb
---
<%=
require "asciidoctor"
Asciidoctor::Stylesheets.instance.primary_stylesheet_data
%>Front Matter
The YAML front matter has the be placed at the start of the file and surrounded by 2 lines containing 3 dashes (---).
The following attributes are understood by Edward:
-
layout: Use a layout found in_layouts/. This attribute is not shared between files. See also Layouts. -
options: Options to be passed to the templating engine. This attribute is not shared between files. See also [pipelines]. -
tags: For use in a few built-in helpers. See [tags].
All other attributes may be used freely.