Skip to content

LevitatingBusinessMan/edward

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 serve

Layouts

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 == yield

Layouts 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 == yield

Partials

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors