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 the latest version and is distributed as open source code.

Compilation

Raccoon is written in the Go programming language and depends on the standard library to compile. Go is compatible with common server operating systems and processor architectures. 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

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

Verbose

Set the verbose process mode. The verbose mode should be false for security purposes. Set the verbose mode to true to print all process information.

The default mode is false.

% raccoon -verbose=boolean

Template Cache

Set the template cache mode. The cache mode should be true for performance purposes. Set the cache mode to false to parse template modifications.

The default mode is true.

% raccoon -cache=boolean

Input Log

Set the input log file path. The process will log standard input to the input log file. The process will generate the input log file when missing.

The default path is /usr/local/var/log/raccoon/input.log.

% raccoon -log-input=string

Output Log

Set the output log file path. The process will log standard output to the output log file. The process will generate the output log file when missing.

The default path is /usr/local/var/log/raccoon/output.log.

% raccoon -log-output=string

Error Log

Set the error log file path. The process will log standard error to the error log file. The process will generate the error log file when missing.

The default path is /usr/local/var/log/raccoon/error.log.

% raccoon -log-error=string

Configuration

Set the configuration file path. The process will generate the configuration file when missing.

The default path is /usr/local/etc/raccoon.cfg.

% raccoon -cfg=string

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"
}

Templates

Templates are a combination of standard markup language and the template markup language. If documents 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}}