summaryrefslogtreecommitdiff
path: root/lib/md.source.sh
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2021-05-11 19:54:23 +0100
committerPaul Buetow <paul@buetow.org>2021-05-11 19:54:23 +0100
commite569faa91f0f8906c416113010c755fd5cdc79b2 (patch)
treeb0c69a140c6b3e84aeefdc5df4dd23292bce0df1 /lib/md.source.sh
parente19b4a4b4287c10592ac59a09f1ec29293d29c08 (diff)
refactor
Diffstat (limited to 'lib/md.source.sh')
-rw-r--r--lib/md.source.sh55
1 files changed, 0 insertions, 55 deletions
diff --git a/lib/md.source.sh b/lib/md.source.sh
deleted file mode 100644
index 197bdcf7..00000000
--- a/lib/md.source.sh
+++ /dev/null
@@ -1,55 +0,0 @@
-md::make_img () {
- local link="$1"; shift
- local descr="$1"; shift
-
- if [ -z "$descr" ]; then
- echo "[![$link]($link)]($link) "
- else
- echo "[![$descr]($link \"$descr\")]($link) "
- fi
-}
-
-md::make_link () {
- local link="$1"; shift
- local descr="$1"; shift
-
- grep -F -q '://' <<< "$link" || link=${link/.gmi/.md}
- test -z "$descr" && descr="$link"
-
- echo "[$descr]($link) "
-}
-
-md::test () {
- local line='=> https://example.org'
- assert::equals "$(generate::make_link md "$line")" \
- '[https://example.org](https://example.org) '
-
- line='=> index.md'
- assert::equals "$(generate::make_link md "$line")" \
- '[index.md](index.md) '
-
- line='=> http://example.org Description of the link'
- assert::equals "$(generate::make_link md "$line")" \
- '[Description of the link](http://example.org) '
-
- line='=> http://example.org/image.png'
- assert::equals "$(generate::make_link md "$line")" \
- '[![http://example.org/image.png](http://example.org/image.png)](http://example.org/image.png) '
-
- line='=> http://example.org/image.png Image description'
- assert::equals "$(generate::make_link md "$line")" \
- '[![Image description](http://example.org/image.png "Image description")](http://example.org/image.png) '
-}
-
-md::fromgmi () {
- while IFS='' read -r line; do
- case "$line" in
- '=> '*)
- generate::make_link md "$line"
- ;;
- *)
- echo "$line"
- ;;
- esac
- done
-}