Re: Re: Using subdirectories in Muse projects

Phillip Lord <[email protected]>
Newsgroups gmane.emacs.wiki.general
Message-ID <[email protected]>
>>>>> "R" == René  <[email protected]> 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")))))
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.