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.
This commit is contained in:
Carsten Dominik 2009-01-03 12:54:53 +01:00
parent 2b2c603903
commit 0d2a1808ed
2 changed files with 25 additions and 9 deletions

View File

@ -1,3 +1,10 @@
2009-01-03 Carsten Dominik <carsten.dominik@gmail.com>
* 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 <carsten.dominik@gmail.com>
* lisp/org-exp-blocks.el (org-export-blocks-format-ditaa): Catch

View File

@ -43,7 +43,7 @@
;; <br>
;; Needs to be at the end of a line. Will be translated to "\\".
;;
;; <example>
;; <example switches="-n -r">
;; Needs to be on a line by itself, similarly the </example> tag.
;; Will be translated into Org's #+BEGIN_EXAMPLE construct.
;;
@ -68,7 +68,7 @@
;; <literal style="STYLE"> ;; only latex and html supported in Org
;; Needs to be on a line by itself, similarly the </literal> tag.
;;
;; <src lang="LANG">
;; <src lang="LANG" switches="-n -r">
;; Needs to be on a line by itself, similarly the </src> 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]*\\(</?\\("
(mapconcat 'identity org-mtags-supported-tags "\\|")
"\\)\\>\\)"))
info tag rpl style markup lang file prefix prefix1)
info tag rpl style markup lang file prefix prefix1 switches)
;; First, do the <br> tag
(goto-char (point-min))
(while (re-search-forward "<br>[ \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 \"</\"."
(when (looking-at "<\\(/\\)?\\([a-zA-Z]+\\>\\)\\([^>]*\\)>")
(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)