I have written /Users/ge/Dropbox/markdown/blot.im/blot-asset-locator.rb, a cute little Ruby script to map a Blot post to its corresponding assets folder:
#!/usr/bin/env ruby
TESTMODE=false
SUBPATH=Regexp.new(/^.*\/Posts(.*)\.md$/)
ASSETS=%q{/Users/ge/Dropbox/Apps/Blot/_assets}
pn = ARGV[0]
sp=pn.match(SUBPATH)[1]
printf( %Q{assets: %s%s\n}, ASSETS, sp )
I have also written an espanso macro that expands this command
:assets
to this vim command:
:r ! /Users/ge/Dropbox/markdown/blot.im/blot-asset-locator.rb %
For example, in this markdown file, /Users/ge/Dropbox/Apps/Blot/Posts/2021/01/11/blot-asset-locations.md, the espanso command will insert the following metadata into this file:
assets: /Users/ge/Dropbox/Apps/Blot/_assets/2021/01/11/blot-asset-locations