Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
# Adds links to Perseus Project parsed dictionary entries to a selection of Latin text
# Usage:
# 1) Save Latin in text file, ex. latin.txt
# 2) tufts-to-latin.sh latin.txt > latin.html
# 3) open latin.html in a web browser
source_file=$1
sed -e 's;\b\([a-zA-z][a-zA-Z]*\)\b;<a href="https://www.perseus.tufts.edu/hopper/morph?l=\1\&la=la" target="_blank" rel="noopener noreferrer">\1</a>;g;s/$/<br>&/g' "${source_file}"