From 0d2a1808edfc5c653c66dc94e87e6b7e29d20a79 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Sat, 3 Jan 2009 12:54:53 +0100 Subject: [PATCH] Export: Enable new export switches in org-mtags.el. The new export switches -n, +n, and -r for the BEGIN_EXAMPLE and BEGIN_SRC constructs are now supported by org-mtags.el. Also fixes some bugs in org-mtags.el. --- contrib/ChangeLog | 7 +++++++ contrib/lisp/org-mtags.el | 27 ++++++++++++++++++--------- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/contrib/ChangeLog b/contrib/ChangeLog index b71663693..117a8d6f6 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,10 @@ +2009-01-03 Carsten Dominik + + * lisp/org-mtags.el (org-mtags-replace): Extend muse tags syntax + to cater for the new export switched in src and example tags. + (org-mtags-replace): Fix bugs in prefix processing. + (org-mtags-get-tag-and-attributes): Add local variable bindings. + 2008-12-19 Carsten Dominik * lisp/org-exp-blocks.el (org-export-blocks-format-ditaa): Catch diff --git a/contrib/lisp/org-mtags.el b/contrib/lisp/org-mtags.el index 54e962344..62fca9e5c 100644 --- a/contrib/lisp/org-mtags.el +++ b/contrib/lisp/org-mtags.el @@ -43,7 +43,7 @@ ;;
;; Needs to be at the end of a line. Will be translated to "\\". ;; -;; +;; ;; Needs to be on a line by itself, similarly the tag. ;; Will be translated into Org's #+BEGIN_EXAMPLE construct. ;; @@ -68,7 +68,7 @@ ;; ;; only latex and html supported in Org ;; Needs to be on a line by itself, similarly the tag. ;; -;; +;; ;; Needs to be on a line by itself, similarly the tag. ;; Will be translated into Org's BEGIN_SRC construct. ;; @@ -128,7 +128,7 @@ The is done in the entire buffer." (let ((re (concat "^[ \t]*\\(\\)")) - info tag rpl style markup lang file prefix prefix1) + info tag rpl style markup lang file prefix prefix1 switches) ;; First, do the
tag (goto-char (point-min)) (while (re-search-forward "
[ \t]*$" nil t) @@ -146,7 +146,7 @@ The is done in the entire buffer." (setq rpl "[TABLE-OF-CONTENTS]") ;; FIXME: also trigger TOC in options-plist????? ) - ((member tag '("example" "quote" "comment" "verse")) + ((member tag '("quote" "comment" "verse")) (if (plist-get info :closing) (setq rpl (format "#+END_%s" (upcase tag))) (setq rpl (format "#+BEGIN_%s" (upcase tag))))) @@ -168,12 +168,20 @@ The is done in the entire buffer." "#+BEGIN_HTML") ((member style '("ascii")) "#+BEGIN_ASCII"))))) + ((equal tag "example") + (if (plist-get info :closing) + (setq rpl "#+END_EXAMPLE") + (setq rpl "#+BEGIN_EXAMPLE") + (when (setq switches (plist-get info :switches)) + (setq rpl (concat rpl " " switches))))) ((equal tag "src") (if (plist-get info :closing) (setq rpl "#+END_SRC") (setq rpl "#+BEGIN_SRC") (when (setq lang (plist-get info :lang)) - (setq rpl (concat rpl " " lang))))) + (setq rpl (concat rpl " " lang)) + (when (setq switches (plist-get info :switches)) + (setq rpl (concat rpl " " switches)))))) ((equal tag "include") (setq file (plist-get info :file) markup (downcase (plist-get info :markup)) @@ -185,9 +193,10 @@ The is done in the entire buffer." (setq rpl (concat rpl " " markup)) (when (and (equal markup "src") lang) (setq rpl (concat rpl " " lang)))) - (setq rpl (concat rpl - " :prefix " prin1-to-string prefix - " :prefix1 " prin1-to-string prefix1)))) + (when prefix + (setq rpl (concat rpl " :prefix " (prin1-to-string prefix)))) + (when prefix1 + (setq rpl (concat rpl " :prefix1 " (prin1-to-string prefix1)))))) (when rpl (goto-char (plist-get info :match-beginning)) (delete-region (point-at-bol) (plist-get info :match-end)) @@ -204,7 +213,7 @@ with string values. In addition, it reutnrs the following properties: :closing t when the tag starts with \"\\)\\([^>]*\\)>") (let ((start 0) - tag rest prop attributes) + tag rest prop attributes endp val) (setq tag (org-match-string-no-properties 2) endp (match-end 1) rest (and (match-end 3) -- 2.11.4.GIT