--- /dev/null
+#!/bin/sh
+
+if which awk >/dev/null; then
+ awk -f "$_EXEC/md_macros.awk" -f "$_EXEC/cgilite/markdown.awk"
+ # | sed -E 's;(<[^>]+ )href="((/[^"/]+|[^"/]+[^:/]|)/([^"/]+/)*)"([^>]*>);\1href="\2:'"${LANGUAGE}"'"\5;g'
+elif which busybox >/dev/null; then
+ busybox awk -f "$_EXEC/md_macros.awk" -f "$_EXEC/cgilite/markdown.awk"
+ # | sed -E 's;(<[^>]+ )href="((/[^"/]+|[^"/]+[^:/]|)/([^"/]+/)*)"([^>]*>);\1href="\2:'"${LANGUAGE}"'"\5;g'
+else
+ cat
+fi
[ "$include_tools" ] && return 0
include_tools="$0"
-if [ "$(which awk)" ]; then
- md() {
- awk -f "$_EXEC/md_macros.awk" -f "$_EXEC/cgilite/markdown.awk" \
- | sed -E 's;(<[^>]+ )href="((/[^"/]+|[^"/]+[^:/]|)/([^"/]+/)*)"([^>]*>);\1href="\2:'"${LANGUAGE}"'"\5;g'
- }
-elif [ "$(which busybox)" ]; then
- md() {
- busybox awk -f "$_EXEC/md_macros.awk" -f "$_EXEC/cgilite/markdown.awk" \
- | sed -E 's;(<[^>]+ )href="((/[^"/]+|[^"/]+[^:/]|)/([^"/]+/)*)"([^>]*>);\1href="\2:'"${LANGUAGE}"'"\5;g'
- }
-else
- md() { cat; }
-fi
+md(){
+ local parser
+
+ if [ "$#" = 0 ]; then
+ md "${_EXEC}"/parsers/*
+ elif [ "$#" = 1 ]; then
+ "$1"
+ else
+ parser="$1"
+ shift 1
+ "$parser" |md "$@"
+ fi
+}
mdfile(){
# Check if page exists, if possible fall