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 Vocabulary lesson Iris and I had an interesting discussion with Google Bard this morning. Discussion on the Pomona College class of 1964 listserv I’m illiterate Elon Musk I love photographing the artists at Wildacres Eating a Mouse It Really is a Fascist Flag (at least to some Americans) I love the New York Times Metropolitan Diary Watching The Ten Commandments in Gafsa, Tunisia, in the sixtes I wanna be like these guys when I’m their age! The insignificance of photography Enough photos from our trip to Japan MoveOn wants to amend the Constitution? Google Sheet Number Formatting Summer Brake Romantic technologies and ideologies PITY THE NATION Basho’s poem, Even in Kyoto War in Ukraine - an explanation 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