Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Message Templates (templates without HTML Forms) #438

Merged
merged 2 commits into from
Jan 20, 2024

Conversation

martinhpedersen
Copy link
Member

This adds supports for templating features typically used in text-only templates:

  • <Ask ...> and <Select ...> tags
  • Def: variable=value (typically used in combination with the above to initalize a template variable)

I did some refactoring in order to use the same set of insertion tags for text templates as for the HTML forms.

Resolves #375.

I used this as a reference: http://www.philsherrod.com/Winlink/RMS_Express_Message_Templates.pdf.

Also make the search case-insentitive since caseness is not strictly
handled in HTML forms. Unsupported insertion tags are logged (debug).
@martinhpedersen martinhpedersen added this to the v0.16.0 milestone Jan 1, 2024
@martinhpedersen martinhpedersen self-assigned this Jan 1, 2024
@martinhpedersen martinhpedersen changed the base branch from develop to master January 1, 2024 13:06
@martinhpedersen martinhpedersen changed the base branch from master to develop January 1, 2024 13:06
@@ -1016,65 +995,170 @@ func (b formMessageBuilder) scanTmplBuildMessage(tmplPath string) (MessageForm,
}
defer infile.Close()

placeholderRegEx := regexp.MustCompile(`<[vV][aA][rR]\s+(\w+)\s*>`)
placeholderRegEx := regexp.MustCompile(`(?i)<Var\s+(\w+)\s*>`)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated cleanup here. (?i) makes the regular expression case-insensitive 🙂

@martinhpedersen
Copy link
Member Author

Thanks for the reviews 😊

@martinhpedersen martinhpedersen merged commit 5ff709a into develop Jan 20, 2024
8 checks passed
@martinhpedersen martinhpedersen deleted the feature/text-templates branch January 20, 2024 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants