Skip to content

Journal Templates #349

Answered by lervag
sez11a asked this question in Q&A
Apr 24, 2024 · 5 comments · 5 replies
Discussion options

You must be logged in to vote

Ah, sorry, I just remembered - the match_re is only matched against the name, not the path. So, you should do this:

vim.g.wiki_journal = {
  date_format = {
    daily = '%Y/%m/%d',
    weekly = '%Y/week_%V',
    monthly = '%Y/%m/summary',
  },
}
vim.g.wiki_templates = {
  {
    match_func = function(context)
      return context.path_wiki:find "%d%d%d%d/%d%d/%d%d"
    end,
    source_filename = "/path/to/templates/daily.md"
  },
},

Notice, here we use Lua patterns, since we are matching with a Lua function.

Replies: 5 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@sez11a
Comment options

@sez11a
Comment options

@lervag
Comment options

Answer selected by sez11a
@sez11a
Comment options

@lervag
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants