Skip to content

Templates

Boris Buliga edited this page Jul 16, 2024 · 2 revisions

File Templates

Vino utilizes specific templates for creating different types of notes, each tailored to the note type. These templates are integral to various interactive functions within Vino. Below is an overview of the templates and their associated functions:

  • vino-rating-template: Used in the wine rating process by vino-entry-rate.
  • vino-entry-template: Used by vino-entry-create for general wine entries.
  • vino-country-template: Used by vino-country-create. Also triggered when selecting origin.
  • vino-region-template: Used by vino-region-create. Also triggered when selecting origin.
  • vino-appellation-template: Used by vino-appellation-create. Also triggered when selecting origin.
  • vino-grape-template: Used by vino-grape-create and in wine entry creation flow.
  • vino-producer-template: Used by vino-producer-create and in wine entry creation flow.

Template Structure

These templates adhere to the vulpea-create API and are structured as property lists, supporting the following attributes:

  • :file-name (Mandatory): File name, relative to org-roam-directory.
  • :head (Optional): Additional header content for the note.
  • :body (Optional): Main body of the note.
  • :properties (Optional): Additional properties for the PROPERTIES block.
  • :context (Optional): Extra variables used in :file-name, :head, :body. See vulpea-create for more details.
  • :tags (Optional): Additional tags, alongside mandatory ones specific to each note type (e.g., wine and grape for grape notes).

Example Template

Here is an example of how a template might be configured for grape notes:

(setq vino-grape-template
      '(:file-name "wine/grape/%<%Y%m%d%H%M%S>-${slug}.org"
        :tags ("barberry/public")))

In this example, the vino-grape-template is set up to create a file with a specific naming convention in the wine/grape directory, and it includes additional tags for categorization purposes.

Enforced Values

When a new note is created in Vino, certain template values are enforced. First, required tags are automatically added, even if they are not included in the template. For example, if you omit the wine or grape tags in the vino-grape-template, Vino will still enforce these tags.

Additionally, Vino ensures that region and appellation notes include the country and, optionally, the parent region (if provided).

Both behaviours are mandatory and cannot be disabled.