export LANGUAGE_DEFAULT="${LANGUAGE_DEFAULT:-en}"
export HTTP_REFERER="${HTTP_REFERER:-$(HEADER Referer)}"
-export LANGUAGE=''
+export LANGUAGE ERROR_MSG
mdfile(){
# Override mdfile Selection from tools.sh
# by printf when stdout was closed
}
+# UGLY! UGLY! UGLY!
+# Override markdown processor from `tools.sh` to add link suffixes
+# -> better implement a parser stack, i.e. pipeline markdown + other parser plugins
+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
+
case ${HTTP_REFERER} in
*/:*/*):;;
*/:*)