emacs-wiki-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [emacs-wiki-discuss] Re: Using subdirectories in Muse projects


From: Phillip Lord
Subject: Re: [emacs-wiki-discuss] Re: Using subdirectories in Muse projects
Date: Mon, 03 Apr 2006 16:24:05 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (windows-nt)

>>>>> "R" == René  <address@hidden> writes:

  R> Lindsay Todd <toddr <at> rpi.edu> writes:

  >> Following the pattern in examples/mwolson/muse-init.el for the
  >> "Blog" project, I am able to create a project with
  >> subdirectories.  When publishing to html, subdirectories are
  >> created in the target path corresponding to the subdirectories in
  >> the project, and muse files are rendered into html in the
  >> expected locations.  This part is working as I expect.
  >> 
  >> But how do I refer to a file in a different subdirectory in my
  >> project?

  R> I like your post.  I tried exactly the same alternatives myself
  R> and did not figure out how to handle subdirectories.

  R> Since your post and Mike's bug report #4702, are there any
  R> solutions available to these problems?


This doesn't do what you directly what you want; it does, however,
address a related problem and, indeed, I use it for subdirectories. 

It defines a new url type, which is like the interwiki support of
muse-wiki. You can also publish to a different directory structure
from the file space (which I do for historical reasons). So a link
like

[[iw:home\emacs][hello]] will work from any of the individual muse
projects that I have. 

Hope this is of some use. 

Phil

(add-to-list 'muse-url-protocols
             '("iw:" phil-muse-browse-url-iw phil-muse-resolve-url-iw))

(setq phil-muse-interwiki-protocol-alist
      '(("home" "/" "~/src/ht/home_website")
        ("silly" "/silly/" "~/src/ht/home_website/silly")
        ("energy" "/energy/" "~/src/ht/home_website/energy")
        ("journal" "/journal/" "~/src/ht/home_website/journal")))
     
     
(defun phil-muse-resolve-url-iw (url)
  (when (string-match "\\`iw:\\([a-zA-Z]*\\)\\\\\\(.+\\)" url)
    (let* ((wiki-resolve 
            (assoc (match-string 1 url)
                   phil-muse-interwiki-protocol-alist))
           (publish-resolve
            (nth 1 wiki-resolve)))
      (concat publish-resolve (match-string 2 url)))))
     
;; this doesn't handle anchors properly yet. 
(defun phil-muse-browse-url-iw (url)
  (when (string-match "\\`iw:\\([a-zA-Z]*\\)\\\\\\(.+\\)#?\\(.*\\)" url)
    (let* ((wiki-resolve 
            (assoc (match-string 1 url)
                   phil-muse-interwiki-protocol-alist))
           (browse-resolve
            (or (nth 2 wiki-resolve)
                (nth 1 wiki-resolve))))
      (find-file 
       (concat browse-resolve "/"
               (match-string 2 url)
               ".muse")))))
     




reply via email to

[Prev in Thread] Current Thread [Next in Thread]