Skip to content

Commit

Permalink
Make a distinction between implicit and explicit links at publish-time.
Browse files Browse the repository at this point in the history
* lisp/muse-html.el (muse-html-escape-string): Ignore other arguments.

* lisp/muse-http.el (muse-http-prepare-url): Handle `explicit' argument.

* lisp/muse-publish.el (muse-publish-url, muse-publish-insert-url): Pass
  `explicit' argument.

* lisp/muse-publish.el (muse-publish-markup-link): Determine whether or
  not we are dealing with an explicit link.

* lisp/muse-publish.el (muse-publish-prepare-url): Ignore other arguments.

* lisp/muse-wiki.el (muse-wiki-transform-interwiki): Take `explicit'
  argument, but ignore it.

* lisp/muse-wiki.el (muse-wiki-transform-wikiword): Only apply transforms
  when link is not explicit.
git-archimport-id: mwolson@gnu.org--2005/muse--main--1.0--patch-107
  • Loading branch information
mwolson committed Jul 8, 2005
1 parent 06b3e9b commit 91b5686
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 11 deletions.
30 changes: 30 additions & 0 deletions ChangeLog
Expand Up @@ -2,6 +2,36 @@
# arch-tag: automatic-ChangeLog--mwolson@gnu.org--2005/muse--main--1.0
#

2005-07-08 21:11:53 GMT Michael Olson <mwolson@gnu.org> patch-107

Summary:
Make a distinction between implicit and explicit links at publish-time.
Revision:
muse--main--1.0--patch-107

* lisp/muse-html.el (muse-html-escape-string): Ignore other arguments.

* lisp/muse-http.el (muse-http-prepare-url): Handle `explicit' argument.

* lisp/muse-publish.el (muse-publish-url, muse-publish-insert-url): Pass
`explicit' argument.

* lisp/muse-publish.el (muse-publish-markup-link): Determine whether or
not we are dealing with an explicit link.

* lisp/muse-publish.el (muse-publish-prepare-url): Ignore other arguments.

* lisp/muse-wiki.el (muse-wiki-transform-interwiki): Take `explicit'
argument, but ignore it.

* lisp/muse-wiki.el (muse-wiki-transform-wikiword): Only apply transforms
when link is not explicit.

modified files:
ChangeLog lisp/muse-html.el lisp/muse-http.el
lisp/muse-publish.el lisp/muse-wiki.el


2005-07-08 06:40:30 GMT Michael Olson <mwolson@gnu.org> patch-106

Summary:
Expand Down
2 changes: 1 addition & 1 deletion lisp/muse-html.el
Expand Up @@ -433,7 +433,7 @@ system to an associated HTML coding system. If no match is found,
(save-match-data
(muse-html-insert-anchor (match-string 1))) "")

(defun muse-html-escape-string (str)
(defun muse-html-escape-string (str &rest ignored)
"Convert to character entities any non-alphanumeric characters
outside a few punctuation symbols, that risk being misinterpreted
if not escaped."
Expand Down
5 changes: 3 additions & 2 deletions lisp/muse-http.el
Expand Up @@ -123,9 +123,10 @@ customization group."
(muse-publish-markup-buffer title muse-http-publishing-style)
(muse-http-send-buffer nil 404 msg)))

(defun muse-http-prepare-url (target)
(defun muse-http-prepare-url (target explicit)
(save-match-data
(unless (or (string-match muse-url-regexp target)
(unless (or (not explicit)
(string-match muse-url-regexp target)
(string-match muse-image-regexp target)
(string-match muse-file-regexp target))
(setq target (concat "page?" target
Expand Down
16 changes: 10 additions & 6 deletions lisp/muse-publish.el
Expand Up @@ -908,11 +908,11 @@ like read-only from being inadvertently deleted."
(insert (format (muse-markup-text 'email-addr) addr addr))
(muse-publish-mark-read-only beg (point))))

(defun muse-publish-url (url &optional desc)
(defun muse-publish-url (url &optional desc explicit)
"Resolve a URL into its final <a href> form."
(let ((orig-url url))
(dolist (transform muse-publish-url-transforms)
(setq url (save-match-data (when url (funcall transform url)))))
(setq url (save-match-data (when url (funcall transform url explicit)))))
(if url
(if (string-match muse-image-regexp url)
(if desc
Expand All @@ -923,15 +923,19 @@ like read-only from being inadvertently deleted."
(muse-markup-text 'url-link url (or desc orig-url))))
orig-url)))

(defun muse-publish-insert-url (url &optional desc)
(defun muse-publish-insert-url (url &optional desc explicit)
"Resolve a URL into its final <a href> form."
(delete-region (match-beginning 0) (match-end 0))
(let ((beg (point)))
(insert (muse-publish-url url desc))
(insert (muse-publish-url url desc explicit))
(muse-publish-mark-read-only beg (point))))

(defun muse-publish-markup-link ()
(muse-publish-insert-url (match-string 1) (match-string 2)))
(let ((explicit (save-match-data
(if (string-match muse-explicit-link-regexp
(match-string 0))
t nil))))
(muse-publish-insert-url (match-string 1) (match-string 2) explicit)))

(defun muse-publish-markup-url ()
(muse-publish-insert-url (match-string 0)))
Expand Down Expand Up @@ -1049,7 +1053,7 @@ like read-only from being inadvertently deleted."
string)
string))

(defun muse-publish-prepare-url (target)
(defun muse-publish-prepare-url (target &rest ignored)
(save-match-data
(unless (or (string-match muse-url-regexp target)
(string-match muse-image-regexp target)
Expand Down
5 changes: 3 additions & 2 deletions lisp/muse-wiki.el
Expand Up @@ -109,7 +109,7 @@ this."
(set sym value)))
:group 'muse-wiki)

(defun muse-wiki-transform-interwiki (url)
(defun muse-wiki-transform-interwiki (url explicit)
"Return the destination of the given URL if it is an interwiki link.
Otherwise return URL. Read-only properties are added to the string."
(let ((res (muse-wiki-handle-interwiki url)))
Expand All @@ -118,11 +118,12 @@ Otherwise return URL. Read-only properties are added to the string."
(muse-publish-output-name res)))))
(muse-publish-read-only url))

(defun muse-wiki-transform-wikiword (url)
(defun muse-wiki-transform-wikiword (url explicit)
"If URL is a WikiWord but does not correspond with an existing
file or interwiki name, return nil. Otherwise, return URL.
Read-only properties are added to the string."
(when (and muse-wiki-use-wikiword
(not explicit)
(string-match (concat "^" muse-wiki-wikiword-regexp "$") url))
(unless (or (and (muse-project-of-file)
(muse-project-page-file
Expand Down

0 comments on commit 91b5686

Please sign in to comment.