Making a project
Mandy project structure
The only task of Mandy is to take content written in the Extended Jirai format, some HTML templating code, and a configuration file and use this information to produce a directory containing HTML files and other assets, if specified, and make these available and ready to serve as a fully-functional website. This directory with static HTML files and other assets will henceforth be referred to as a compiled Mandy project. The list below contains a list of the types of files in a Mandy project:
-
config.jmu: A file containing simple key-value pairs describing configuration values for a Mandy project. The format of this file is the Jirai Data Language. -
page.layout: This file type describes how the content inside a Mandy project is supposed to be laid out on a finished website. -
content.ejirai:.ejiraifiles files are the main characters in a Mandy project. They contain the content that a finished website displays. These files are written in the Extended Jirai format. -
data.jmu: A file containing a key that must be calleditemsand is located in the data directory of a Mandy project and gives users the ability to store any extra data as a dictionary.
The Configuration File
The configuration file is written in the Jirai Data Language and must contain the dist_dir key. The other following keys are optional:
-
copy_files: This key must contain a list of strings denoting any files or directories that should be copied to thedist_dirdirectory when the project is compiled. -
iter_content: This key must contain a list of directories that each contain any content you want to loop over. The key for the iterator in the template is the name of the directory. -
user_config: This key must contain a list of string key-value pairings containing any extra site-wide variables you may want to use in a template.
Layout Files
Layout files must be stored in the layouts directory of a Mandy project and these files determine the layout of the content on a page. These files must end in the .layout extension and are HTML templates. The content is rendered through variables inside the template. These template variables are surrounded by { and }. If an item is iterated over, the open curly braces and close curly braces are doubled. The following variables are accessible inside a template:
-
page.: This variable contains the data of each page. This shall be explained in more detail in the next section. -
data.: Any site data from thedatadirectory that can be present but must not be. -
site.config.: This variable gives one the URL of a content page.
Content Files
Each content file is written in the Extended Jirai format. This format has two sections. The first section contains data and the second section contains content. The content is written in the Jirai format. format. The data section is written in the same format as the configuration file. Together, they make up Extended Jirai. Each content file must have this format and must end in the .ejirai file extension. The variables that must be set in the data section are listed below and are accessed in a template via the {page.data} variable:
-
url: The URL of the page. -
content: The compiled HTML content of the page. -
layout: This variable tells Mandy which layout must be used for laying out the content present in the file. The stem of the layout file is used and Mandy will look for a layout of that name in thelayoutsdirectory automatically. -
title: The title of the page. A title is always required and important. -
description: The description of the page. A description is always required and important. -
user_config: Any other data you may have set on a page in the form of key-value pairings.
Data Files
Each data file is in the Jirai Data Language format and is located in the data directory at the root of a Mandy project. This directory can be present, but must not be. Every file in this directory must have a top-level key called items and the value of this key must be a list of JMU blocks containing string key-value pairings. The name of each file must have a name of the following pattern: name.jmu. The data in this file can be accessed in layouts by iterating over the variable data.name.items.