What are chunks?
Chunk syntax describes the basic syntax.
Chunk names lists special chunk names.
Chunk opts let you control how a chunk is processed.
Chunk use gives you examples of chunk usage; ie. macros and escape.



Chunks are textfiles that have been split into named chunks using hashtags.


This is the sourcecode of waka or blog pages however in the future advanced editors will reduce the need to edit these text files instead allowing you to have a slightly more wysiwyg editing experience.



The chunks are a simple form of templating.


Generally speaking, you mark the start of a chunk by placing a # at the beginning of a line followed by the name of the chunk you wish to define. Any lines which follow this are considered part of that named chunk until you mark the start of another chunk.



Chunks by themselves would not be very useful.


What makes them useful is the ability to include chunks in other chunks by typing the name of the chunk surrounded by {} brackets like {thisisachunk}.

If I defined a chunk called #thisisachunk then {thisisachunk} would be replaced by its contents.
If I have not defined that chunk anywhere, it is simply left alone.

This means programming languages that use {} all over the place are relatively safe. As even in places where the plate system attempts to mess with them, it is very unlikely to do anything.



Another advantage of chunks is - they are inherited down page hierarchies so any chunks you create in the root can be used in sub pages.


To edit the root of the entire site, visit */?cmd=edit where * is your site domain.

Chunks you define there will be available to all wiki pages and all blog pages so it is the perfect place to store templates. You could say the root of your site contains the Master layout which can then be tweaked later for customised themes in the preceding directories.



The best way to learn is to take a look at pages on this site by adding .data to the end of any page.


For instance, .data will let you view the source of the main welcome page and .data will let you see all the base chunks we define on the Pagecake site to control all the pages within it.



When you edit a new waka page, you will be presented with two default chunks, #title which is the title of the page and #body which is the main content.

Some extra options can be added to these chunks, eg. form=waka where form is short for format and form=waka means you want to enable the simple html formatting that turns linebreaks into <br/> and converts any text that looks like a link into a clickable link.



By default, any chunkname that begins with "body" will be treated as form=waka by default. Also, any chunkname that begins with "title" will have white spaced trimmed from its beginning and end as if you had typed trim=ends in its options.

A chunk called #plate will combine title and body together into the actual html of a page. You will find that the #plate for this site is defined in //pagecake/.data and pulls in all sorts of other chunks when it comes to build a page.


Refer to: Chunk opts and Chunk syntax