   :type 'directory
   :group 'org-wiki 
   )
+
 
 ;; (defcustom org-wiki/default-apps '()
 ;;   "Default applications used to open asset files. 


(defun org-wiki/normalize-path (path)

                   (replace-regexp-in-string
                    "//"
                    "/"   
                    (replace-regexp-in-string "/$" "" (expand-file-name path))
                    )


                   )
       
(defun  org-wiki/path-equal (p1 p2)
  (equal (org-wiki/normalize-path p1) (org-wiki/normalize-path p2))




;;  @DONE: Implement html exporting to org-wiki asset files 
;; 
(defun org-wiki/asset-link (path desc backend)
  "Creates an html org-wiki pages html exporting."

  (let* ((a    (split-string path ";"))
        (page  (car a))
        (asset (cadr a))
        (file-path (concat page "/"  asset))
        )

   (cl-case backend
     (html (format
            "<a href='%s'>%s</a>"
            file-path
            (or desc asset))))))

;;; Custom Protocols
(add-hook 'org-mode-hook
          (lambda ()    

            (org-add-link-type  "wiki"
                                #'org-wiki/open-page
                                #'org-wiki/org-link )
            
            (org-add-link-type  "wiki-asset-sys"
                                #'org-wiki/protocol-open-assets-with-sys
                                #'org-wiki/asset-link)
            ))

;; ---------------- User Commands ---------------- ;;
