Raccoon

Open source document template compositor and router

Raccoon composites documents with a simple template system.

Raccoon uses standard markup language and template markup language to composite templates.

Distribution

Raccoon is distributed as open source and without license restriction. Information about the license is referenced in the included document: license.txt. Information about development is referenced in the included documents: notice.txt, version.txt.

Raccoon 0.3.3 is written in the Go 1.11.0 programming language and is distributed as open source code.

Compilation

Raccoon is written in the Go programming language and depends on the standard library to compile. Raccoon is developed and supported on select systems: linux/amd64, linux/arm64, darwin/amd64, darwin/arm64.

Raccoon compiles with different options: test, run, build, clean, install. The compile script is optional and automates the compile process.

% ./compile.sh run

Operation

Raccoon is operated through a command line interface. The default path is /usr/local/bin/raccoon. The default paths can be changed with command options.

For security purposes, the process should be restricted to a dedicated raccoon user and raccoon group on the system.

Help

Print the help document.

% raccoon -help

Version

Print the version number.

% raccoon -version

Cache

Set the template cache mode. For performance purposes, template cache is recommended.

% raccoon -cache

Verbose

Set the verbose log mode. For security purposes, verbose should be restricted to console log sessions.

% raccoon -verbose

Input Log

Set the standard input log file path. The default path is /usr/local/var/log/raccoon/input.log.

% raccoon -log-input path

Output Log

Set the standard output log file path. The default path is /usr/local/var/log/raccoon/output.log.

% raccoon -log-output path

Error Log

Set the standard error log file path. The default path is /usr/local/var/log/raccoon/error.log.

% raccoon -log-error path

Configuration

Set the configuration file path. The default path is /usr/local/etc/raccoon.cfg.

% raccoon -cfg path

Configuration

Raccoon is intended to operate behind a reverse proxy. For security purposes, the configuration file should be restricted to a dedicated raccoon user and raccoon group on the system.

Global Configuration

The global configuration section defines: server.

Define multiple servers for concurrent server processes.

{
  "server": [
    { ... },
    { ... }
  ]
}

Server Configuration

The server configuration section defines: hostname, port, template extension, template root, main template, index template.

{
  "hostname": "localhost",
  "port": "0000",
  "template_extension": ".html.go",
  "template_root": "/usr/local/var/www/example/",
  "template_main": "main",
  "template_index": "index"
}

Template

Templates are a combination of standard markup language and the template markup language. If templates include comments, the comments are removed when the templates are processed.

File System

Raccoon will parse templates in the template root path, and will recurse into nested paths. The main template and index template are required.

/example/main.html.go
/example/index.html.go
/example/colors.html.go
/example/colors/avocado.html.go
/example/colors/orchid.html.go

Locator Translation

The file system paths are translated into uniform resource locator paths. Locators are accessible with or without a trailing slash.

https://localhost
https://localhost/colors
https://localhost/colors/avocado
https://localhost/colors/orchid

Main Template

The main template is required and defines the global document elements.

{{define "main"}}
<html>
  <head>
    <title>{{template "title"}}</title>
  </head>
  <body>
    {{template "header" .}}
    {{template "content" .}}
    {{template "footer" .}}
  </body>
</html>
{{end}}

The global document elements referenced in the main template definition are also included in the main template.

{{define "header"}}
<header>
  <div>Example Header</div>
</header>
{{end}}
{{define "footer"}}
<footer>
  <div>Example Footer</div>
</footer>
{{end}}

Index Template

The index template is required and defines the document index. All supporting templates are defined with the same format.

{{define "title"}}Example Title{{end}}
 
{{define "content"}}
<main>
  <div>Example Content</div>
</main>
{{end}}