fixes
[distro-setup] / brc2
diff --git a/brc2 b/brc2
index 1974c580b867ea432b9cff6b42664080888f9087..108be387fd24cf1a1d9f697feaf66787a5601d81 100644 (file)
--- a/brc2
+++ b/brc2
@@ -420,7 +420,7 @@ astudio() {
 # Convert brains file path to url and vice versa
 # usage: brains [URL_OR_PATH]
 brains() {
-  _iki-convert '(/a)?/f/brains' brains.fsf.org "$@"
+  _iki-convert '(/a)?/f/brains' brains.fsf.org/wiki "$@"
 }
 glue() {
   _iki-convert '(/a)?/f/gluestick' gluestick.office.fsf.org "$@"
@@ -428,9 +428,9 @@ glue() {
 
 # usage: $0 REPO_PATH [URL_OR_PATH]
 _iki-convert() {
-  local url domain path input err repo_dir dir url_dir url
+  local url prefix path input err repo_dir dir url_dir url
   repo_dir="$1"
-  domain="$2"
+  prefix="$2"
   shift 2
   err=false
   if $err; then
@@ -443,7 +443,7 @@ _iki-convert() {
   fi
   case $input in
     http*)
-      path="$repo_dir/${input##http*://"$domain"/wiki/}"
+      path="$repo_dir/${input##http*://"$prefix"/}"
       if [[ $path == */ ]]; then
         path=${path%/}.mdwn
       fi
@@ -452,7 +452,7 @@ _iki-convert() {
     *)
       path=$(fp "$input")
       url_dir=$(echo "$path" | sed -r "s,^$repo_dir/,,")
-      url="https://$domain/wiki/$url_dir"
+      url="https://$prefix/$url_dir"
       url="${url%.mdwn}/"
       j echo "$url"
       ;;