From 6c7ba6dfda27bf029c6270f635050bff3f652a61 Mon Sep 17 00:00:00 2001 From: Michael Olson Date: Thu, 18 May 2006 06:58:58 +0000 Subject: [PATCH] Add muse-protocol-iw.el to experimental folder. * experimental/muse-protocol-iw.el: New experimental file that implements an interwiki protocol of sorts that handles subdirectories. git-archimport-id: mwolson@gnu.org--2006/muse--main--1.0--patch-131 --- AUTHORS | 5 ++- ChangeLog.2006 | 18 +++++++++++ experimental/muse-protocol-iw.el | 70 ++++++++++++++++++++++++++++++++++++++++ experimental/muse-split.el | 4 ++- 4 files changed, 95 insertions(+), 2 deletions(-) create mode 100644 experimental/muse-protocol-iw.el diff --git a/AUTHORS b/AUTHORS index 2c65392..8ff0d1c 100644 --- a/AUTHORS +++ b/AUTHORS @@ -40,7 +40,10 @@ Peter K. Lee: Contributor Na Li: Contributor: - muse-latex2png.el: 1 line changed -Phillip Lord: Contributor +Phillip Lord: Author of: + - muse-split.el + - muse-protocol-iw.el + Contributor (assigned past and future changes) Chris Lowis: Contributor: diff --git a/ChangeLog.2006 b/ChangeLog.2006 index e692e84..f5c356f 100644 --- a/ChangeLog.2006 +++ b/ChangeLog.2006 @@ -2,6 +2,24 @@ # arch-tag: automatic-ChangeLog--mwolson@gnu.org--2006/muse--main--1.0 # +2006-05-18 06:58:58 GMT Michael Olson patch-131 + + Summary: + Add muse-protocol-iw.el to experimental folder. + Revision: + muse--main--1.0--patch-131 + + * experimental/muse-protocol-iw.el: New experimental file that implements + an interwiki protocol of sorts that handles subdirectories. + + new files: + experimental/.arch-ids/muse-protocol-iw.el.id + experimental/muse-protocol-iw.el + + modified files: + AUTHORS ChangeLog.2006 experimental/muse-split.el + + 2006-05-18 06:43:30 GMT Michael Olson patch-130 Summary: diff --git a/experimental/muse-protocol-iw.el b/experimental/muse-protocol-iw.el new file mode 100644 index 0000000..0b15a63 --- /dev/null +++ b/experimental/muse-protocol-iw.el @@ -0,0 +1,70 @@ +;;; muse-protocol-iw.el --- implement an interwiki protocol handler + +;; Copyright (C) 2006 Free Software Foundation, Inc. + +;; Author: Phillip Lord + +;; This file is part of Emacs Muse. It is not part of GNU Emacs. + +;; Emacs Muse is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published +;; by the Free Software Foundation; either version 2, or (at your +;; option) any later version. + +;; Emacs Muse is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with Emacs Muse; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: + +;; This 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. + +(require 'muse-protocols) + +(add-to-list 'muse-url-protocols + '("iw:" muse-browse-url-iw muse-resolve-url-iw)) + +(defvar 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 muse-resolve-url-iw (url) + (when (string-match "\\`iw:\\([a-zA-Z]*\\)\\\\\\(.+\\)" url) + (let* ((wiki-resolve + (assoc (match-string 1 url) + 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 muse-browse-url-iw (url) + (when (string-match "\\`iw:\\([a-zA-Z]*\\)\\\\\\(.+\\)#?\\(.*\\)" url) + (let* ((wiki-resolve + (assoc (match-string 1 url) + 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"))))) + + +(provide 'muse-protocol-iw) +;; muse-protocol-iw.el ends here diff --git a/experimental/muse-split.el b/experimental/muse-split.el index 2e8ceb8..592b904 100644 --- a/experimental/muse-split.el +++ b/experimental/muse-split.el @@ -21,7 +21,9 @@ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. -;;: Status: +;;; Commentary: + +;;; Status: ;; This works now, except that anchors will get broken, as they may ;; well point to the wrong thing. -- 2.11.4.GIT