Dotfiles, utilities, and other apparatus.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
357 B

  1. #!/bin/sh
  2. cd "$HOME/notes/" || exit 1
  3. catenate () {
  4. printf '%%%% %s {{{\n\n' "$1"
  5. cat "$1"
  6. printf '\n%%%% }}}\n\n'
  7. }
  8. pagename=$(basename "$1" .wiki)
  9. printf '%%%% logs for: %s\n\n' "$pagename"
  10. notes-links-for --target "$pagename" \
  11. | grep -E '/(log|diary)/' \
  12. | sort -r \
  13. | cut -f1 -d':' \
  14. | while read -r entry
  15. do
  16. catenate "$entry"
  17. done