code: cleaned up
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
" Functions to create the front matter {{{1
|
||||
" Functions to create the front matter
|
||||
" Helper function to put string in double quotes, and remove inside double
|
||||
" quotes.
|
||||
function s:escapeDQ(s)
|
||||
@@ -10,7 +10,7 @@ function s:md_new_yaml(id, title, tags)
|
||||
return [
|
||||
\ '---',
|
||||
\ 'title: ' .. s:escapeDQ(a:title),
|
||||
\ 'date: ' .. strftime("%FT%T%z"),
|
||||
\ 'date: ' .. strftime('%FT%T%z'),
|
||||
\ 'tags: [' .. map(copy(a:tags), {_, t -> s:escapeDQ(t) })->join(', ') .. ']',
|
||||
\ 'identifier: ' .. s:escapeDQ(a:id),
|
||||
\ '---'
|
||||
@@ -22,7 +22,7 @@ function s:md_new_toml(id, title, tags)
|
||||
return [
|
||||
\ '+++',
|
||||
\ 'title ' .. s:escapeDQ(a:title),
|
||||
\ 'date ' .. strftime("%FT%T%z"),
|
||||
\ 'date ' .. strftime('%FT%T%z'),
|
||||
\ 'tags [' .. map(copy(a:tags), {_, t -> s:escapeDQ(t) })->join(', ') .. ']',
|
||||
\ 'identifier ' .. s:escapeDQ(a:id),
|
||||
\ '+++'
|
||||
@@ -33,7 +33,7 @@ endfunction
|
||||
function s:plain_new(id, title, tags)
|
||||
return [
|
||||
\ 'title: ' .. a:title,
|
||||
\ 'date: ' .. strftime("%F"),
|
||||
\ 'date: ' .. strftime('%F'),
|
||||
\ 'tags: ' .. a:tags->join(' '),
|
||||
\ 'identifier: ' .. a:id,
|
||||
\ '---------------------------',
|
||||
@@ -44,7 +44,7 @@ endfunction
|
||||
function s:org_new(id, title, tags)
|
||||
return [
|
||||
\ '#+title: ' .. a:title,
|
||||
\ '#+date: [' .. strftime("%F %a %R") .. ']',
|
||||
\ '#+date: [' .. strftime('%F %a %R') .. ']',
|
||||
\ '#+filetags: :' .. map(copy(a:tags), {_, t -> substitute(t, ':', '', 'g') })->join(':') .. ':',
|
||||
\ '#+identifier: ' .. a:id,
|
||||
\ ]
|
||||
|
||||
Reference in New Issue
Block a user