zabouti |||

Mapping Posts to their Assets

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
Up next Pauline Harmange The Solid Project
Latest posts Timothy Snyder’s History of Ukraine Fake Email Senders More on language learning Effect and Cause Soros is my Co-Pilot Note à une chère amie Arnold Schwarzenegger Why Purim upsets me I was a Programmer Who Swore Constantly I perceive new things as my nerves slow down B&N’s new president Learning French with the FSI Method Release time Xtian education in public school The Bastard! He doesn’t exist! I used to have so much fun cutting pictures and words out of magazines and newspapers Photoshop brushes drive me crazy! I warn people about confusing Dropbox behavior 2022-01-12 Tunisia’s spicy Harissa gets UNESCO heritage status Today is Thanksgiving 2022, aka Turkey Day. Proposed Driving Itinerary of the Cathar Region How you know when your volleyball-playing days are over Saeed Jones Why history moves in cycles Shopping lists Frédéric Bruly Bouabré « L’alphabet de l’ouest africain » American Anti-Government sentiment Proof that the Earth’s Climate is Not Changing Our Poor Kitchen The NY Times has a Telegram channel Amazon loses my smile History versus the UNC Press fire of 1990