-
-
Notifications
You must be signed in to change notification settings - Fork 1
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 byvino-entry-rate. -
vino-entry-template: Used byvino-entry-createfor general wine entries. -
vino-country-template: Used byvino-country-create. Also triggered when selecting origin. -
vino-region-template: Used byvino-region-create. Also triggered when selecting origin. -
vino-appellation-template: Used byvino-appellation-create. Also triggered when selecting origin. -
vino-grape-template: Used byvino-grape-createand in wine entry creation flow. -
vino-producer-template: Used byvino-producer-createand in wine entry creation flow.
These templates adhere to the vulpea-create API and are structured as property lists, supporting the following attributes:
-
:file-name(Mandatory): File name, relative tovulpea-default-notes-directory. -
:head(Optional): Additional header content for the note. -
:body(Optional): Main body of the note. -
:properties(Optional): Additional properties for thePROPERTIESblock. -
:context(Optional): Extra variables used in:file-name,:head,:body. Seevulpea-createfor more details. -
:tags(Optional): Additional tags, alongside mandatory ones specific to each note type (e.g.,wineandgrapefor grape notes).
Template strings support the following variables:
-
${slug}: URL-friendly slug generated from the note title -
${timestamp}: Timestamp inYYYYMMDDHHmmSSformat -
${id}: Unique ID of the note - Any custom variables passed via
:context
Here is an example of how a template might be configured for grape notes:
(setq vino-grape-template
'(:file-name "wine/grape/${timestamp}-${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.
Here are examples of other templates with various customizations:
;; Producer template with custom body
(setq vino-producer-template
'(:file-name "wine/producer/${timestamp}-${slug}.org"
:body "* Notes\n\n* Wines\n"))
;; Region template with custom context variable
(setq vino-region-template
'(:file-name "wine/region/${country}/${timestamp}-${slug}.org"
:head "#+description: Wine region"
:context (:country "unknown")))
;; Rating template with additional properties
(setq vino-rating-template
'(:file-name "wine/rating/${timestamp}-${slug}.org"
:properties (("CATEGORY" . "wine-rating"))
:tags ("private")))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.