• This repository has been archived on 25/Jan/2019
  • Stars
    star
    112
  • Rank 305,886 (Top 7 %)
  • Language
    Python
  • License
    Other
  • Created over 13 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A static website generator - Toss some content, templates, and media in a pan and fry it up!

Wok

Build Status

Wok is a static website generator. It turns a pile of templates, content, and resources (like CSS and images) into a neat stack of plain HTML. Wok is distributed under the MIT license (see the LICENSE file for more details).

The idea is that you don't need a big server-side engine like PHP to generate every page every visit: you can generate them all ahead of time, and only regenerate things when something has changed. A good way this could be done would be with a post-commit hook on a git repository containing your content or layout.

I made wok because projects like Jekyll, Hyde, and Static were intriguing, but in the end didn't quite match what I wanted to do with my website. So I am writing my own. Funnily, the mythical website that inspired wok still hasn't been written.

Sample Sites

A bare bones site is included in the wok git repo, in the test directory. It is really just a playground for devs to test new features, and not a good learning tool.

The documentation site available in the doc directory should be a fairly complete example of a small site that is good to learn from.

For some real world examples check out these sites.

For some more documentation, checkout the doc site. To learn and share with other users, you can check out the wiki.

Installation

The recommended way to install wok is from the Python Package Index with this command.

sudo pip install wok

Alternatively, if you want to hack on wok or just need the latest code, you can run from git head, and if you want to you can install to your system directories with this command. Note that you will need to install dependencies by hand in this case.

sudo python2 setup.py install

###Dependencies All dependencies are available from pip. Although optional, you really should install either markdown or docutils, and if you install from pip, they will be installed for you. Pygments is used for syntax highlighting, and will also be installed from pip.

####Required

  • pyyaml
  • jinja2

####Optional

  • Markdown - for rendering markdown documents.
  • docutils - for rendering reStructuredText documents.
  • Pygments - for syntax highlighting.

Usage

You might be interested in the tutorial

To use wok, go to the directory where your site files are located, and run the command wok. No output will be given unless something goes wrong. If it returns without error, you should have a shiny new output folder containing some HTML, and your media that represents your shiny new site.

To aid in testing links on the site, wok includes a development server. You can run it with the command wok --server, which will generate the site as normal, and then run a webserver on port 8080. The comments on that particular file say:

Do NOT attempt to use this as anything resembling a production server. It is meant to be used as a development test server only.

This test server is slow, and likely insecure, but for local testing of the site during development, it is really convenient.

Wok pulls the pieces of your site from three places. For each of these places, you can modify the path wok looks for them in the configuration file.

Content

Pulled from a directory named content by default. Content is written in lightweight markup or in plain text, with an optional YAML header section. The directory structure of the file mean nothing to wok. It builds the structure of the site based on the titles and the category metadata.

Since wok uses lightweight mark up languages like Markdown and reStructuredText, it is easy to do nice formatting in the pages without using a GUI editor or a cumbersome language like HTML. Built in syntax highlighting and media copying make things even easier.

More info

Templates

Pulled from templates by default. Wok uses Jinja2 templates, with various variables exposed to build pages. This is a very flexible templating environment with control flow, filters, and other ways to slice and dice the data that wok gives you.

More info

Configuration

Settings can be changed in the file config in the current directory.

Possible configuration options (and their defaults) are

  • output_dir ('output') - Where the outputted files are put.

  • content_dir ('content') - Where to find the content.

  • templates_dir ('templates') - Where the templates are.

  • media_dir ('media') - Where the media files are copied from.

  • site_title ('Some Random wok Site') - Available to templates as site.title.

  • author (No default) - Fills site.author, and provides a default to page.author.

  • url_pattern (/{category}/{slug}.html) - The pattern used to name and place the output files. The default produces URLs like /category/subcategory/foo.html. To get "wordpress style" urls, you could use /{category}/{slug}/index.html.

    Available variables:

    • {category} - The category of the site, slash seperated.
    • {slug} - The slug of the page.
    • {page} - The current page.
    • {ext} - The extension that the page should used.
    • {date}, {datetime}, and {time} - The date/time from the metadata of the page
  • url_include_index (Yes) - If true, keep index.* in urls.

More info: config, urls.

More Repositories

1

crimsontwins

We have these two big TVs on the wall. This is something to do with them.
JavaScript
25
star
2

abelian

A webring manager
JavaScript
7
star
3

chief-james

A script to automate Chief deploys.
Python
7
star
4

identicons

Generate random images from a seed value
Rust
6
star
5

wasm-density-bins-demo

An experiment in Rust and WASM
Rust
6
star
6

nbody

A small JavaScript canvas n-body gravity simulation.
JavaScript
4
star
7

edwin

A bug management system
JavaScript
4
star
8

taskwarrior-rofi

A tool to interact with taskwarrior quicklky
Rust
3
star
9

rust-nbodies

N-Bodies gravity simulation in Rust
Rust
3
star
10

page

Delivers messages to you from Weechat
Python
3
star
11

fireworks

Playing around with canvas
JavaScript
3
star
12

pl2-card-tracker

Pandemic Legacy Season 2 - Card tracker
TypeScript
3
star
13

geotif-image-processing

Convert geotif images into parquet files
Rust
3
star
14

HelloDave

An AVR assembly choose-your-own-adventure engine and story.
Assembly
2
star
15

PlaylistSync

A tool to intelligently copy music from a playlist to an external device.
Python
2
star
16

code_review

Teaching via code review.
JavaScript
2
star
17

mythmon.com

JavaScript
2
star
18

halide

a toy "interactive" "ray tracer"
Rust
2
star
19

bard

Bard tells the story of your Pathfinder RPG characters.
JavaScript
2
star
20

grid

A visual playground for cellular automata
Python
2
star
21

jyfes

Python
1
star
22

venver

A tool to create .venv file for my environment hooks.
CoffeeScript
1
star
23

carafe

A set of reusable d3 graphs.
JavaScript
1
star
24

powar

Rust
1
star
25

advent-of-code

Solutions to Advent of Code problems
Rust
1
star
26

kittenautomator

An automator for Kittens Game
JavaScript
1
star
27

cs480_milestones

Ruby
1
star
28

ears

GitHub post-recieve hook listener.
JavaScript
1
star
29

ten-foot-status

Status pages for the TV on the wall.
CSS
1
star
30

nanowrimo

NaNoWriMo 2014.
Vim Script
1
star
31

heroku-buildpack-python-nodejs

Heroku buildpack for Python apps with nodejs build steps
Shell
1
star
32

jexl-editor

JavaScript
1
star
33

Gates

An HTML5 game reminiscent of Asteroids in a gravity well.
JavaScript
1
star
34

fish-kitty

Kitty configuration for the Fish shell
Shell
1
star
35

former2

Catching and notifying for form submission
Python
1
star
36

texty

Text for TVs
JavaScript
1
star
37

vscode-idl

IDL Language support for VS Code
1
star
38

stormrun

Python
1
star
39

rust-gz-csv-test

A test of a simple task with Rust
Rust
1
star
40

Caffeine

A simple set of scripts to control inhibiting pm-utils sleeping and hibernating
Python
1
star
41

mozilla-sfmonument-data

I got some data about the Mozilla SF Monument. I parsed it. Now I'm sharing it.
1
star