summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2012-04-28 18:00:50 +0200
committerNicolas Goaziou <n.goaziou@gmail.com>2012-04-28 18:00:50 +0200
commitb21b6ead24aa93c21c2903fcebad960cfd7615c8 (patch)
tree1779849dfe54de53a595a6b263d66ab5dab6f7c4
parent312e22568550c7e996cdce73494a69247b95f8fc (diff)
downloadorg-mode-b21b6ead24aa93c21c2903fcebad960cfd7615c8.tar.gz
org-element: Define new objects (bold, code, italic, ...)
* contrib/lisp/org-e-ascii.el (org-e-ascii-option-alist): Fix typo. (org-e-ascii-bold, org-e-ascii-code, org-e-ascii-strike-through, org-e-ascii-underline): New functions. (org-e-ascii-emphasis): Remove function. * contrib/lisp/org-e-html.el (org-e-html-text-markup-alist): Variable renamed from `org-e-html-emphasis-alist'. Change value type. (org-e-html-bold, org-e-html-italic, org-e-html-strike-through, org-e-html-underline): New functions. (org-e-html-verbatim): Update function. (org-e-html-emphasis): Remove function. * contrib/lisp/org-e-latex.el (org-e-latex-text-markup-alist): Variable renamed from `org-e-latex-emphasis-alist'. Change value type. (org-e-latex-center-block): Fix docstring. (org-e-latex--text-markup, org-e-latex-bold, org-e-latex-code, org-e-latex-italic, org-e-latex-strike-through, org-e-latex-underline): New functions. (org-e-latex-verbatim): Update function. (org-e-latex-emphasis): Remove function. * contrib/lisp/org-e-odt.el (org-e-odt-bold, org-e-odt-code, org-e-odt-italic, org-e-odt-strike-through, org-e-odt-underline): New functions. (org-e-odt-verbatim): Update function. (org-e-odt-center-block): Fix docstring. (org-e-odt-emphasis): Remove function. * contrib/lisp/org-element.el (org-element-bold-parser): (org-element-bold-interpreter, org-element-code-parser, org-element-code-interpreter, org-element-italic-parser, org-element-italic-interpreter, org-element-strike-through-parser, org-element-strike-through-interpreter, org-element-underline-parser, org-element-underline-interpreter): New functions. (org-element-emphasis-parser, org-element-emphasis-interpreter): Remove functions. (org-element-verbatim-parser, org-element-verbatim-interpreter, org-element-text-markup-successor): Update function. (org-element-object-successor-alist): Add associations for new object types. (org-element-recursive-objects): Add `bold', `italic', `strike-through' and `underline' as recursive types. (org-element-object-restrictions): Add restrictions for new recursive object types. * contrib/lisp/org-export.el (org-export-filters-alist): Add filters for new object types. (org-export-with-todo-keywords): Add missing keywords. (org-export-filter-center-block-functions, org-export-filter-drawer-functions, org-export-filter-dynamic-block-functions, org-export-filter-headline-functions, org-export-filter-inlinetask-functions, org-export-filter-plain-list-functions, org-export-filter-item-functions, org-export-filter-comment-functions, org-export-filter-comment-block-functions, org-export-filter-example-block-functions, org-export-filter-export-block-functions, org-export-filter-fixed-width-functions, org-export-filter-footnote-definition-functions, org-export-filter-horizontal-rule-functions, org-export-filter-keyword-functions, org-export-filter-latex-environment-functions, org-export-filter-babel-call-functions, org-export-filter-paragraph-functions, org-export-filter-property-drawer-functions, org-export-filter-quote-section-functions, org-export-filter-quote-block-functions, org-export-filter-section-functions, org-export-filter-special-block-functions, org-export-filter-src-block-functions, org-export-filter-table-functions, org-export-filter-table-cell-functions, org-export-filter-table-row-functions, org-export-filter-verse-block-functions, org-export-filter-entity-functions, org-export-filter-export-snippet-functions, org-export-filter-footnote-reference-functions, org-export-filter-inline-babel-call-functions, org-export-filter-inline-src-block-functions, org-export-filter-latex-fragment-functions, org-export-filter-line-break-functions, org-export-filter-link-functions, org-export-filter-macro-functions, org-export-filter-radio-target-functions, org-export-filter-statistics-cookie-functions, org-export-filter-subscript-functions, org-export-filter-superscript-functions, org-export-filter-target-functions, org-export-filter-time-stamp-functions, org-export-filter-verbatim-functions): Fix docstring. (org-export-filter-bold-functions, org-export-filter-code-functions, org-export-filter-italic-functions, org-export-filter-strike-through-functions, org-export-filter-underline-functions): New variables. (org-export-filter-emphasis-functions): Remove variable. * testing/lisp/test-org-element.el: Add tests.
-rw-r--r--contrib/lisp/org-e-ascii.el59
-rw-r--r--contrib/lisp/org-e-html.el110
-rw-r--r--contrib/lisp/org-e-latex.el177
-rw-r--r--contrib/lisp/org-e-odt.el72
-rw-r--r--contrib/lisp/org-element.el240
-rw-r--r--contrib/lisp/org-export.el335
-rw-r--r--testing/lisp/test-org-element.el28
7 files changed, 657 insertions, 364 deletions
diff --git a/contrib/lisp/org-e-ascii.el b/contrib/lisp/org-e-ascii.el
index b6e3753..b6538e7 100644
--- a/contrib/lisp/org-e-ascii.el
+++ b/contrib/lisp/org-e-ascii.el
@@ -83,8 +83,7 @@
;; control blank lines separating them in output string.
(defconst org-e-ascii-option-alist
- '((:ascii-charset nil nil org-e-ascii-charset)
- )
+ '((:ascii-charset nil nil org-e-ascii-charset))
"Alist between ASCII export properties and ways to set them.
See `org-export-option-alist' for more information on the
structure or the values.")
@@ -1000,6 +999,15 @@ charset, fall-back to S."
;; Babel Calls are ignored.
+;;;; Bold
+
+(defun org-e-ascii-bold (bold contents info)
+ "Transcode BOLD from Org to ASCII.
+CONTENTS is the text with bold markup. INFO is a plist holding
+contextual information."
+ (format "*%s*" contents))
+
+
;;;; Center Block
(defun org-e-ascii-center-block (center-block contents info)
@@ -1010,6 +1018,15 @@ holding contextual information."
contents (org-e-ascii--current-text-width center-block info) 'center))
+;;;; Code
+
+(defun org-e-ascii-code (code contents info)
+ "Return a CODE object from Org to ASCII.
+CONTENTS is nil. INFO is a plist holding contextual
+information."
+ (format org-e-ascii-verbatim-format (org-element-property :value code)))
+
+
;;;; Comment
;; Comments are ignored.
@@ -1044,17 +1061,6 @@ holding contextual information. See `org-export-data'."
contents)
-;;;; Emphasis
-
-(defun org-e-ascii-emphasis (emphasis contents info)
- "Transcode EMPHASIS from Org to ASCII.
-CONTENTS is the contents of the emphasized text. INFO is a plist
-holding contextual information.."
- (let ((marker (org-element-property :marker emphasis)))
- ;; Leave emphasis markers as-is.
- (concat marker contents marker)))
-
-
;;;; Entity
(defun org-e-ascii-entity (entity contents info)
@@ -1248,6 +1254,14 @@ holding contextual information."
org-e-ascii-inner-margin)
(org-e-ascii--current-text-width inlinetask info)))))))
+;;;; Italic
+
+(defun org-e-ascii-italic (italic contents info)
+ "Transcode italic from Org to ASCII.
+CONTENTS is the text with italic markup. INFO is a plist holding
+contextual information."
+ (format "/%s/" contents))
+
;;;; Item
@@ -1573,6 +1587,15 @@ contextual information."
(format "_%s" contents)))
+;;;; Strike-through
+
+(defun org-e-ascii-strike-through (strike-through contents info)
+ "Transcode STRIKE-THROUGH from Org to ASCII.
+CONTENTS is text with strike-through markup. INFO is a plist
+holding contextual information."
+ (format "+%s+" contents))
+
+
;;;; Table
(defun org-e-ascii-table (table contents info)
@@ -1592,7 +1615,6 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;;; Table Cell
-
(defun org-e-ascii--table-cell-width (table-cell info)
"Return width of TABLE-CELL.
@@ -1709,6 +1731,15 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(org-element-time-stamp-interpreter time-stamp contents))
+;;;; Underline
+
+(defun org-e-ascii-underline (underline contents info)
+ "Transcode UNDERLINE from Org to ASCII.
+CONTENTS is the text with underline markup. INFO is a plist
+holding contextual information."
+ (format "_%s_" contents))
+
+
;;;; Verbatim
(defun org-e-ascii-verbatim (verbatim contents info)
diff --git a/contrib/lisp/org-e-html.el b/contrib/lisp/org-e-html.el
index 426ae03..f3693bf 100644
--- a/contrib/lisp/org-e-html.el
+++ b/contrib/lisp/org-e-html.el
@@ -863,27 +863,28 @@ order to reproduce the default set-up:
:group 'org-export-e-html
:type 'function)
-;;;; Emphasis
-(defcustom org-e-html-emphasis-alist
- '(("*" . "<b>%s</b>")
- ("/" . "<i>%s</i>")
- ("_" . "<span style=\"text-decoration:underline;\">%s</span>")
- ("+" . "<del>%s</del>")
- ("=" . "<code>%s</code>")
- ("~" . "<code>%s</code>"))
- "Alist of HTML expressions to convert emphasis fontifiers.
-
-The key is the character used as a marker for fontification. The
-value is a formatting string to wrap fontified text with.
-
-Value can also be set to the following symbols: `verb' and
-`protectedtexttt'. For the former, Org will use \"\\verb\" to
-create a format string and select a delimiter character that
-isn't in the string. For the latter, Org will use \"\\texttt\"
-to typeset and try to protect special characters."
+;;;; Text Markup
+
+(defcustom org-e-html-text-markup-alist
+ '((bold . "<b>%s</b>")
+ (code . "<code>%s</code>")
+ (italic . "<i>%s</i>")
+ (strike-through . "<del>%s</del>")
+ (underline . "<span style=\"text-decoration:underline;\">%s</span>")
+ (verbatim . "<code>%s</code>"))
+ "Alist of HTML expressions to convert text markup
+
+The key must be a symbol among `bold', `code', `italic',
+`strike-through', `underline' and `verbatim'. The value is
+a formatting string to wrap fontified text with.
+
+If no association can be found for a given markup, text will be
+returned as-is."
:group 'org-export-e-html
- :type 'alist)
+ :type '(alist :key-type (symbol :tag "Markup type")
+ :value-type (string :tag "Format string"))
+ :options '(bold code italic strike-through underline verbatim))
;;;; Footnotes
@@ -1830,7 +1831,17 @@ original parsed data. INFO is a plist holding export options."
;;; Transcode Functions
-;;;; Block
+;;;; Bold
+
+(defun org-e-html-bold (bold contents info)
+ "Transcode BOLD from Org to HTML.
+CONTENTS is the text with bold markup. INFO is a plist holding
+contextual information."
+ (format (or (cdr (assq 'bold org-e-html-text-markup-alist)) "%s")
+ contents))
+
+
+;;;; Center Block
(defun org-e-html-center-block (center-block contents info)
"Transcode a CENTER-BLOCK element from Org to HTML.
@@ -1841,6 +1852,16 @@ holding contextual information."
(format "<div style=\"text-align: center\">\n%s</div>" contents)))
+;;;; Code
+
+(defun org-e-html-code (code contents info)
+ "Transcode CODE from Org to HTML.
+CONTENTS is nil. INFO is a plist holding contextual
+information."
+ (format (or (cdr (assq 'code org-e-html-text-markup-alist)) "%s")
+ (org-element-property :value code)))
+
+
;;;; Comment
;; Comments are ignored.
@@ -1876,16 +1897,6 @@ holding contextual information. See `org-export-data'."
(org-e-html--wrap-label dynamic-block contents))
-;;;; Emphasis
-
-(defun org-e-html-emphasis (emphasis contents info)
- "Transcode EMPHASIS from Org to HTML.
-CONTENTS is the contents of the emphasized text. INFO is a plist
-holding contextual information.."
- (let* ((marker (org-element-property :marker emphasis)))
- (format (cdr (assoc marker org-e-html-emphasis-alist)) contents)))
-
-
;;;; Entity
(defun org-e-html-entity (entity contents info)
@@ -2154,6 +2165,15 @@ holding contextual information."
contents)))))
+;;;; Italic
+
+(defun org-e-html-italic (italic contents info)
+ "Transcode ITALIC from Org to HTML.
+CONTENTS is the text with italic markup. INFO is a plist holding
+contextual information."
+ (format (or (cdr (assq 'italic org-e-html-text-markup-alist)) "%s") contents))
+
+
;;;; Item
(defun org-e-html-checkbox (checkbox)
@@ -2731,6 +2751,16 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(format "<code>%s</code>" cookie-value)))
+;;;; Strike-Through
+
+(defun org-e-html-strike-through (strike-through contents info)
+ "Transcode STRIKE-THROUGH from Org to HTML.
+CONTENTS is the text with strike-through markup. INFO is a plist
+holding contextual information."
+ (format (or (cdr (assq 'strike-through org-e-html-text-markup-alist)) "%s")
+ contents))
+
+
;;;; Subscript
(defun org-e-html-subscript (subscript contents info)
@@ -2923,14 +2953,24 @@ information."
(format "<span class=\"timestamp\">%s</span>" value))))
+;;;; Underline
+
+(defun org-e-html-underline (underline contents info)
+ "Transcode UNDERLINE from Org to HTML.
+CONTENTS is the text with underline markup. INFO is a plist
+holding contextual information."
+ (format (or (cdr (assq 'underline org-e-html-text-markup-alist)) "%s")
+ contents))
+
+
;;;; Verbatim
(defun org-e-html-verbatim (verbatim contents info)
- "Transcode a VERBATIM object from Org to HTML.
-CONTENTS is nil. INFO is a plist used as a communication
-channel."
- (org-e-html-emphasis
- verbatim (org-element-property :value verbatim) info))
+ "Transcode VERBATIM from Org to HTML.
+CONTENTS is nil. INFO is a plist holding contextual
+information."
+ (format (or (cdr (assq 'verbatim org-e-html-text-markup-alist)) "%s")
+ (org-element-property :value verbatim)))
;;;; Verse Block
diff --git a/contrib/lisp/org-e-latex.el b/contrib/lisp/org-e-latex.el
index 4c94b14..26b659c 100644
--- a/contrib/lisp/org-e-latex.el
+++ b/contrib/lisp/org-e-latex.el
@@ -290,29 +290,6 @@ order to reproduce the default set-up:
:type 'function)
-;;;; Emphasis
-
-(defcustom org-e-latex-emphasis-alist
- '(("*" . "\\textbf{%s}")
- ("/" . "\\emph{%s}")
- ("_" . "\\underline{%s}")
- ("+" . "\\st{%s}")
- ("=" . protectedtexttt)
- ("~" . verb))
- "Alist of LaTeX expressions to convert emphasis fontifiers.
-
-The key is the character used as a marker for fontification. The
-value is a formatting string to wrap fontified text with.
-
-Value can also be set to the following symbols: `verb' and
-`protectedtexttt'. For the former, Org will use \"\\verb\" to
-create a format string and select a delimiter character that
-isn't in the string. For the latter, Org will use \"\\texttt\"
-to typeset and try to protect special characters."
- :group 'org-export-e-latex
- :type 'alist)
-
-
;;;; Footnotes
(defcustom org-e-latex-footnote-separator "\\textsuperscript{,}\\,"
@@ -413,6 +390,33 @@ When nil, no transformation is made."
(const :tag "No formatting")))
+;;;; Text markup
+
+(defcustom org-e-latex-text-markup-alist '((bold . "\\textbf{%s}")
+ (code . verb)
+ (italic . "\\emph{%s}")
+ (strike-through . "\\st{%s}")
+ (underline . "\\underline{%s}")
+ (verbatim . protectedtexttt))
+ "Alist of LaTeX expressions to convert text markup.
+
+The key must be a symbol among `bold', `code', `italic',
+`strike-through', `underline' and `verbatim'. The value is
+a formatting string to wrap fontified text with.
+
+Value can also be set to the following symbols: `verb' and
+`protectedtexttt'. For the former, Org will use \"\\verb\" to
+create a format string and select a delimiter character that
+isn't in the string. For the latter, Org will use \"\\texttt\"
+to typeset and try to protect special characters.
+
+If no association can be found for a given markup, text will be
+returned as-is."
+ :group 'org-export-e-latex
+ :type 'alist
+ :options '(bold code italic strike-through underline verbatim))
+
+
;;;; Drawers
(defcustom org-e-latex-format-drawer-function nil
@@ -810,6 +814,42 @@ This function shouldn't be used for floats. See
output
(concat (format "\\label{%s}\n" label) output))))
+(defun org-e-latex--text-markup (text markup)
+ "Format text depending on MARKUP text markup.
+See `org-e-latex-text-markup-alist' for details."
+ (let ((fmt (cdr (assq markup org-e-latex-text-markup-alist))))
+ (cond
+ ;; No format string: Return raw text.
+ ((not fmt) text)
+ ;; Handle the `verb' special case: Find and appropriate separator
+ ;; and use "\\verb" command.
+ ((eq 'verb fmt)
+ (let ((separator (org-e-latex--find-verb-separator text)))
+ (concat "\\verb" separator text separator)))
+ ;; Handle the `protectedtexttt' special case: Protect some
+ ;; special chars and use "\texttt{%s}" format string.
+ ((eq 'protectedtexttt fmt)
+ (let ((start 0)
+ (trans '(("\\" . "\\textbackslash{}")
+ ("~" . "\\textasciitilde{}")
+ ("^" . "\\textasciicircum{}")))
+ (rtn "")
+ char)
+ (while (string-match "[\\{}$%&_#~^]" text)
+ (setq char (match-string 0 text))
+ (if (> (match-beginning 0) 0)
+ (setq rtn (concat rtn (substring value 0 (match-beginning 0)))))
+ (setq text (substring text (1+ (match-beginning 0))))
+ (setq char (or (cdr (assoc char trans)) (concat "\\" char))
+ rtn (concat rtn char)))
+ (setq text (concat rtn text)
+ fmt "\\texttt{%s}")
+ (while (string-match "--" text)
+ (setq text (replace-match "-{}-" t t text)))
+ (format fmt text)))
+ ;; Else use format string.
+ (t (format fmt text)))))
+
;;; Template
@@ -901,17 +941,35 @@ holding export options."
;;; Transcode Functions
-;;;; Block
+;;;; Bold
+
+(defun org-e-latex-bold (bold contents info)
+ "Transcode BOLD from Org to LaTeX.
+CONTENTS is the text with bold markup. INFO is a plist holding
+contextual information."
+ (org-e-latex--text-markup contents 'bold))
+
+
+;;;; Center Block
(defun org-e-latex-center-block (center-block contents info)
"Transcode a CENTER-BLOCK element from Org to LaTeX.
-CONTENTS holds the contents of the block. INFO is a plist
+CONTENTS holds the contents of the center block. INFO is a plist
holding contextual information."
(org-e-latex--wrap-label
center-block
(format "\\begin{center}\n%s\\end{center}" contents)))
+;;;; Code
+
+(defun org-e-latex-code (code contents info)
+ "Transcode a CODE object from Org to LaTeX.
+CONTENTS is nil. INFO is a plist used as a communication
+channel."
+ (org-e-latex--text-markup (org-element-property :value code) 'code))
+
+
;;;; Comment
;; Comments are ignored.
@@ -947,17 +1005,6 @@ holding contextual information. See `org-export-data'."
(org-e-latex--wrap-label dynamic-block contents))
-;;;; Emphasis
-
-(defun org-e-latex-emphasis (emphasis contents info)
- "Transcode EMPHASIS from Org to LaTeX.
-CONTENTS is the contents of the emphasized text. INFO is a plist
-holding contextual information.."
- (format (cdr (assoc (org-element-property :marker emphasis)
- org-e-latex-emphasis-alist))
- contents))
-
-
;;;; Entity
(defun org-e-latex-entity (entity contents info)
@@ -1267,6 +1314,15 @@ holding contextual information."
full-title contents))))))
+;;;; Italic
+
+(defun org-e-latex-italic (italic contents info)
+ "Transcode ITALIC from Org to LaTeX.
+CONTENTS is the text with italic markup. INFO is a plist holding
+contextual information."
+ (org-e-latex--text-markup contents 'italic))
+
+
;;;; Item
(defun org-e-latex-item (item contents info)
@@ -1801,6 +1857,15 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(org-element-property :value statistics-cookie))
+;;;; Strike-Through
+
+(defun org-e-latex-strike-through (strike-through contents info)
+ "Transcode STRIKE-THROUGH from Org to LaTeX.
+CONTENTS is the text with strike-through markup. INFO is a plist
+holding contextual information."
+ (org-e-latex--text-markup contents 'strike-through))
+
+
;;;; Subscript
(defun org-e-latex-subscript (subscript contents info)
@@ -2065,42 +2130,22 @@ information."
(format org-e-latex-diary-timestamp-format value))))))
+;;;; Underline
+
+(defun org-e-latex-underline (underline contents info)
+ "Transcode UNDERLINE from Org to LaTeX.
+CONTENTS is the text with underline markup. INFO is a plist
+holding contextual information."
+ (org-e-latex--text-markup contents 'underline))
+
+
;;;; Verbatim
(defun org-e-latex-verbatim (verbatim contents info)
"Transcode a VERBATIM object from Org to LaTeX.
CONTENTS is nil. INFO is a plist used as a communication
channel."
- (let ((fmt (cdr (assoc (org-element-property :marker verbatim)
- org-e-latex-emphasis-alist)))
- (value (org-element-property :value verbatim)))
- (cond
- ;; Handle the `verb' special case.
- ((eq 'verb fmt)
- (let ((separator (org-e-latex--find-verb-separator value)))
- (concat "\\verb" separator value separator)))
- ;; Handle the `protectedtexttt' special case.
- ((eq 'protectedtexttt fmt)
- (let ((start 0)
- (trans '(("\\" . "\\textbackslash{}")
- ("~" . "\\textasciitilde{}")
- ("^" . "\\textasciicircum{}")))
- (rtn "")
- char)
- (while (string-match "[\\{}$%&_#~^]" value)
- (setq char (match-string 0 value))
- (if (> (match-beginning 0) 0)
- (setq rtn (concat rtn (substring value 0 (match-beginning 0)))))
- (setq value (substring value (1+ (match-beginning 0))))
- (setq char (or (cdr (assoc char trans)) (concat "\\" char))
- rtn (concat rtn char)))
- (setq value (concat rtn value)
- fmt "\\texttt{%s}")
- (while (string-match "--" value)
- (setq value (replace-match "-{}-" t t value)))
- (format fmt value)))
- ;; Else use format string.
- (t (format fmt value)))))
+ (org-e-latex--text-markup (org-element-property :value verbatim) 'verbatim))
;;;; Verse Block
diff --git a/contrib/lisp/org-e-odt.el b/contrib/lisp/org-e-odt.el
index a490f1a..6a037b7 100644
--- a/contrib/lisp/org-e-odt.el
+++ b/contrib/lisp/org-e-odt.el
@@ -2929,15 +2929,33 @@ original parsed data. INFO is a plist holding export options."
;;; Transcode Functions
-;;;; Block
+;;;; Bold
+
+(defun org-e-odt-bold (bold contents info)
+ "Transcode BOLD from Org to HTML.
+CONTENTS is the text with bold markup. INFO is a plist holding
+contextual information."
+ (org-e-odt-format-fontify contents 'bold))
+
+
+;;;; Center Block
(defun org-e-odt-center-block (center-block contents info)
"Transcode a CENTER-BLOCK element from Org to HTML.
-CONTENTS holds the contents of the block. INFO is a plist
+CONTENTS holds the contents of the center block. INFO is a plist
holding contextual information."
(org-e-odt--wrap-label center-block contents))
+;;;; Code
+
+(defun org-e-odt-code (code contents info)
+ "Transcode a CODE object from Org to HTML.
+CONTENTS is nil. INFO is a plist used as a communication
+channel."
+ (org-e-odt-format-fontify (org-element-property :value code) 'code))
+
+
;;;; Comment
;; Comments are ignored.
@@ -2973,26 +2991,6 @@ holding contextual information. See `org-export-data'."
(org-e-odt--wrap-label dynamic-block contents))
-;;;; Emphasis
-
-(defun org-e-odt-emphasis (emphasis contents info)
- "Transcode EMPHASIS from Org to HTML.
-CONTENTS is the contents of the emphasized text. INFO is a plist
-holding contextual information.."
- ;; (format (cdr (assoc (org-element-property :marker emphasis)
- ;; org-e-odt-emphasis-alist))
- ;; contents)
- (org-e-odt-format-fontify
- contents (cadr (assoc
- (org-element-property :marker emphasis)
- '(("*" bold)
- ("/" emphasis)
- ("_" underline)
- ("=" code)
- ("~" verbatim)
- ("+" strike))))))
-
-
;;;; Entity
(defun org-e-odt-entity (entity contents info)
@@ -3248,6 +3246,15 @@ holding contextual information."
contents)
nil nil "OrgInlineTaskFrame" " style:rel-width=\"100%\""))))))
+;;;; Italic
+
+(defun org-e-odt-italic (italic contents info)
+ "Transcode ITALIC from Org to HTML.
+CONTENTS is the text with italic markup. INFO is a plist holding
+contextual information."
+ (org-e-odt-format-fontify contents 'italic))
+
+
;;;; Item
(defun org-e-odt-format-list-item (contents type checkbox
@@ -3847,6 +3854,15 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(org-e-odt-format-fontify cookie-value 'code)))
+;;;; Strike-Through
+
+(defun org-e-odt-strike-through (strike-through contents info)
+ "Transcode STRIKE-THROUGH from Org to HTML.
+CONTENTS is the text with strike-through markup. INFO is a plist
+holding contextual information."
+ (org-e-odt-format-fontify contents 'strike))
+
+
;;;; Subscript
(defun org-e-odt-subscript (subscript contents info)
@@ -4124,14 +4140,22 @@ information."
"timestamp-wrapper")))
+;;;; Underline
+
+(defun org-e-odt-underline (underline contents info)
+ "Transcode UNDERLINE from Org to HTML.
+CONTENTS is the text with underline markup. INFO is a plist
+holding contextual information."
+ (org-e-odt-format-fontify contents 'underline))
+
+
;;;; Verbatim
(defun org-e-odt-verbatim (verbatim contents info)
"Transcode a VERBATIM object from Org to HTML.
CONTENTS is nil. INFO is a plist used as a communication
channel."
- (org-e-odt-emphasis
- verbatim (org-element-property :value verbatim) info))
+ (org-e-odt-format-fontify (org-element-property :value verbatim) 'verbatim))
;;;; Verse Block
diff --git a/contrib/lisp/org-element.el b/contrib/lisp/org-element.el
index f3d6dda..ddd7144 100644
--- a/contrib/lisp/org-element.el
+++ b/contrib/lisp/org-element.el
@@ -49,12 +49,12 @@
;; `verse-block' types can contain Org objects and plain text.
;;
;; Objects are related to document's contents. Some of them are
-;; recursive. Associated types are of the following: `emphasis',
+;; recursive. Associated types are of the following: `bold', `code',
;; `entity', `export-snippet', `footnote-reference',
-;; `inline-babel-call', `inline-src-block', `latex-fragment',
-;; `line-break', `link', `macro', `radio-target', `statistics-cookie',
-;; `subscript', `superscript', `table-cell', `target', `time-stamp'
-;; and `verbatim'.
+;; `inline-babel-call', `inline-src-block', `italic',
+;; `latex-fragment', `line-break', `link', `macro', `radio-target',
+;; `statistics-cookie', `strike-through', `subscript', `superscript',
+;; `table-cell', `target', `time-stamp', `underline' and `verbatim'.
;;
;; Some elements also have special properties whose value can hold
;; objects themselves (i.e. an item tag or an headline name). Such
@@ -1639,78 +1639,113 @@ CONTENTS is verse block contents."
;;; Objects
-
+;;
;; Unlike to elements, interstices can be found between objects.
;; That's why, along with the parser, successor functions are provided
-;; for each object. Some objects share the same successor
-;; (i.e. `emphasis' and `verbatim' objects).
-
+;; for each object. Some objects share the same successor (i.e. `code'
+;; and `verbatim' objects).
+;;
;; A successor must accept a single argument bounding the search. It
;; will return either a cons cell whose CAR is the object's type, as
;; a symbol, and CDR the position of its next occurrence, or nil.
-
+;;
;; Successors follow the naming convention:
;; org-element-NAME-successor, where NAME is the name of the
;; successor, as defined in `org-element-all-successors'.
-
+;;
;; Some object types (i.e. `emphasis') are recursive. Restrictions on
;; object types they can contain will be specified in
;; `org-element-object-restrictions'.
-
+;;
;; Adding a new type of object is simple. Implement a successor,
;; a parser, and an interpreter for it, all following the naming
;; convention. Register type in `org-element-all-objects' and
;; successor in `org-element-all-successors'. Maybe tweak
;; restrictions about it, and that's it.
-;;;; Emphasis
-(defun org-element-emphasis-parser ()
- "Parse text markup object at point.
+;;;; Bold
-Return a list whose CAR is `emphasis' and CDR is a plist with
-`:marker', `:begin', `:end', `:contents-begin' and
-`:contents-end' and `:post-blank' keywords.
+(defun org-element-bold-parser ()
+ "Parse bold object at point.
-Assume point is at the first emphasis marker."
+Return a list whose CAR is `bold' and CDR is a plist with
+`:begin', `:end', `:contents-begin' and `:contents-end' and
+`:post-blank' keywords.
+
+Assume point is at the first star marker."
(save-excursion
(unless (bolp) (backward-char 1))
(looking-at org-emph-re)
(let ((begin (match-beginning 2))
- (marker (org-match-string-no-properties 3))
(contents-begin (match-beginning 4))
(contents-end (match-end 4))
(post-blank (progn (goto-char (match-end 2))
(skip-chars-forward " \t")))
(end (point)))
- `(emphasis
- (:marker ,marker
- :begin ,begin
- :end ,end
- :contents-begin ,contents-begin
- :contents-end ,contents-end
- :post-blank ,post-blank)))))
+ `(bold
+ (:begin ,begin
+ :end ,end
+ :contents-begin ,contents-begin
+ :contents-end ,contents-end
+ :post-blank ,post-blank)))))
-(defun org-element-emphasis-interpreter (emphasis contents)
- "Interpret EMPHASIS object as Org syntax.
+(defun org-element-bold-interpreter (bold contents)
+ "Interpret BOLD object as Org syntax.
CONTENTS is the contents of the object."
- (let ((marker (org-element-property :marker emphasis)))
- (concat marker contents marker)))
+ (format "*%s*" contents))
(defun org-element-text-markup-successor (limit)
- "Search for the next emphasis or verbatim object.
+ "Search for the next text-markup object.
LIMIT bounds the search.
-Return value is a cons cell whose CAR is `emphasis' or `verbatim'
+Return value is a cons cell whose CAR is a symbol among `bold',
+`italic', `underline', `strike-through', `code' and `verbatim'
and CDR is beginning position."
(save-excursion
(unless (bolp) (backward-char))
(when (re-search-forward org-emph-re limit t)
- (cons (if (nth 4 (assoc (match-string 3) org-emphasis-alist))
- 'verbatim
- 'emphasis)
- (match-beginning 2)))))
+ (let ((marker (match-string 3)))
+ (cons (cond
+ ((equal marker "*") 'bold)
+ ((equal marker "/") 'italic)
+ ((equal marker "_") 'underline)
+ ((equal marker "+") 'strike-through)
+ ((equal marker "~") 'code)
+ ((equal marker "=") 'verbatim)
+ (t (error "Unknown marker at %d" (match-beginning 3))))
+ (match-beginning 2))))))
+
+
+;;;; Code
+
+(defun org-element-code-parser ()
+ "Parse code object at point.
+
+Return a list whose CAR is `code' and CDR is a plist with
+`:value', `:begin', `:end' and `:post-blank' keywords.
+
+Assume point is at the first tilde marker."
+ (save-excursion
+ (unless (bolp) (backward-char 1))
+ (looking-at org-emph-re)
+ (let ((begin (match-beginning 2))
+ (value (org-match-string-no-properties 4))
+ (post-blank (progn (goto-char (match-end 2))
+ (skip-chars-forward " \t")))
+ (end (point)))
+ `(code
+ (:value ,value
+ :begin ,begin
+ :end ,end
+ :post-blank ,post-blank)))))
+
+(defun org-element-code-interpreter (code contents)
+ "Interpret CODE object as Org syntax.
+CONTENTS is nil."
+ (format "~%s~" (org-element-property :value code)))
+
;;;; Entity
@@ -2008,6 +2043,37 @@ CDR is beginning position."
(when (re-search-forward org-babel-inline-src-block-regexp limit t)
(cons 'inline-src-block (match-beginning 1)))))
+;;;; Italic
+
+(defun org-element-italic-parser ()
+ "Parse italic object at point.
+
+Return a list whose CAR is `italic' and CDR is a plist with
+`:begin', `:end', `:contents-begin' and `:contents-end' and
+`:post-blank' keywords.
+
+Assume point is at the first slash marker."
+ (save-excursion
+ (unless (bolp) (backward-char 1))
+ (looking-at org-emph-re)
+ (let ((begin (match-beginning 2))
+ (contents-begin (match-beginning 4))
+ (contents-end (match-end 4))
+ (post-blank (progn (goto-char (match-end 2))
+ (skip-chars-forward " \t")))
+ (end (point)))
+ `(italic
+ (:begin ,begin
+ :end ,end
+ :contents-begin ,contents-begin
+ :contents-end ,contents-end
+ :post-blank ,post-blank)))))
+
+(defun org-element-italic-interpreter (italic contents)
+ "Interpret ITALIC object as Org syntax.
+CONTENTS is the contents of the object."
+ (format "/%s/" contents))
+
;;;; Latex Fragment
@@ -2325,6 +2391,38 @@ CDR is beginning position."
(cons 'statistics-cookie (match-beginning 0)))))
+;;;; Strike-Through
+
+(defun org-element-strike-through-parser ()
+ "Parse strike-through object at point.
+
+Return a list whose CAR is `strike-through' and CDR is a plist
+with `:begin', `:end', `:contents-begin' and `:contents-end' and
+`:post-blank' keywords.
+
+Assume point is at the first plus sign marker."
+ (save-excursion
+ (unless (bolp) (backward-char 1))
+ (looking-at org-emph-re)
+ (let ((begin (match-beginning 2))
+ (contents-begin (match-beginning 4))
+ (contents-end (match-end 4))
+ (post-blank (progn (goto-char (match-end 2))
+ (skip-chars-forward " \t")))
+ (end (point)))
+ `(strike-through
+ (:begin ,begin
+ :end ,end
+ :contents-begin ,contents-begin
+ :contents-end ,contents-end
+ :post-blank ,post-blank)))))
+
+(defun org-element-strike-through-interpreter (strike-through contents)
+ "Interpret STRIKE-THROUGH object as Org syntax.
+CONTENTS is the contents of the object."
+ (format "+%s+" contents))
+
+
;;;; Subscript
(defun org-element-subscript-parser ()
@@ -2562,37 +2660,65 @@ beginning position."
(cons 'time-stamp (match-beginning 0)))))
+;;;; Underline
+
+(defun org-element-underline-parser ()
+ "Parse underline object at point.
+
+Return a list whose CAR is `underline' and CDR is a plist with
+`:begin', `:end', `:contents-begin' and `:contents-end' and
+`:post-blank' keywords.
+
+Assume point is at the first underscore marker."
+ (save-excursion
+ (unless (bolp) (backward-char 1))
+ (looking-at org-emph-re)
+ (let ((begin (match-beginning 2))
+ (contents-begin (match-beginning 4))
+ (contents-end (match-end 4))
+ (post-blank (progn (goto-char (match-end 2))
+ (skip-chars-forward " \t")))
+ (end (point)))
+ `(underline
+ (:begin ,begin
+ :end ,end
+ :contents-begin ,contents-begin
+ :contents-end ,contents-end
+ :post-blank ,post-blank)))))
+
+(defun org-element-underline-interpreter (underline contents)
+ "Interpret UNDERLINE object as Org syntax.
+CONTENTS is the contents of the object."
+ (format "_%s_" contents))
+
+
;;;; Verbatim
(defun org-element-verbatim-parser ()
"Parse verbatim object at point.
Return a list whose CAR is `verbatim' and CDR is a plist with
-`:marker', `:begin', `:end' and `:post-blank' keywords.
+`:value', `:begin', `:end' and `:post-blank' keywords.
-Assume point is at the first verbatim marker."
+Assume point is at the first equal sign marker."
(save-excursion
(unless (bolp) (backward-char 1))
(looking-at org-emph-re)
(let ((begin (match-beginning 2))
- (marker (org-match-string-no-properties 3))
(value (org-match-string-no-properties 4))
(post-blank (progn (goto-char (match-end 2))
(skip-chars-forward " \t")))
(end (point)))
`(verbatim
- (:marker ,marker
- :begin ,begin
- :end ,end
- :value ,value
- :post-blank ,post-blank)))))
+ (:value ,value
+ :begin ,begin
+ :end ,end
+ :post-blank ,post-blank)))))
(defun org-element-verbatim-interpreter (verbatim contents)
"Interpret VERBATIM object as Org syntax.
CONTENTS is nil."
- (let ((marker (org-element-property :marker verbatim))
- (value (org-element-property :value verbatim)))
- (concat marker value marker)))
+ (format "=%s=" (org-element-property :value verbatim)))
@@ -2645,7 +2771,9 @@ CONTENTS is nil."
(defconst org-element-object-successor-alist
'((subscript . sub/superscript) (superscript . sub/superscript)
- (emphasis . text-markup) (verbatim . text-markup)
+ (bold . text-markup) (code . text-markup) (italic . text-markup)
+ (strike-through . text-markup) (underline . text-markup)
+ (verbatim . text-markup) (verbatim . text-markup)
(entity . latex-or-entity) (latex-fragment . latex-or-entity))
"Alist of translations between object type and successor name.
@@ -2660,7 +2788,8 @@ regexp matching one object can also match the other object.")
"Complete list of object types.")
(defconst org-element-recursive-objects
- '(emphasis link macro subscript radio-target superscript table-cell)
+ '(bold italic link macro subscript radio-target strike-through superscript
+ table-cell underline)
"List of recursive object types.")
(defconst org-element-non-recursive-block-alist
@@ -2721,8 +2850,8 @@ This list is checked after translations have been applied. See
`org-element-keyword-translation-alist'.")
(defconst org-element-object-restrictions
- `((emphasis entity export-snippet inline-babel-call inline-src-block link
- radio-target sub/superscript target text-markup time-stamp)
+ `((bold entity export-snippet inline-babel-call inline-src-block link
+ radio-target sub/superscript target text-markup time-stamp)
(footnote-reference entity export-snippet footnote-reference
inline-babel-call inline-src-block latex-fragment
line-break link macro radio-target sub/superscript
@@ -2732,6 +2861,8 @@ This list is checked after translations have been applied. See
time-stamp)
(inlinetask entity inline-babel-call inline-src-block latex-fragment link
macro radio-target sub/superscript text-markup time-stamp)
+ (italic entity export-snippet inline-babel-call inline-src-block link
+ radio-target sub/superscript target text-markup time-stamp)
(item entity inline-babel-call latex-fragment macro radio-target
sub/superscript target text-markup)
(keyword entity latex-fragment macro sub/superscript text-markup)
@@ -2740,6 +2871,9 @@ This list is checked after translations have been applied. See
(macro macro)
(paragraph ,@org-element-all-successors)
(radio-target entity export-snippet latex-fragment sub/superscript)
+ (strike-through entity export-snippet inline-babel-call inline-src-block
+ link radio-target sub/superscript target text-markup
+ time-stamp)
(subscript entity export-snippet inline-babel-call inline-src-block
latex-fragment sub/superscript text-markup)
(superscript entity export-snippet inline-babel-call inline-src-block
@@ -2747,6 +2881,8 @@ This list is checked after translations have been applied. See
(table-cell entity export-snippet latex-fragment link macro radio-target
sub/superscript target text-markup time-stamp)
(table-row table-cell)
+ (underline entity export-snippet inline-babel-call inline-src-block link
+ radio-target sub/superscript target text-markup time-stamp)
(verse-block entity footnote-reference inline-babel-call inline-src-block
latex-fragment line-break link macro radio-target
sub/superscript target text-markup time-stamp))
diff --git a/contrib/lisp/org-export.el b/contrib/lisp/org-export.el
index 4f607b9..d1b12cb 100644
--- a/contrib/lisp/org-export.el
+++ b/contrib/lisp/org-export.el
@@ -177,8 +177,10 @@ way they are handled must be hard-coded into
`org-export-get-inbuffer-options' function.")
(defconst org-export-filters-alist
- '((:filter-babel-call . org-export-filter-babel-call-functions)
+ '((:filter-bold . org-export-filter-bold-functions)
+ (:filter-babel-call . org-export-filter-babel-call-functions)
(:filter-center-block . org-export-filter-center-block-functions)
+ (:filter-code . org-export-filter-code-functions)
(:filter-comment . org-export-filter-comment-functions)
(:filter-comment-block . org-export-filter-comment-block-functions)
(:filter-drawer . org-export-filter-drawer-functions)
@@ -197,6 +199,7 @@ way they are handled must be hard-coded into
(:filter-inline-babel-call . org-export-filter-inline-babel-call-functions)
(:filter-inline-src-block . org-export-filter-inline-src-block-functions)
(:filter-inlinetask . org-export-filter-inlinetask-functions)
+ (:filter-italic . org-export-filter-italic-functions)
(:filter-item . org-export-filter-item-functions)
(:filter-keyword . org-export-filter-keyword-functions)
(:filter-latex-environment . org-export-filter-latex-environment-functions)
@@ -216,6 +219,7 @@ way they are handled must be hard-coded into
(:filter-special-block . org-export-filter-special-block-functions)
(:filter-src-block . org-export-filter-src-block-functions)
(:filter-statistics-cookie . org-export-filter-statistics-cookie-functions)
+ (:filter-strike-through . org-export-filter-strike-through-functions)
(:filter-subscript . org-export-filter-subscript-functions)
(:filter-superscript . org-export-filter-superscript-functions)
(:filter-table . org-export-filter-table-functions)
@@ -223,6 +227,7 @@ way they are handled must be hard-coded into
(:filter-table-row . org-export-filter-table-row-functions)
(:filter-target . org-export-filter-target-functions)
(:filter-time-stamp . org-export-filter-time-stamp-functions)
+ (:filter-underline . org-export-filter-underline-functions)
(:filter-verbatim . org-export-filter-verbatim-functions)
(:filter-verse-block . org-export-filter-verse-block-functions))
"Alist between filters properties and initial values.
@@ -258,8 +263,9 @@ rules.")
;; Configuration for the masses.
-;; They should never be evaled directly, as their value is to be
+;; They should never be accessed directly, as their value is to be
;; stored in a property list (cf. `org-export-option-alist').
+;; Back-ends will read their value from there instead.
(defgroup org-export nil
"Options for exporting Org mode files."
@@ -583,7 +589,9 @@ e.g. \"timestamp:nil\"."
(defcustom org-export-with-todo-keywords t
"Non-nil means include TODO keywords in export.
-When nil, remove all these keywords from the export.")
+When nil, remove all these keywords from the export."
+ :group 'org-export-general
+ :type 'boolean)
(defcustom org-export-allow-BIND 'confirm
"Non-nil means allow #+BIND to define local variable values for export.
@@ -1697,6 +1705,7 @@ code executed, on a copy of original buffer's area being
exported. Visibility is the same as in the original one. Point
is left at the beginning of the new one.")
+
;;;; Special Filters
(defvar org-export-filter-parse-tree-functions nil
@@ -1725,317 +1734,301 @@ nil.")
(defvar org-export-filter-center-block-functions nil
"List of functions applied to a transcoded center block.
-Each filter is called with three arguments: the transcoded center
-block, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-drawer-functions nil
"List of functions applied to a transcoded drawer.
-Each filter is called with three arguments: the transcoded
-drawer, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-dynamic-block-functions nil
"List of functions applied to a transcoded dynamic-block.
-Each filter is called with three arguments: the transcoded
-dynamic-block, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-headline-functions nil
"List of functions applied to a transcoded headline.
-Each filter is called with three arguments: the transcoded
-headline, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-inlinetask-functions nil
"List of functions applied to a transcoded inlinetask.
-Each filter is called with three arguments: the transcoded
-inlinetask, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-plain-list-functions nil
"List of functions applied to a transcoded plain-list.
-Each filter is called with three arguments: the transcoded
-plain-list, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-item-functions nil
"List of functions applied to a transcoded item.
-Each filter is called with three arguments: the transcoded item,
+Each filter is called with three arguments: the transcoded data,
as a string, the back-end, as a symbol, and the communication
channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-comment-functions nil
"List of functions applied to a transcoded comment.
-Each filter is called with three arguments: the transcoded
-comment, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-comment-block-functions nil
"List of functions applied to a transcoded comment-comment.
-Each filter is called with three arguments: the transcoded
-comment-block, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-example-block-functions nil
"List of functions applied to a transcoded example-block.
-Each filter is called with three arguments: the transcoded
-example-block, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-export-block-functions nil
"List of functions applied to a transcoded export-block.
-Each filter is called with three arguments: the transcoded
-export-block, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-fixed-width-functions nil
"List of functions applied to a transcoded fixed-width.
-Each filter is called with three arguments: the transcoded
-fixed-width, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-footnote-definition-functions nil
"List of functions applied to a transcoded footnote-definition.
-Each filter is called with three arguments: the transcoded
-footnote-definition, as a string, the back-end, as a symbol, and
-the communication channel, as a plist. It must return a string
-or nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-horizontal-rule-functions nil
"List of functions applied to a transcoded horizontal-rule.
-Each filter is called with three arguments: the transcoded
-horizontal-rule, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-keyword-functions nil
"List of functions applied to a transcoded keyword.
-Each filter is called with three arguments: the transcoded
-keyword, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-latex-environment-functions nil
"List of functions applied to a transcoded latex-environment.
-Each filter is called with three arguments: the transcoded
-latex-environment, as a string, the back-end, as a symbol, and
-the communication channel, as a plist. It must return a string
-or nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-babel-call-functions nil
"List of functions applied to a transcoded babel-call.
-Each filter is called with three arguments: the transcoded
-babel-call, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-paragraph-functions nil
"List of functions applied to a transcoded paragraph.
-Each filter is called with three arguments: the transcoded
-paragraph, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-property-drawer-functions nil
"List of functions applied to a transcoded property-drawer.
-Each filter is called with three arguments: the transcoded
-property-drawer, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-quote-block-functions nil
"List of functions applied to a transcoded quote block.
Each filter is called with three arguments: the transcoded quote
-block, as a string, the back-end, as a symbol, and the
+data, as a string, the back-end, as a symbol, and the
communication channel, as a plist. It must return a string or
nil.")
(defvar org-export-filter-quote-section-functions nil
"List of functions applied to a transcoded quote-section.
-Each filter is called with three arguments: the transcoded
-quote-section, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-section-functions nil
"List of functions applied to a transcoded section.
-Each filter is called with three arguments: the transcoded
-section, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-special-block-functions nil
"List of functions applied to a transcoded special block.
-Each filter is called with three arguments: the transcoded
-special block, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-src-block-functions nil
"List of functions applied to a transcoded src-block.
-Each filter is called with three arguments: the transcoded
-src-block, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-table-functions nil
"List of functions applied to a transcoded table.
-Each filter is called with three arguments: the transcoded table,
+Each filter is called with three arguments: the transcoded data,
as a string, the back-end, as a symbol, and the communication
channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-table-cell-functions nil
"List of functions applied to a transcoded table-cell.
-Each filter is called with three arguments: the transcoded
-table-cell, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-table-row-functions nil
"List of functions applied to a transcoded table-row.
-Each filter is called with three arguments: the transcoded
-table-row, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-verse-block-functions nil
"List of functions applied to a transcoded verse block.
-Each filter is called with three arguments: the transcoded verse
-block, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
;;;; Objects Filters
-(defvar org-export-filter-emphasis-functions nil
- "List of functions applied to a transcoded emphasis.
-Each filter is called with three arguments: the transcoded
-emphasis, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+(defvar org-export-filter-bold-functions nil
+ "List of functions applied to transcoded bold text.
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
+
+(defvar org-export-filter-code-functions nil
+ "List of functions applied to transcoded code text.
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-entity-functions nil
"List of functions applied to a transcoded entity.
-Each filter is called with three arguments: the transcoded
-entity, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-export-snippet-functions nil
"List of functions applied to a transcoded export-snippet.
-Each filter is called with three arguments: the transcoded
-export-snippet, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-footnote-reference-functions nil
"List of functions applied to a transcoded footnote-reference.
-Each filter is called with three arguments: the transcoded
-footnote-reference, as a string, the back-end, as a symbol, and
-the communication channel, as a plist. It must return a string
-or nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-inline-babel-call-functions nil
"List of functions applied to a transcoded inline-babel-call.
-Each filter is called with three arguments: the transcoded
-inline-babel-call, as a string, the back-end, as a symbol, and
-the communication channel, as a plist. It must return a string
-or nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-inline-src-block-functions nil
"List of functions applied to a transcoded inline-src-block.
-Each filter is called with three arguments: the transcoded
-inline-src-block, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
+
+(defvar org-export-filter-italic-functions nil
+ "List of functions applied to transcoded italic text.
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-latex-fragment-functions nil
"List of functions applied to a transcoded latex-fragment.
-Each filter is called with three arguments: the transcoded
-latex-fragment, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-line-break-functions nil
"List of functions applied to a transcoded line-break.
-Each filter is called with three arguments: the transcoded
-line-break, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-link-functions nil
"List of functions applied to a transcoded link.
-Each filter is called with three arguments: the transcoded link,
+Each filter is called with three arguments: the transcoded data,
as a string, the back-end, as a symbol, and the communication
channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-macro-functions nil
"List of functions applied to a transcoded macro.
-Each filter is called with three arguments: the transcoded macro,
+Each filter is called with three arguments: the transcoded data,
as a string, the back-end, as a symbol, and the communication
channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-radio-target-functions nil
"List of functions applied to a transcoded radio-target.
-Each filter is called with three arguments: the transcoded
-radio-target, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-statistics-cookie-functions nil
"List of functions applied to a transcoded statistics-cookie.
-Each filter is called with three arguments: the transcoded
-statistics-cookie, as a string, the back-end, as a symbol, and
-the communication channel, as a plist. It must return a string
-or nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
+
+(defvar org-export-filter-strike-through-functions nil
+ "List of functions applied to transcoded strike-through text.
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-subscript-functions nil
"List of functions applied to a transcoded subscript.
-Each filter is called with three arguments: the transcoded
-subscript, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-superscript-functions nil
"List of functions applied to a transcoded superscript.
-Each filter is called with three arguments: the transcoded
-superscript, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-target-functions nil
"List of functions applied to a transcoded target.
-Each filter is called with three arguments: the transcoded
-target, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-time-stamp-functions nil
"List of functions applied to a transcoded time-stamp.
-Each filter is called with three arguments: the transcoded
-time-stamp, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
+
+(defvar org-export-filter-underline-functions nil
+ "List of functions applied to transcoded underline text.
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defvar org-export-filter-verbatim-functions nil
- "List of functions applied to a transcoded verbatim.
-Each filter is called with three arguments: the transcoded
-verbatim, as a string, the back-end, as a symbol, and the
-communication channel, as a plist. It must return a string or
-nil.")
+ "List of functions applied to transcoded verbatim text.
+Each filter is called with three arguments: the transcoded data,
+as a string, the back-end, as a symbol, and the communication
+channel, as a plist. It must return a string or nil.")
(defun org-export-filter-apply-functions (filters value info)
"Call every function in FILTERS.
diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el
index feb75d2..0bc662e 100644
--- a/testing/lisp/test-org-element.el
+++ b/testing/lisp/test-org-element.el
@@ -650,6 +650,14 @@ Paragraph \\alpha."
(equal (org-test-parse-and-interpret "#+BEGIN_VERSE\nTest\n#+END_VERSE")
"#+BEGIN_VERSE\nTest\n#+END_VERSE\n")))
+(ert-deftest test-org-element/bold-interpreter ()
+ "Test bold interpreter."
+ (should (equal (org-test-parse-and-interpret "*text*") "*text*\n")))
+
+(ert-deftest test-org-element/code-interpreter ()
+ "Test code interpreter."
+ (should (equal (org-test-parse-and-interpret "~text~") "~text~\n")))
+
(ert-deftest test-org-element/entity-interpreter ()
"Test entity interpreter."
;; 1. Without brackets.
@@ -702,6 +710,10 @@ Paragraph \\alpha."
"src_emacs-lisp[:results silent]{(+ 1 1)}")
"src_emacs-lisp[:results silent]{(+ 1 1)}\n")))
+(ert-deftest test-org-element/italic-interpreter ()
+ "Test italic interpreter."
+ (should (equal (org-test-parse-and-interpret "/text/") "/text/\n")))
+
(ert-deftest test-org-element/latex-fragment-interpreter ()
"Test latex fragment interpreter."
(let ((org-latex-regexps
@@ -772,6 +784,10 @@ Paragraph \\alpha."
;; 2. With percent.
(should (equal (org-test-parse-and-interpret "[66%]") "[66%]\n")))
+(ert-deftest test-org-element/strike-through-interpreter ()
+ "Test strike through interpreter."
+ (should (equal (org-test-parse-and-interpret "+target+") "+target+\n")))
+
(ert-deftest test-org-element/subscript-interpreter ()
"Test subscript interpreter."
;; 1. Without brackets.
@@ -790,6 +806,14 @@ Paragraph \\alpha."
"Test target interpreter."
(should (equal (org-test-parse-and-interpret "<<target>>") "<<target>>\n")))
+(ert-deftest test-org-element/underline-interpreter ()
+ "Test underline interpreter."
+ (should (equal (org-test-parse-and-interpret "_text_") "_text_\n")))
+
+(ert-deftest test-org-element/verbatim-interpreter ()
+ "Test verbatim interpreter."
+ (should (equal (org-test-parse-and-interpret "=text=") "=text=\n")))
+
;;;; Normalize contents
@@ -820,8 +844,8 @@ Paragraph \\alpha."
(should
(equal
(org-element-normalize-contents
- '(paragraph nil " Two spaces " (emphasis nil " and\n One space")))
- '(paragraph nil " Two spaces " (emphasis nil " and\nOne space"))))
+ '(paragraph nil " Two spaces " (bold nil " and\n One space")))
+ '(paragraph nil " Two spaces " (bold nil " and\nOne space"))))
;; 5. When optional argument is provided, ignore first line
;; indentation.
(should