middleman-blog + LinCastor

middleman-blogでローカル環境のみでmy-blog://new?name=sushiのようなリンクを埋込み、
LinCastorでそれをhandlingするようにした。
LinCastorは任意のapple script/shell/appの実行ができるので、応用範囲が広そう。
エディタに関しては、asuth/subl-handlerを使っている。
LinCastorの設定
- iTermを開く
<a href="my-term://?dir=/path/to/directory">[term]</a>
(* apple script *)
on handle_url(args)
tell application "iTerm"
activate
try
set _session to current session of current terminal
on error
set _term to (make new terminal)
tell _term
launch session "Default"
set _session to current session
end tell
end try
tell _session
write text "cd " & |URL_QUERY_DIR| of args
write text "clear"
write text "git st"
end tell
end tell
end handle_url
- 記事
- 新規作成
<a href="my-blog://new?name=aa">[new]</a>
- 公開
<a href="my-blog://publish">[publish]</a>
- 新規作成
#!/usr/local/bin/zsh source ~/.zshrc cd /Users/fukayatsu/github/fukayatsu.github.io if [[ $URL_HOST = new ]]; then bundle exec middleman article $URL_QUERY_NAME elif [[ $URL_HOST = publish ]]; then git checkout source git add . git commit -m "Update Posts [button]" git push origin source else exit 1 fi exit 0