Bake is a templated blog generator.
C C++ JavaScript CSS CMake HTML Makefile
Switch branches/tags
Nothing to show
Clone or download
felipetavares Merge pull request #5 from david-moran/master
Problem compiling on FreeBSD with clang toolchain fixed
Latest commit 21d9d26 Oct 28, 2016
Permalink
Failed to load latest commit information.
output Added images Jun 15, 2015
sundown Added licenses. Improved README a bit. Jun 5, 2015
templates Updated RSS template Jul 11, 2015
.gitignore git now ignores build/ Sep 4, 2015
CMakeLists.txt Problem compiling on FreeBSD with clang toolchain fixed. HAVE_TIME_H … Aug 2, 2016
Example.markdown Windows support Aug 23, 2015
LICENSE Added licenses. Improved README a bit. Jun 5, 2015
Makefile git now ignores build/ Sep 4, 2015
README.md Code refactoring, introduced index_output key Apr 16, 2016
bake.cpp Code refactoring, introduced index_output key Apr 16, 2016
bake.hpp Code refactoring, introduced index_output key Apr 16, 2016
bakefile Code refactoring, introduced index_output key Apr 16, 2016
bakefile.cpp Code refactoring, introduced index_output key Apr 16, 2016
bakefile.hpp Code refactoring, introduced index_output key Apr 16, 2016
config.h.cmakein Add support to compile the project with CMake+MSVC on Windows Sep 3, 2015
feed Code refactoring, introduced index_output key Apr 16, 2016
post.cpp Code refactoring, introduced index_output key Apr 16, 2016
post.hpp Code refactoring, introduced index_output key Apr 16, 2016
printer.cpp Code refactoring, introduced index_output key Apr 16, 2016
printer.hpp Code refactoring, introduced index_output key Apr 16, 2016
template.cpp Code refactoring, introduced index_output key Apr 16, 2016
template.hpp Code refactoring, introduced index_output key Apr 16, 2016
windows.cpp Code refactoring, introduced index_output key Apr 16, 2016
windows.hpp Add support to compile the project with CMake+MSVC on Windows Sep 3, 2015

README.md

Bake

Bake is a templated blog generator.

Bake was originally writen in C, for use as blogging tool at ctrl-c club. This version is a new implementation in C++.

You can see an example blog that uses Bake here. Another in here.

Bake is intended to be used in a make-like fashion:

  1. Create a directory, enter it
  2. Write a file named bakefile containing some rules about how to process the input.
  3. Write a template file anywhere you like (the bakefile should point to it)
  4. Write blog posts in the format .markdown
  5. Run bake

Quick Start

If you are just hacking around, try the following:

git clone http://github.com/felipetavares/bake.git
cd bake
make
sudo make install
bake

Now open bake/output/index.html in a browser.

Compiling with CMake (under *nix)

To compile with CMake, you can (after cloning and entering the repository):

mkdir build
cd build
cmake ..
make

Bakefile

The bakefile should be named bakefile in lower case without any extension, just like you see it here (an example bakefile is provided, go take a look!).

The bakefile is composed of key-value pairs, separated by an = symbol. Only one of these key-value pairs is allowrd per line.

All whitespace characters found in the key are removed, what means that all the keys below are equivalent:

key=
k ey=
key =

The same goes for the value:

key = value
key=value
key = v a l u e

are all the same.

If you desire to use whitespace characters in the value, put it between quotation marks "":

name = "Felipe Tavares"

You can put any keys in your bakefile, but the ones that have real functionality are:

  • lang - used to set the locale used by locale-specific functions (dates)
  • template - path to the template file
  • output - path to the output file, if it's a directory, an index.html will be generated, plus a .html for each post.
  • date - formatting string in the strftime format.
  • host - url to the directory where output is located.
  • hash - if set to true hash all post links using k33.

Note about dates: you can set a custom date for a post by using @ in its first line (or its second, if the first contains an author, see below). The rest of the line will be copied to the {date} variable.

Available {vars}

These are the vars available for use in the template. All vars must be inside the main {} that defines the extension of a single post.

  • {:varname} - : is a syntax for html-escaped variables, e.g.: < is converted to &lt; etc)
  • {content} - post content
  • {title} - post title
  • {date} - post date, formated as specified by the date key in the bakefile.
  • {id} - post id (used by permalinks)
  • {link} - permalink to the post, uses the id var.
  • {author} - post author, defined in the first line of each post, if not defined, the unix user name is used instead (from passwd)

Note about authors: to define an author for a post, begin the first line of a post with a tilde ~ character. The rest of the line until a \n is found will be saved to {author}.

Feeds

Bake supports custom feeds. You can create your custom template or use the one that comes with it. You can generate your feed by creating a custom bakefile for it and namig it for example feed, then, you can bake it with:

bake feed

this way Bake will read the feed file as bake file and bake your custom feed. There is a feed bakefile example that you can use to learn how it works.

Contributors

I would like to thanks these guys for their support and for submiting pull requests: