Use :rst-text-markup-alist in org-rst--text-markup

This commit is contained in:
IGARASHI Masanao
2017-02-20 13:52:15 +09:00
parent 902bd08ce4
commit c5f300cf02

View File

@@ -401,10 +401,10 @@ possible. It doesn't apply to `inlinetask' elements."
(make-string (string-width first-part) under-char)))))))) (make-string (string-width first-part) under-char))))))))
(defun org-rst--text-markup (text markup) (defun org-rst--text-markup (text markup info)
"Format TEXT depending on MARKUP text markup. "Format TEXT depending on MARKUP text markup.
See `org-rst-text-markup-alist' for details." See `org-rst-text-markup-alist' for details."
(let ((fmt (cdr (assq markup org-rst-text-markup-alist))) (let ((fmt (cdr (assq markup (plist-get info :rst-text-markup-alist))))
(text (replace-regexp-in-string "[ \t\n]+" " " text))) (text (replace-regexp-in-string "[ \t\n]+" " " text)))
(cond (cond
;; No format string: Return raw text. ;; No format string: Return raw text.
@@ -515,11 +515,11 @@ holding export options."
;;;; Bold ;;;; Bold
(defun org-rst-bold (_bold contents _info) (defun org-rst-bold (_bold contents info)
"Transcode BOLD from Org to reStructuredText. "Transcode BOLD from Org to reStructuredText.
CONTENTS is the text with bold markup. INFO is a plist holding CONTENTS is the text with bold markup. INFO is a plist holding
contextual information." contextual information."
(org-rst--text-markup contents 'bold)) (org-rst--text-markup contents 'bold info))
;;;; Center Block ;;;; Center Block
@@ -551,11 +551,11 @@ information."
;;;; Code ;;;; Code
(defun org-rst-code (code _contents _info) (defun org-rst-code (code _contents info)
"Transcode a CODE object from Org to reStructuredText. "Transcode a CODE object from Org to reStructuredText.
CONTENTS is nil. INFO is a plist used as a communication CONTENTS is nil. INFO is a plist used as a communication
channel." channel."
(org-rst--text-markup (org-element-property :value code) 'code)) (org-rst--text-markup (org-element-property :value code) 'code info))
;;;; Drawer ;;;; Drawer
@@ -689,12 +689,12 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;;; Inline Src Block ;;;; Inline Src Block
(defun org-rst-inline-src-block (inline-src-block _contents _info) (defun org-rst-inline-src-block (inline-src-block _contents info)
"Transcode an INLINE-SRC-BLOCK element from Org to reStructuredText. "Transcode an INLINE-SRC-BLOCK element from Org to reStructuredText.
CONTENTS holds the contents of the item. INFO is a plist holding CONTENTS holds the contents of the item. INFO is a plist holding
contextual information." contextual information."
(org-rst--text-markup (org-rst--text-markup
(org-element-property :value inline-src-block) 'verbatim)) (org-element-property :value inline-src-block) 'verbatim info))
;;;; Inlinetask ;;;; Inlinetask
@@ -771,11 +771,11 @@ holding export options."
;;;; Italic ;;;; Italic
(defun org-rst-italic (_italic contents _info) (defun org-rst-italic (_italic contents info)
"Transcode ITALIC from Org to reStructuredText. "Transcode ITALIC from Org to reStructuredText.
CONTENTS is the text with italic markup. INFO is a plist holding CONTENTS is the text with italic markup. INFO is a plist holding
contextual information." contextual information."
(org-rst--text-markup contents 'italic)) (org-rst--text-markup contents 'italic info))
;;;; Item ;;;; Item
@@ -1505,11 +1505,11 @@ holding contextual information."
;;;; Verbatim ;;;; Verbatim
(defun org-rst-verbatim (verbatim _contents _info) (defun org-rst-verbatim (verbatim _contents info)
"Transcode a VERBATIM object from Org to reStructredText. "Transcode a VERBATIM object from Org to reStructredText.
CONTENTS is nil. INFO is a plist used as a communication CONTENTS is nil. INFO is a plist used as a communication
channel." channel."
(org-rst--text-markup (org-element-property :value verbatim) 'verbatim)) (org-rst--text-markup (org-element-property :value verbatim) 'verbatim info))
;;;; Verse Block ;;;; Verse Block