X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=tools.sh;h=2e98d674d764295b3e338fd3ca7a59c8c42ec0d9;hb=a88a2e833916c59ea6e99e9588543a58f02b9efe;hp=c5545fb92e0cecc8975627514b7d80b32ea16aff;hpb=8a93d4ef20815df18bfc1a580d3cffb8c6a31ea2;p=shellwiki diff --git a/tools.sh b/tools.sh index c5545fb..2e98d67 100755 --- a/tools.sh +++ b/tools.sh @@ -12,15 +12,26 @@ else fi mdfile(){ + # Check if page exists, if possible fall + # back to default page from installation local page="$(PATH "$1")" + # IMPORTANT: A Copy of this function exists + # in `handlers/10_translations.sh` + # Look into it now! + # Keep it synchronized, when changing anything + if [ -f "$_DATA/pages/$page/#page.md" ]; then printf %s\\n "$_DATA/pages/$page/#page.md" + return 0 elif [ -f "$_EXEC/pages/$page/#page.md" ]; then printf %s\\n "$_EXEC/pages/$page/#page.md" + return 0 else return 1 - fi + fi 2>&- + # ^^ suppress error messages produced + # by printf when stdout was closed } size_human(){