Skip to content
René 'Necoro' Neumann edited this page Jan 3, 2024 · 5 revisions

Detailed Options

This page contains information about those options in the config.yml that cannot be described in full in the config.yml.example

item-filter

item-filter allows to specify a filtering function that returns true when an item of a feed should be included. Use cases might be filtering by category or author.

The function is stated in the expr DSL (Language Definition) and gets passed an instance of a gofeed.Item (Docs) which provides all the fields necessary.

NB: This filter is applied after parsing the feed and after gofeed has translated the myriads of XML tags into its simpler structure. If you really need XML content for filtering, you should write the filter script yourself and use exec instead of a URL.

Examples

  • Only get items with a certain category: "Book" in Categories
  • Only get items within a set of categories any(Categories, {# in ["Book", "Literature", "Story"]})
  • Do not get items of this weirdo author: Author.Name != "Weirdo"
  • The feed duplicates all items, do not get those where the GUID ends with "-1": !(GUID endsWith "-1") or !(GUID matches "-1$")

exec

exec allows to specify a script that generates the feed instead of specifying a URL that is fetched. Use cases include advanced feed filtering, obscure firewall setup, or really generating your own feed.

exec takes an array of arguments instead of a single string to avoid any parsing. Thus everything is passed exactly like specified, and also you cannot use shell constructs like pipes. If you need something like this, write a script and call that.

The executable must provide the feed content, and only it, on stdout.

Examples

  • url is boring, fetch via wget: ["wget", "https://example.com/rss", "-O", "-"]
  • Some filter script: ["./filter.sh"]

text-template / html-template

Templates are, by default, compiled into the feed2imap-go executable (default HTML / default text). It is possible however to specify custom template files to use in lieu of the default.

The templates are written using Go's template language and get passed an instance of github.com/Necoro/feed2imap-go/internal/feed.Item (Docs / Source). Additionally, a couple of utility functions is provided.

When writing your own template, please take a look at the default templates for general structure and semantics. Using the --dry-run switch of feed2imap-go, you can validate that there won't be any compilation issues with your templates.