Skip to content

Commit fb38130

Browse files
author
Alec Stewart
committed
feat(capture): Make sure tags are written as :tag: and not just plain text.
1 parent f47f4a0 commit fb38130

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

lua/orgmode/capture/template/init.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ local function prompt_tags(single, tags_source)
8181

8282
local tags = utils.parse_tags_string(input)
8383
if single then
84-
return tags[1] or ''
84+
return tags[1] and utils.tags_to_string({ tags[1] }) or ''
8585
end
8686

87-
return table.concat(tags, ':')
87+
return utils.tags_to_string(tags)
8888
end)
8989
end
9090

tests/plenary/capture/templates_spec.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ describe('Capture template', function()
9898
local template = Template:new({
9999
template = '* TODO %^g',
100100
})
101-
assert.are.same({ '* TODO mytag' }, template:compile():wait())
101+
assert.are.same({ '* TODO :mytag:' }, template:compile():wait())
102102
end)
103103
end)
104104

@@ -109,7 +109,7 @@ describe('Capture template', function()
109109
local template = Template:new({
110110
template = '* TODO %^G',
111111
})
112-
assert.are.same({ '* TODO tag1:tag2' }, template:compile():wait())
112+
assert.are.same({ '* TODO :tag1:tag2:' }, template:compile():wait())
113113
end)
114114
end)
115115

@@ -120,7 +120,7 @@ describe('Capture template', function()
120120
local template = Template:new({
121121
template = '* TODO %^{tag1|tag2}G',
122122
})
123-
assert.are.same({ '* TODO tag1' }, template:compile():wait())
123+
assert.are.same({ '* TODO :tag1:' }, template:compile():wait())
124124
end)
125125
end)
126126

@@ -160,7 +160,7 @@ describe('Capture template', function()
160160
template = '* TODO %^g',
161161
target = files['target.org'],
162162
})
163-
assert.are.same({ '* TODO target_headline' }, template:compile():wait())
163+
assert.are.same({ '* TODO :target_headline:' }, template:compile():wait())
164164
end)
165165
end)
166166

@@ -188,7 +188,7 @@ describe('Capture template', function()
188188
local template = Template:new({
189189
template = '* TODO %^G',
190190
})
191-
assert.are.same({ '* TODO target_headline:other_headline' }, template:compile():wait())
191+
assert.are.same({ '* TODO :target_headline:other_headline:' }, template:compile():wait())
192192
end)
193193
end)
194194
end)

0 commit comments

Comments
 (0)