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

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

Re: [emacs-wiki-discuss] Re: Wiki with one main and somesub-directories


From: Pascal Quesseveur
Subject: Re: [emacs-wiki-discuss] Re: Wiki with one main and somesub-directories
Date: Fri, 22 Jul 2005 10:46:20 +0200

Hello,

The following patch tries to correct the problems in
emacs-wiki-publish related to the handling of subdirectories. It has
been tested with emacs-wiki 2.69.

Concerning the problems with the links in the footer I think they can
be solved by calling (emacs-wiki-link-url) instead of
(emacs-wiki-published-name) to create the links. I created the
following:

,----
| (defsubst my-emacs-wiki-link-href (url name)
|   "Return an href string for URL and NAME."
|   (concat "<a href=\""
|           (emacs-wiki-link-url url) "\">" name "</a>"))
`----

and redefined emacs-wiki-publishing-footer to use that function instead
of (emacs-wiki-link-href).

HTH.

===================================================================

*** emacs-wiki-publish.orig.el  2005-07-22 09:16:25.000000000 +0200
--- emacs-wiki-publish.el       2005-07-22 09:22:45.000000000 +0200
***************
*** 1047,1052 ****
--- 1047,1056 ----
    "Publish an index of the Wiki pages.
  This function can be added to `emacs-wiki-after-wiki-publish-hook'."
    (interactive)
+   ;; 2005-07-18 -- Pascal Quesseveur. cd to the directory containing
+   ;; the Wiki home page before creating the index.
+   (if (emacs-wiki-page-file emacs-wiki-home-page)
+       (cd (file-name-directory (emacs-wiki-page-file emacs-wiki-home-page))))
    (with-current-buffer (emacs-wiki-generate-index t t t)
      (setq buffer-file-name
            (emacs-wiki-published-file emacs-wiki-index-page))
***************
*** 1888,1901 ****
  
  (defun emacs-wiki-link-url (wiki-link)
    "Resolve the given WIKI-LINK into its ultimate URL form."
!   (let ((link (emacs-wiki-wiki-link-target wiki-link)))
       (save-match-data
          (if (or (emacs-wiki-wiki-url-p link)
                  (string-match emacs-wiki-image-regexp link)
                  (string-match emacs-wiki-file-regexp link))
              link
!           (if (assoc (emacs-wiki-wiki-base link)
!                      (emacs-wiki-file-alist))
                (if (string-match "#" link)
                    (concat
                     (emacs-wiki-escape-url
--- 1892,1924 ----
  
  (defun emacs-wiki-link-url (wiki-link)
    "Resolve the given WIKI-LINK into its ultimate URL form."
!   (let ((link (emacs-wiki-wiki-link-target wiki-link))
!         (link-cell nil)
!         (link-fname nil)
!         (link-ddir nil))
       (save-match-data
          (if (or (emacs-wiki-wiki-url-p link)
                  (string-match emacs-wiki-image-regexp link)
                  (string-match emacs-wiki-file-regexp link))
              link
!           ;; 2005-07-18 -- Pascal Quesseveur. I use the file name
!           ;; associated to the link instead of the link. When no file
!           ;; is available I look for a file in the directory
!           ;; containing the home page. When calling
!           ;; emacs-wiki-published-name, the file name is converted
!           ;; relative to the current dir (which is the dir of the
!           ;; current page).
!           (setq link-cell (assoc (emacs-wiki-wiki-base link)
!                                  (emacs-wiki-file-alist)))
!           (if link-cell
!               (setq link-fname (cdr link-cell))
!             (if (emacs-wiki-page-file emacs-wiki-home-page)
!                 (setq link-ddir (file-name-directory
!                           (emacs-wiki-page-file emacs-wiki-home-page))))
!             (if link-ddir
!                 (setq link-fname (concat link-ddir
!                                          (emacs-wiki-wiki-base link)))))
!           (if link-fname
                (if (string-match "#" link)
                    (concat
                     (emacs-wiki-escape-url
***************
*** 1906,1912 ****
                     (substring link (match-end 0)))
                  (emacs-wiki-escape-url
                   (emacs-wiki-published-name
!                   link (emacs-wiki-page-name)))))))))
  
  (defsubst emacs-wiki-link-href (url name)
    "Return an href string for URL and NAME."
--- 1929,1936 ----
                     (substring link (match-end 0)))
                  (emacs-wiki-escape-url
                   (emacs-wiki-published-name
!                   (file-relative-name link-fname))))
!               link)))))
  
  (defsubst emacs-wiki-link-href (url name)
    "Return an href string for URL and NAME."

===================================================================



-- 
Pascal Quesseveur, address@hidden






reply via email to

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