From 5062a0297ac67665a15cfff8ae954647560b0e8f Mon Sep 17 00:00:00 2001 From: Michael Olson Date: Sun, 25 Dec 2005 04:32:27 +0000 Subject: [PATCH] Use simpler markup string for anchors. * lisp/muse-docbook.el (muse-docbook-markup-strings): Use 'anchor instead of 'begin-anchor and 'end-anchor. * lisp/muse-latex.el (muse-latex-markup-strings): Ditto. * lisp/muse-publish.el (muse-publish-markup-anchor): Ditto. * lisp/muse-texinfo.el (muse-texinfo-markup-strings): Ditto. * lisp/muse-xml-common.el (muse-xml-markup-anchor): Ditto. * lisp/muse-xml.el (muse-xml-markup-strings): Ditto. * lisp/muse-html.el (muse-html-insert-anchor, muse-html-markup-anchor): Revert previous change, since muse-html-insert-contents needs muse-html-insert-anchor. git-archimport-id: mwolson@gnu.org--2005/muse--main--1.0--patch-319 --- ChangeLog | 30 ++++++++++++++++++++++++++++++ lisp/muse-docbook.el | 3 +-- lisp/muse-html.el | 38 ++++++++++++++++++++------------------ lisp/muse-latex.el | 5 ++--- lisp/muse-publish.el | 11 ++++------- lisp/muse-texinfo.el | 5 ++--- lisp/muse-xml-common.el | 6 ++---- lisp/muse-xml.el | 3 +-- 8 files changed, 62 insertions(+), 39 deletions(-) diff --git a/ChangeLog b/ChangeLog index cf0bda0..09169d5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,36 @@ # arch-tag: automatic-ChangeLog--mwolson@gnu.org--2005/muse--main--1.0 # +2005-12-25 04:32:27 GMT Michael Olson patch-319 + + Summary: + Use simpler markup string for anchors. + Revision: + muse--main--1.0--patch-319 + + * lisp/muse-docbook.el (muse-docbook-markup-strings): Use 'anchor instead + of 'begin-anchor and 'end-anchor. + + * lisp/muse-latex.el (muse-latex-markup-strings): Ditto. + + * lisp/muse-publish.el (muse-publish-markup-anchor): Ditto. + + * lisp/muse-texinfo.el (muse-texinfo-markup-strings): Ditto. + + * lisp/muse-xml-common.el (muse-xml-markup-anchor): Ditto. + + * lisp/muse-xml.el (muse-xml-markup-strings): Ditto. + + * lisp/muse-html.el (muse-html-insert-anchor, muse-html-markup-anchor): + Revert previous change, since muse-html-insert-contents needs + muse-html-insert-anchor. + + modified files: + ChangeLog lisp/muse-docbook.el lisp/muse-html.el + lisp/muse-latex.el lisp/muse-publish.el lisp/muse-texinfo.el + lisp/muse-xml-common.el lisp/muse-xml.el + + 2005-12-25 03:15:36 GMT Michael Olson patch-318 Summary: diff --git a/lisp/muse-docbook.el b/lisp/muse-docbook.el index 5666871..c9071bf 100644 --- a/lisp/muse-docbook.el +++ b/lisp/muse-docbook.el @@ -113,6 +113,7 @@ For more on the structure of this list, see '((url-link . "%s") (internal-link . "%s") (email-addr . "%s") + (anchor . "\n") (emdash . " — ") (comment-begin . "") @@ -156,8 +157,6 @@ For more on the structure of this list, see (begin-ddt . "\n\n") (start-dde . "\n") (end-ddt . "\n\n") - (begin-anchor . "\n") (begin-table . "\n") (end-table . "\n") (begin-table-group . " \n") diff --git a/lisp/muse-html.el b/lisp/muse-html.el index 8e045c7..cae7354 100644 --- a/lisp/muse-html.el +++ b/lisp/muse-html.el @@ -379,26 +379,28 @@ This will be used if no special characters are found." :type 'string :group 'muse-html) -(defun muse-html-markup-anchor () +(defun muse-html-insert-anchor (anchor) "Insert an anchor, either around the word at point, or within a tag." + (skip-chars-forward (concat muse-regexp-blank "\n")) + (if (looking-at (concat "<\\([^" muse-regexp-blank "/>\n]+\\)>")) + (let ((tag (match-string 1))) + (goto-char (match-end 0)) + (muse-insert-markup "") + (when muse-html-anchor-on-word + (or (and (search-forward (format "" tag) + (muse-line-end-position) t) + (goto-char (match-beginning 0))) + (forward-word 1))) + (muse-insert-markup "")) + (muse-insert-markup "") + (when muse-html-anchor-on-word + (forward-word 1)) + (muse-insert-markup "\n"))) + +(defun muse-html-markup-anchor () (unless (get-text-property (match-end 1) 'noemphasis) - (let ((anchor (match-string 2))) - (save-match-data - (skip-chars-forward (concat muse-regexp-blank "\n")) - (if (looking-at (concat "<\\([^" muse-regexp-blank "/>\n]+\\)>")) - (let ((tag (match-string 1))) - (goto-char (match-end 0)) - (muse-insert-markup "") - (when muse-html-anchor-on-word - (or (and (search-forward (format "" tag) - (muse-line-end-position) t) - (goto-char (match-beginning 0))) - (forward-word 1))) - (muse-insert-markup "")) - (muse-insert-markup "") - (when muse-html-anchor-on-word - (forward-word 1)) - (muse-insert-markup "\n")))) + (save-match-data + (muse-html-insert-anchor (match-string 2))) (match-string 1))) (defun muse-html-markup-paragraph () diff --git a/lisp/muse-latex.el b/lisp/muse-latex.el index 636e359..3eafbf8 100644 --- a/lisp/muse-latex.el +++ b/lisp/muse-latex.el @@ -146,6 +146,7 @@ For more on the structure of this list, see (url-link . "\\href{%s}{%s}") (internal-link . "\\ref{%s}") (email-addr . "\\verb|%s|") + (anchor . "\\label{%s}") (emdash . "---") (comment-begin . "\\comment{") (commend-end . "}") @@ -193,9 +194,7 @@ For more on the structure of this list, see (end-oli . "\n\\end{enumerate}") (begin-ddt . "\\begin{description}\n\\item[") (start-dde . "] ") - (end-ddt . "\\end{description}") - (begin-anchor . "\\label{") - (end-anchor . "}\n")) + (end-ddt . "\\end{description}")) "Strings used for marking up text. These cover the most basic kinds of markup, the handling of which differs little between the various styles." diff --git a/lisp/muse-publish.el b/lisp/muse-publish.el index 41c9ad6..865bd68 100644 --- a/lisp/muse-publish.el +++ b/lisp/muse-publish.el @@ -665,15 +665,12 @@ the file is published no matter what." (delete-region (match-beginning 0) (match-end 0))) (defun muse-publish-markup-anchor () - (let ((anchor (match-string 2)) - (begin-text (muse-markup-text 'begin-anchor)) - (end-text (muse-markup-text 'end-anchor))) - (unless (get-text-property (match-end 1) 'noemphasis) - (unless (and (string= begin-text "") - (string= end-text "")) + (unless (get-text-property (match-end 1) 'noemphasis) + (let ((text (muse-markup-text 'anchor (match-string 2)))) + (unless (string= text "") (save-match-data (skip-chars-forward (concat muse-regexp-blank "\n")) - (muse-insert-markup begin-text anchor end-text))) + (muse-insert-markup text))) (match-string 1)))) (defun muse-publish-markup-comment () diff --git a/lisp/muse-texinfo.el b/lisp/muse-texinfo.el index 92e8dbd..5fe3833 100644 --- a/lisp/muse-texinfo.el +++ b/lisp/muse-texinfo.el @@ -129,6 +129,7 @@ For more on the structure of this list, see (url-link . "@uref{%s, %s}") (internal-link . "@ref{%s, %s}") (email-addr . "@email{%s}") + (anchor . "@anchor{%s} ") (emdash . "---") (comment-begin . "@ignore\n") (comment-end . "\n@end ignore\n") @@ -167,9 +168,7 @@ For more on the structure of this list, see (end-oli . "\n@end enumerate") (begin-ddt . "@table @strong\n@item ") (start-dde . "\n") - (end-ddt . "\n@end table") - (begin-anchor . "@anchor{") - (end-anchor . "} ")) + (end-ddt . "\n@end table")) "Strings used for marking up text. These cover the most basic kinds of markup, the handling of which differs little between the various styles." diff --git a/lisp/muse-xml-common.el b/lisp/muse-xml-common.el index 5868c6e..6dd4a09 100644 --- a/lisp/muse-xml-common.el +++ b/lisp/muse-xml-common.el @@ -89,14 +89,12 @@ if not escaped." (defun muse-xml-markup-anchor () (unless (get-text-property (match-end 1) 'noemphasis) - (let ((anchor (match-string 2))) + (let ((text (muse-markup-text 'anchor (match-string 2)))) (save-match-data (skip-chars-forward (concat muse-regexp-blank "\n")) (when (looking-at (concat "<\\([^" muse-regexp-blank "/>\n]+\\)>")) (goto-char (match-end 0))) - (muse-insert-markup (muse-markup-text 'begin-anchor) - anchor - (muse-markup-text 'end-anchor)))) + (muse-insert-markup text))) (match-string 1))) (defun muse-xml-sort-table (table) diff --git a/lisp/muse-xml.el b/lisp/muse-xml.el index 81be04c..be0a98a 100644 --- a/lisp/muse-xml.el +++ b/lisp/muse-xml.el @@ -125,6 +125,7 @@ For more on the structure of this list, see (url-with-image . "%s") (url-link . "%s") (email-addr . "%s") + (anchor . "\n") (emdash . " -- ") (comment-begin . "") @@ -173,8 +174,6 @@ For more on the structure of this list, see (begin-ddt . "\n") (start-dde . "\n") (end-ddt . "\n\n") - (begin-anchor . "\n") (begin-table . "\n") (end-table . "\n") (begin-table-row . " \n") -- 2.11.4.GIT