aboutsummaryrefslogtreecommitdiff
path: root/lua/muwiki/templates.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/muwiki/templates.lua')
-rw-r--r--lua/muwiki/templates.lua35
1 files changed, 0 insertions, 35 deletions
diff --git a/lua/muwiki/templates.lua b/lua/muwiki/templates.lua
deleted file mode 100644
index c8dcd13..0000000
--- a/lua/muwiki/templates.lua
+++ /dev/null
@@ -1,35 +0,0 @@
-local config = require('muwiki.config')
-local fs = require('muwiki.fs')
-
-local M = {}
-
-local function process_template(template, title)
- local date_fmt = config.options.date_fmt or '%Y-%m-%d'
- local date = os.date(date_fmt)
- local result = template:gsub('${title}', title):gsub('${date}', date)
-
- if not result:match('\n$') then
- result = result .. '\n'
- end
-
- return result
-end
-
-function M.init_file(bufnr, filepath)
- if fs.file_exists(filepath) then
- return
- end
-
- local filename = vim.fs.basename(filepath)
-
- if config.options.use_template then
- local title = filename:gsub('%.md$', ''):gsub('_', ' ')
- local content = process_template(config.options.template, title)
- local lines = vim.split(content, '\n', { plain = true })
- vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, lines)
- end
-
- vim.notify(string.format('%s (unsaved)', filename), vim.log.levels.INFO)
-end
-
-return M