@@ -16,6 +16,7 @@ local utils = require('orgmode.utils')
16
16
--- @field sections_by_line table<number , Section>
17
17
--- @field source_code_filetypes string[]
18
18
--- @field is_archive_file boolean
19
+ --- @field archive_location string
19
20
--- @field clocked_headline Section
20
21
--- @field tags string[]
21
22
local File = {}
322
323
323
324
--- @return string
324
325
function File :get_archive_file_location ()
325
- local matches = self :get_ts_matches (' (document (directive (name) @name (value) @value (#eq? @name "ARCHIVE")))' )
326
- if # matches > 0 then
327
- return config :parse_archive_location (self .filename , matches [1 ].value .text )
326
+ if self .archive_location then
327
+ return self .archive_location
328
328
end
329
329
return config :parse_archive_location (self .filename )
330
330
end
@@ -384,9 +384,13 @@ function File:_parse_directives()
384
384
local directives = self :get_ts_matches ([[ (directive name: (expr) @name value: (value) @value)]] )
385
385
local tags = {}
386
386
for _ , directive in ipairs (directives ) do
387
- if directive .name .text :lower () == ' filetags' then
387
+ local directive_name = directive .name .text :lower ()
388
+ if directive_name == ' filetags' then
388
389
utils .concat (tags , utils .parse_tags_string (directive .value .text ), true )
389
390
end
391
+ if directive_name == ' archive' then
392
+ self .archive_location = config :parse_archive_location (self .filename , directive .value .text )
393
+ end
390
394
end
391
395
self .tags = tags
392
396
end
0 commit comments