1 #+TITLE: Org Export Reference Documentation
2 #+AUTHOR: Nicolas Goaziou
3 #+EMAIL: n.goaziou AT gmail DOT com
4 #+OPTIONS: H:3 num:nil toc:t \n:nil @:t ::t |:t ^:t -:t f:t *:t TeX:t LaTeX:t skip:nil d:(HIDE) tags:not-in-toc
5 #+STARTUP: align fold nodlcheck hidestars oddeven lognotestate
6 #+SEQ_TODO: TODO(t) INPROGRESS(i) WAITING(w@) | DONE(d) CANCELED(c@)
7 #+TAGS: Write(w) Update(u) Fix(f) Check(c) NEW(n)
12 [[file:../index.org][{Back to Worg's index}]]
14 This document is aimed at back-end developers for the generic export
15 engine =org-export.el=. It assumes a good understanding of Org
16 syntax --- as specified by /Org Elements/ --- from the reader.
18 It covers [[#back-end][back-end creation]] process, all [[#attributes][attributes]] associated to each
19 element or object type, properties offered by the [[#communication][communication
20 channel]] during export, the [[#filter-system][filter system]] internals and [[#toolbox][tools]] provided
21 by the exporter. Eventually, expected [[#interactive][interactive functions]] aimed at
22 end-users are explained in the last part of this document.
27 A back-end is defined with ~org-export-define-backend~ macro. It
28 requires two mandatory arguments: the back-end name and its
29 translation table, an alist that associates element and object types
30 to translator functions. According to the macro doc-string:
33 These functions should return a string without any trailing space,
34 or nil. They must accept three arguments: the object or element
35 itself, its contents or nil when it isn't recursive and the property
36 list used as a communication channel.
38 Contents, when not nil, are stripped from any global indentation
39 (although the relative one is preserved). They also always end with
40 a single newline character.
42 If, for a given type, no function is found, that element or object
43 type will simply be ignored, along with any blank line or white
44 space at its end. The same will happen if the function returns the
45 nil value. If that function returns the empty string, the type will
46 be ignored, but the blank lines or white spaces will be kept.
48 In addition to element and object types, one function can be
49 associated to the ~template~ symbol and another one to the
52 The former returns the final transcoded string, and can be used to
53 add a preamble and a postamble to document's body. It must accept
54 two arguments: the transcoded string and the property list
55 containing export options.
57 The latter, when defined, is to be called on every text not
58 recognized as an element or an object. It must accept two
59 arguments: the text string and the information channel. It is an
60 appropriate place to protect special chars relative to the back-end.
63 Optionally, the macro can set-up back-end specific properties (like
64 values from specific buffer keywords) accessible from every
65 translator function with the ~:options-alist~ keyword. See
66 ~org-export-options-alist~ for details on the structure of the
69 As an example, the following excerpt from =e-latex= back-end
70 definition introduces three new buffer keywords (and their
71 headline's property counterpart), and redefine ~DATE~ default value:
73 #+BEGIN_SRC emacs-lisp
74 (org-export-define-backend e-latex
76 :options-alist ((:date "DATE" nil org-e-latex-date-format t)
77 (:latex-class "LATEX_CLASS" nil org-e-latex-default-class t)
78 (:latex-class-options "LATEX_CLASS_OPTIONS" nil nil t)
79 (:latex-header-extra "LATEX_HEADER" nil nil newline)))
82 It is also possible, with ~:export-block~ keyword, to associate
83 given block names to the ~export-block~ type. Such blocks can
84 contain raw code that will be directly inserted in the output, as
85 long as the corresponding translator function says so.
87 In the following example, in the ~e-html~ back-end, =HTML= blocks
88 are export blocks. The associated translator function inserts their
89 contents as-is, and ignores any other export block.
91 #+BEGIN_SRC emacs-lisp
92 (org-export-define-backend e-html
94 (export-block . org-e-html-export-block)
98 (defun org-e-html-export-block (export-block contents info)
99 "Transcode a EXPORT-BLOCK element from Org to HTML.
100 CONTENTS is nil. INFO is a plist used as a communication
102 (when (string= (org-element-property :type export-block) "HTML")
103 (org-element-property :value export-block)))
106 Eventually ~org-export-define-backend~ allows to define back-ends
107 specific filters. Refer to [[#filter-system][The Filter System]] section for more
110 If the new back-end shares most properties with another one,
111 ~org-export-define-derived-backend~ macro can be used to simplify
112 the process. In the example below, we implement a new back-end
113 which behaves like =e-latex= excepted for headlines and the
116 #+BEGIN_SRC emacs-lisp
117 (org-export-define-derived-backend my-latex e-latex
118 :translate-alist ((headline . custom-headline-translator)
119 (template . custom-template)))
122 Back-ends defined with either function can be registered in the
123 export dispatcher using special keyword =:menu-entry=. See macros
124 docstrings for more information.
126 * Elements Attributes
128 :CUSTOM_ID: attributes
131 Element attributes are accessed with ~org-element-property~
132 function. Other accessors relative to elements are
133 ~org-element-type~ and ~org-element-contents~.
135 Each greater element, element and object has a fixed set of
136 properties attached to it. Among them, four are shared by all
137 types: ~:begin~ and ~:end~, which refer to the beginning and ending
138 buffer positions of the considered element or object, ~:post-blank~,
139 which holds the number of blank lines, or white spaces, at its end
140 and ~:parent~ which refers to the element or object containing it.
142 Greater elements, elements and objects containing objects will have
143 ~:contents-begin~ and ~:contents-end~ properties to delimit
144 contents. Greater elements and elements accepting affiliated
145 keywords will also have a ~:post-affiliated~ property, referring to
146 the buffer position after any affiliated keyword, when applicable.
148 In addition to these properties, each element can optionally get
149 some more from affiliated keywords, namely: ~:attr_ascii~,
150 ~:attr_docbook~, ~:attr_html~, ~:attr_latex~, ~:attr_odt~,
151 ~:caption~, ~:header~, ~:name~, ~:plot~, and ~:results~.
153 At the lowest level, a ~:parent~ property is also attached to any
154 string, as a text property.
156 Other properties, specific to each element or object, are listed
163 - ~:info~ :: Information about function being called, as returned
164 by ~ob-babel-lob-get-info~ (string).
169 No specific property.
175 - ~:hiddenp~ :: Non-nil if the block is hidden (boolean).
181 - ~:duration~ :: Clock duration for a closed clock, or nil (string
183 - ~:status~ :: Status of current clock (symbol: ~closed~ or
185 - ~:value~ :: Timestamp associated to clock keyword (timestamp
192 - ~:value~ :: Contents (string).
198 - ~:value~ :: Comments, with pound signs (string).
204 - ~:value~ :: Comments, without block's boundaries (string).
205 - ~:hiddenp~ :: Non-nil if block is hidden (boolean).
211 - ~:value~ :: Full Sexp (string).
217 - ~:drawer-name~ :: Drawer's name (string).
218 - ~:hiddenp~ :: Non-nil if the drawer is hidden (boolean).
220 /Note relative to export:/ The idea behind drawers is that they are
221 transparent export-wise. By default, they should return their
222 contents without additional decorations.
228 - ~:arguments~ :: Block's parameters (string).
229 - ~:block-name~ :: Block's name (string).
230 - ~:drawer-name~ :: Drawer's name (string).
231 - ~:hiddenp~ :: Non-nil if the block is hidden (boolean).
237 - ~:ascii~ :: Entity's ASCII representation (string).
238 - ~:html~ :: Entity's HTML representation (string).
239 - ~:latex~ :: Entity's LaTeX representation (string).
240 - ~:latex-math-p~ :: Non-nil if entity's LaTeX representation
241 should be in math mode (boolean).
242 - ~:latin1~ :: Entity's Latin-1 encoding representation (string).
243 - ~:name~ :: Entity's name, without backslash nor brackets
245 - ~:use-brackets-p~ :: Non-nil if entity is written with optional
246 brackets in original buffer (boolean).
247 - ~:utf-8~ :: Entity's UTF-8 encoding representation (string).
253 - ~:hiddenp~ :: Non-nil if block is hidden (boolean).
254 - ~:label-fmt~ :: Format string used to write labels in current
255 block, if different from
256 ~org-coderef-label-format~ (string or nil).
257 - ~:language~ :: Language of the code in the block, if specified
259 - ~:number-lines~ :: Non-nil if code lines should be numbered.
260 A ~new~ value starts numbering from 1 wheareas ~continued~
261 resume numbering from previous numbered block (symbol: ~new~,
263 - ~:options~ :: Block's options located on the block's opening line
265 - ~:parameters~ :: Optional header arguments (string or nil).
266 - ~:preserve-indent~ :: Non-nil when indentation within the block
267 mustn't be modified upon export (boolean).
268 - ~:retain-labels~ :: Non-nil if labels should be kept visible upon
270 - ~:switches~ :: Optional switches for code block export (string or
272 - ~:use-labels~ :: Non-nil if links to labels contained in the
273 block should display the label instead of the
274 line number (boolean).
275 - ~:value~ :: Contents (string).
281 - ~:hiddenp~ :: Non-nil if block is hidden (boolean).
282 - ~:type~ :: Related back-end's name (string).
283 - ~:value~ :: Contents (string).
289 - ~:back-end~ :: Relative back-end's name (string).
290 - ~:value~ :: Export code (string).
296 - ~:value~ :: Contents, with colons (string).
298 ** Footnote Definition
302 - ~:label~ :: Label used for references (string).
304 ** Footnote Reference
308 - ~:inline-definition~ :: Footnote's definition, when inlined
309 (secondary string or nil).
310 - ~:label~ :: Footnote's label, if any (string or nil).
311 - ~:raw-definition~ :: Uninterpreted footnote's definition, when
312 inlined (string or nil).
313 - ~:type~ :: Determine whether reference has its definition inline,
314 or not (symbol: ~inline~, ~standard~).
320 In addition to the following list, any property specified in
321 a property drawer attached to the headline will be accessible as an
322 attribute (with underscores replaced with hyphens and a lowercase
323 name, i.e. ~:custom-id~).
325 - ~:archivedp~ :: Non-nil if the headline has an archive tag
327 - ~:closed~ :: Headline's CLOSED reference, if any (timestamp
329 - ~:commentedp~ :: Non-nil if the headline has a comment keyword
331 - ~:deadline~ :: Headline's DEADLINE reference, if any (timestamp
333 - ~:footnote-section-p~ :: Non-nil if the headline is a footnote
335 - ~:hiddenp~ :: Non-nil if the headline is hidden (boolean).
336 - ~:level~ :: Reduced level of the headline (integer).
337 - ~:pre-blank~ :: Number of blank lines between the headline and
338 the first non-blank line of its contents
340 - ~:priority~ :: Headline's priority, as a character (integer).
341 - ~:quotedp~ :: Non-nil if the headline contains a quote keyword
343 - ~:raw-value~ :: Raw headline's text, without the stars and the
345 - ~:scheduled~ :: Headline's SCHEDULED reference, if any (timestamp
347 - ~:tags~ :: Headline's tags, if any, without the archive
348 tag. (list of strings).
349 - ~:title~ :: Parsed headline's text, without the stars and the
350 tags (secondary string).
351 - ~:todo-keyword~ :: Headline's TODO keyword without quote and
352 comment strings, if any (string or nil).
353 - ~:todo-type~ :: Type of headline's TODO keyword, if any (symbol:
360 No specific property.
366 - ~:info~ :: Information about function called, as returned by
367 ~org-babel-lob-get-info~ (list).
369 /Note relative to export:/ Since Babel related blocks are expanded
370 before parsing, these can safely be ignored by back-ends.
376 - ~:language~ :: Language of the code in the block (string).
377 - ~:parameters~ :: Optional header arguments (string or nil).
378 - ~:value~ :: Source code (string).
384 In addition to the following list, any property specified in
385 a property drawer attached to the headline will be accessible as an
386 attribute (with underscores replaced with hyphens and a lowercase
387 name, i.e. ~:custom-id~).
389 - ~:closed~ :: Inlinetask's CLOSED reference, if any (timestamp
391 - ~:deadline~ :: Inlinetask's DEADLINE reference, if any (timestamp
393 - ~:hiddenp~ :: Non-nil if the headline is hidden (boolean).
394 - ~:level~ :: Reduced level of the inlinetask (integer).
395 - ~:priority~ :: Headline's priority, as a character (integer).
396 - ~:raw-value~ :: Raw inlinetask's text, without the stars and the
398 - ~:scheduled~ :: Inlinetask's SCHEDULED reference, if any
399 (timestamp object or nil).
400 - ~:tags~ :: Inlinetask's tags, if any (list of strings).
401 - ~:title~ :: Parsed inlinetask's text, without the stars and the
402 tags (secondary string).
403 - ~:todo-keyword~ :: Inlinetask's TODO keyword, if any (string or
405 - ~:todo-type~ :: Type of inlinetask's TODO keyword, if any
406 (symbol: ~done~, ~todo~).
412 No specific property.
418 - ~:bullet~ :: Item's bullet (string).
419 - ~:checkbox~ :: Item's check-box, if any (symbol: ~on~, ~off~,
421 - ~:counter~ :: Item's counter, if any. Literal counters become
423 - ~:raw-tag~ :: Uninterpreted item's tag, if any (string or nil).
424 - ~:tag~ :: Parsed item's tag, if any (secondary string or nil).
425 - ~:hiddenp~ :: Non-nil if item is hidden (boolean).
426 - ~:structure~ :: Full list's structure, as returned by
427 ~org-list-struct~ (alist).
433 - ~:key~ :: Keyword's name (string).
434 - ~:value~ :: Keyword's value (string).
436 /Note relative to export:/ Each back-end should, as far as
437 possible, support a number of common keywords. These include:
439 - Back-end relative keyword (i.e. "LATEX" for =e-latex=), which
440 should always return its value as-is.
442 - "TARGET" keyword, which should always return a nil value.
444 - "TOC" keyword. It accepts four common values: "headlines",
445 "tables", "figures", "listings". Also, "headlines" value can
446 have an optional numeric argument to specify depth of the
449 See [[#collect-headlines][~org-export-collect-headlines~]], [[#collect-tables][~org-export-collect-tables~]],
450 [[#collect-figures][~org-export-collect-figures~]] and [[#collect-listings][~org-export-collect-listings~]].
458 - ~:begin~ :: Buffer position at first affiliated keyword or at the
459 beginning of the first line of environment (integer).
460 - ~:end~ :: Buffer position at the first non-blank line after last
461 line of the environment, or buffer's end (integer).
462 - ~:post-blank~ :: Number of blank lines between last environment's
463 line and next non-blank line or buffer's end
465 - ~:value~ :: LaTeX code (string).
471 - ~:value~ :: LaTeX code (string).
477 No specific property.
483 - ~:application~ :: Name of application requested to open the link
484 in Emacs (string or nil). It only applies to
486 - ~:path~ :: Identifier for link's destination. It is usually the
487 link part with type, if specified, removed (string).
488 - ~:raw-link~ :: Uninterpreted link part (string).
489 - ~:search-option~ :: Additional information for file location
490 (string or nil). It only applies to "file" type links.
491 - ~:type~ :: Link's type. Possible types (string) are:
492 - ~coderef~ :: Line in some source code,
493 - ~custom-id~ :: Specific headline's custom-id,
494 - ~file~ :: External file,
495 - ~fuzzy~ :: Target, target keyword, a named element or an
496 headline in the current parse tree,
497 - ~id~ :: Specific headline's id,
498 - ~radio~ :: Radio-target.
499 It can also be any ~org-link-types~ element.
502 /Notes relative to export:/
504 - A fuzzy link leading to a target keyword should be ignored during
505 export: it's an invisible target.
507 - A fuzzy link with no description should display the
508 cross-reference number of its target. This number can be:
510 - If link's destination is a target object within a footnote, it
511 will be footnote's number.
513 - If link's destination is a target object in a list, it will be
516 - If link leads to a named element, it will be the sequence number
517 of that element among named elements of the same type.
519 - Otherwise, it will be the number of the headline containing
522 See [[#get-ordinal][~org-export-get-ordinal~]] function.
528 - ~:args~ :: Arguments passed to the macro (list of strings).
529 - ~:key~ :: Macro's name (string).
530 - ~:value~ :: Replacement text (string).
532 /Note relative to export:/ Macro expansion takes place before
533 buffer parsing. As such, export back-ends don't have to handle:
534 they'll never see them.
538 Element containing objects.
540 No specific property.
546 - ~:structure~ :: Full list's structure, as returned by
547 ~org-list-struct~ (alist).
548 - ~:type~ :: List's type (symbol: ~descriptive~, ~ordered~,
555 - ~:closed~ :: Timestamp associated to closed keyword, if any
556 (timestamp object or nil).
557 - ~:deadline~ :: Timestamp associated to deadline keyword, if any
558 (timestamp object or nil).
559 - ~:scheduled~ :: Timestamp associated to scheduled keyword, if any
560 (timestamp object or nil).
566 - ~:hiddenp~ :: Non-nil if drawer is hidden (boolean).
567 - ~:properties~ :: Properties defined in the drawer (alist).
573 - ~:hiddenp~ :: Non-nil if block is hidden (boolean).
579 - ~:value~ :: Quoted text (string).
585 - ~:raw-value~ :: Uninterpreted contents (string).
591 No specific property.
597 - ~:hiddenp~ :: Non-nil if block is hidden (boolean).
598 - ~:type~ :: Block's name (string).
604 - ~:hiddenp~ :: Non-nil if block is hidden (boolean).
605 - ~:label-fmt~ :: Format string used to write labels in current
606 block, if different from
607 ~org-coderef-label-format~ (string or nil).
608 - ~:language~ :: Language of the code in the block, if specified
610 - ~:number-lines~ :: Non-nil if code lines should be numbered.
611 A ~new~ value starts numbering from 1 wheareas ~continued~
612 resume numbering from previous numbered block (symbol: ~new~,
614 - ~:parameters~ :: Optional header arguments (string or nil).
615 - ~:preserve-indent~ :: Non-nil when indentation within the block
616 mustn't be modified upon export (boolean).
617 - ~:retain-labels~ :: Non-nil if labels should be kept visible upon
619 - ~:switches~ :: Optional switches for code block export (string or
621 - ~:use-labels~ :: Non-nil if links to labels contained in the
622 block should display the label instead of the
623 line number (boolean).
624 - ~:value~ :: Source code (string).
630 - ~:value~ :: Full cookie (string).
636 No specific property.
642 - ~:use-brackets-p~ :: Non-nil if contents are enclosed in curly
649 - ~:use-brackets-p~ :: Non-nil if contents are enclosed in curly
656 - ~:tblfm~ :: Formulas associated to the table, if any (string or
658 - ~:type~ :: Table's origin (symbol: ~table.el~, ~org~).
659 - ~:value~ :: Raw ~table.el~ table or nil (string or nil).
665 No specific property.
669 Element containing objects.
671 - ~:type~ :: Row's type (symbol: ~standard~, ~rule~).
677 - ~:value~ :: Target's ID (string).
680 Notes relatives to export:
682 - Target should become an anchor, if back-end permits it.
683 - Target's ID shouldn't be visible on export.
689 - ~:day-end~ :: Day part from timestamp end. If no ending date is
690 defined, it defaults to start day part (integer).
691 - ~:day-start~ :: Day part from timestamp start (integer).
692 - ~:hour-start~ :: Hour part from timestamp end. If no ending date
693 is defined, it defaults to start hour part, if
694 any (integer or nil).
695 - ~:hour-start~ :: Hour part from timestamp start, if specified
697 - ~:minute-start~ :: Minute part from timestamp end. If no ending
698 date is defined, it defaults to start minute part, if any
700 - ~:minute-start~ :: Minute part from timestamp start, if specified
702 - ~:month-end~ :: Month part from timestamp end. If no ending date
703 is defined, it defaults to start month part
705 - ~:month-start~ :: Month part from timestamp start (integer).
706 - ~:raw-value~ :: Raw timestamp (string).
707 - ~:repeater-type~ :: Type of repeater, if any (symbol: ~catch-up~,
708 ~restart~, ~cumulate~ or nil)
709 - ~:repeater-unit~ :: Unit of shift, if a repeater is defined
710 (symbol: ~year~, ~month~, ~week~, ~day~, ~hour~ or nil).
711 - ~:repeater-value~ :: Value of shift, if a repeater is defined
713 - ~:type~ :: Type of timestamp (symbol: ~active~, ~active-range~,
714 ~diary~, ~inactive~, ~inactive-range~).
715 - ~:year-end~ :: Year part from timestamp end. If no ending date
716 is defined, it defaults to start year part
718 - ~:year-start~ :: Year part from timestamp start (integer).
720 Note relative to export: =org.el= provides tools to work on
721 timestamps objects. In particular, back-ends usually make use of
722 ~org-timestamp-translate~ function. Thus, in =org-e-html.el=, the
723 timestamp object is first translated:
725 #+BEGIN_SRC emacs-lisp
726 (defun org-e-html-timestamp (timestamp contents info)
727 "Transcode a TIMESTAMP object from Org to HTML.
728 CONTENTS is nil. INFO is a plist holding contextual
730 (let ((value (org-e-html-plain-text
731 (org-timestamp-translate timestamp) info)))
732 (format "<span class=\"timestamp-wrapper\"><span class=\"timestamp\">%s</span></span>"
733 (replace-regexp-in-string "--" "–" value))))
740 No specific property.
746 - ~:value~ :: Contents (string).
750 Element containing objects.
752 - ~:hiddenp~ :: Non-nil if block is hidden (boolean).
754 * The Communication Channel
756 :CUSTOM_ID: communication
759 This is the full list of properties available during transcode
760 process, with their category (~option~ or ~tree~) and their value
772 Current back-end used for transcoding.
779 String to write as creation information.
786 String to use as date.
793 Description text for the current data.
807 Tags for exclusion of sub-trees from export process.
810 - type :: list of strings
814 Hash table used to memoize results from [[#data][~org-export-data~]].
821 List of global tags for buffer. Used by [[#get-tags][~org-export-get-tags~]] to
822 get tags with inheritance.
825 - type :: list of strings
827 ** ~:footnote-definition-alist~
829 Alist between footnote labels and their definition, as parsed data.
830 Only non-inline footnotes are represented in this alist. Also,
831 every definition isn't guaranteed to be referenced in the parse
832 tree. The purpose of this property is to preserve definitions from
833 oblivion – i.e. when the parse tree comes from a part of the
834 original buffer –, it isn't meant for direct use in a back-end. To
835 retrieve a definition relative to a reference, use
836 [[#get-footnote-definition][~org-export-get-footnote-definition~]] instead.
839 - type :: alist (STRING . LIST)
841 ** ~:headline-levels~
843 :CUSTOM_ID: headline-levels
846 Maximum level being exported as an headline. Comparison is done
847 with the relative level of headlines in the parse tree, not
848 necessarily with their actual level.
853 ** ~:headline-numbering~
855 Alist between headlines' beginning position and their numbering, as
856 a list of numbers – cf. [[#get-headline-number][~org-export-get-headline-number~]].
859 - type :: alist (INTEGER . LIST)
861 ** ~:headline-offset~
863 Difference between relative and real level of headlines in the
864 parse tree. For example, a value of -1 means a level 2 headline
865 should be considered as level 1 —
866 cf. [[#get-relative-level][~org-export-get-relative-level~]].
873 List of elements and objects that will be unconditionally ignored
877 - type :: list of elements
881 Alist between ID strings and destination file's path, relative to
885 - type :: alist (STRING . STRING)
889 Full path to input file, if any.
892 - type :: string or nil
896 List of keywords attached to data.
903 Default language used for translations.
910 Whole parse tree, available at any time during transcoding.
913 - type :: list (as returned by ~org-element-parse-buffer~)
915 ** ~:preserve-breaks~
917 Non-nil means transcoding should preserve all line breaks.
920 - type :: symbol (nil, t)
922 ** ~:section-numbers~
924 Non-nil means transcoding should add section numbers to headlines.
927 - type :: symbol (nil, t)
931 :CUSTOM_ID: select-tags
934 List of tags enforcing inclusion of sub-trees in transcoding. When
935 such a tag is present, sub-trees without it are /de facto/ excluded
936 from the process. See [[#use-select-tags][~:use-select-tags~]].
939 - type :: list of strings
943 List of targets raw names encountered in the parse tree. This is
944 used to partly resolve "fuzzy" links —
945 cf. [[#resolve-fuzzy-link][~org-export-resolve-fuzzy-link~]].
948 - type :: list of strings
950 ** ~:time-stamp-file~
952 Non-nil means transcoding should insert a time stamp in the output.
955 - type :: symbol (nil, t)
957 ** ~:translate-alist~
959 Alist between element and object types and transcoding functions
960 relative to the current back-end. Special keys ~template~ and
961 ~plain-text~ are also possible.
964 - type :: alist (SYMBOL . FUNCTION)
966 ** ~:use-select-tags~
968 :CUSTOM_ID: use-select-tags
971 When non-nil, a select tags has been found in the parse tree.
972 Thus, any headline without one will be filtered out. See
973 [[#select-tags][~:select-tags~]].
976 - type :: interger or nil
978 ** ~:with-archived-trees~
980 Non-nil when archived sub-trees should also be transcoded. If it
981 is set to the ~headline~ symbol, only the archived headline's name
985 - type :: symbol (nil, t, ~headline~)
989 Non-nil means author's name should be included in the output.
992 - type :: symbol (nil, t)
996 Non-nil means clock keywords should be exported.
999 - type :: symbol (nil, t)
1003 Non-nil means a creation sentence should be inserted at the end of
1004 the transcoded string. If the value is ~comment~, it should be
1007 - category :: option
1008 - type :: symbol (~comment~, nil, t)
1012 Non nil means output should contain a date.
1014 - category :: option
1015 - type :: symbol (nil, t)
1019 Non-nil means drawers should be exported. If its value is a list
1020 of names, only drawers with such names will be transcoded.
1022 - category :: option
1023 - type :: symbol (nil, t) or list of strings
1027 Non-nil means output should contain author's email.
1029 - category :: option
1030 - type :: symbol (nil, t)
1032 ** ~:with-emphasize~
1034 Non-nil means emphasized text should be interpreted.
1036 - category :: option
1037 - type :: symbol (nil, t)
1039 ** ~:with-fixed-width~
1041 Non-nil if transcoder should interpret strings starting with
1042 a colon as a fixed-with — verbatim — area.
1044 - category :: option
1045 - type :: symbol (nil, t)
1047 ** ~:with-footnotes~
1049 Non-nil if transcoder should interpret footnotes.
1051 - category :: option
1052 - type :: symbol (nil, t)
1054 ** ~:with-plannings~
1056 Non-nil means transcoding should include planning info.
1058 - category :: option
1059 - type :: symbol (nil, t)
1063 Non-nil means transcoding should include priority cookies.
1065 - category :: option
1066 - type :: symbol (nil, t)
1068 ** ~:with-smart-quotes~
1070 Non-nil means activate smart quotes during export.
1072 - category :: option
1073 - type :: symbol (nil ,t)
1075 ** ~:with-special-strings~
1077 Non-nil means transcoding should interpret special strings in plain
1080 - category :: option
1081 - type :: symbol (nil, t)
1083 ** ~:with-sub-superscript~
1085 Non-nil means transcoding should interpret subscript and
1086 superscript. With a value of ~{}~, only interpret those using
1089 - category :: option
1090 - type :: symbol (nil, ~{}~, t)
1094 Non-nil means transcoding should interpret tables.
1096 - category :: option
1097 - type :: symbol (nil, t)
1101 Non-nil means transcoding should keep tags in headlines.
1102 A ~not-in-toc~ value will remove them from the table of contents,
1103 if any, nonetheless.
1105 - category :: option
1106 - type :: symbol (nil, t, ~not-in-toc~)
1110 Non-nil means transcoding should include headlines with a TODO
1111 keyword. A ~todo~ value will only include headlines with a TODO
1112 type keyword while a ~done~ value will do the contrary. If a list
1113 of strings is provided, only tasks with keywords belonging to that
1116 - category :: option
1117 - type :: symbol (t, ~todo~, ~done~, nil) or list of strings
1119 ** ~:with-timestamps~
1121 Non-nil means transcoding should include time stamps. Special
1122 value ~active~ (resp. ~inactive~) ask to export only active
1123 (resp. inactive) timestamps. Otherwise, completely remove them.
1125 - category :: option
1126 - type :: symbol: (~active~, ~inactive~, t, nil)
1130 Non-nil means that a table of contents has to be added to the
1131 output. An integer value limits its depth.
1133 - category :: option
1134 - type :: symbol (nil, t or integer)
1136 ** ~:with-todo-keywords~
1138 Non-nil means transcoding should include TODO keywords.
1140 - category :: option
1141 - type :: symbol (nil, t)
1145 :CUSTOM_ID: filter-system
1148 Filters sets are lists of functions. They allow to pre-process
1149 parse tree before export and to post-process output of each
1150 transcoded object or element.
1152 Each function in a set must accept three arguments: a string (or
1153 a parse tree as a special case), a symbol representing the current
1154 back-end, and the communication channel, as a plist.
1156 From the developer side, filters sets can be installed using
1157 ~:filters-alist~ keyword while defining the back-end with
1158 ~org-export-define-derived-backend~. Each association has a key
1159 among the following symbols and a function or a list of functions as
1162 - ~:filter-babel-call~
1164 - ~:filter-center-block~
1168 - ~:filter-comment-block~
1170 - ~:filter-dynamic-block~
1172 - ~:filter-example-block~
1173 - ~:filter-export-block~
1174 - ~:filter-export-snippet~
1175 - ~:filter-final-output~
1176 - ~:filter-fixed-width~
1177 - ~:filter-footnote-definition~
1178 - ~:filter-footnote-reference~
1179 - ~:filter-headline~
1180 - ~:filter-horizontal-rule~
1181 - ~:filter-inline-babel-call~
1182 - ~:filter-inline-src-block~
1183 - ~:filter-inlinetask~
1187 - ~:filter-latex-environment~
1188 - ~:filter-latex-fragment~
1189 - ~:filter-line-break~
1192 - ~:filter-paragraph~
1193 - ~:filter-parse-tree~
1194 - ~:filter-plain-list~
1195 - ~:filter-plain-text~
1196 - ~:filter-planning~
1197 - ~:filter-property-drawer~
1198 - ~:filter-quote-block~
1199 - ~:filter-quote-section~
1200 - ~:filter-radio-target~
1202 - ~:filter-special-block~
1203 - ~:filter-src-block~
1204 - ~:filter-strike-through~
1205 - ~:filter-statistics-cookie~
1206 - ~:filter-subscript~
1207 - ~:filter-superscript~
1209 - ~:filter-table-cell~
1210 - ~:filter-table-row~
1212 - ~:filter-timestamp~
1213 - ~:filter-underline~
1214 - ~:filter-verbatim~
1215 - ~:filter-verse-block~
1218 For example, =e-ascii= back-end implements a filter that makes sure
1219 headlines end with two blank lines:
1221 #+BEGIN_SRC emacs-lisp
1222 (org-export-define-backend e-ascii
1224 :filters-alist ((:filter-headline . org-e-ascii-filter-headline-blank-lines)
1225 (:filter-section . org-e-ascii-filter-headline-blank-lines)))
1227 (defun org-e-ascii-filter-section-blank-lines (headline back-end info)
1228 "Filter controlling number of blank lines after a section."
1229 (let ((blanks (make-string 2 ?\n)))
1230 (replace-regexp-in-string "\n\\(?:\n[ \t]*\\)*\\'" blanks headline)))
1238 A whole set of tools is available to help build new exporters. Any
1239 function general enough to have its use across a couple of back-ends
1242 Many of them are high-level access to properties from the
1243 communication channel. As such, they should be preferred to
1244 straight access to communication channel, when possible.
1246 ** ~org-element-adopt-element~
1248 :CUSTOM_ID: adopt-element
1251 Add an element to the contents of another element.
1253 See also: [[#set-element][~org-element-set-element~]]
1255 ** ~org-element-set-element~
1257 :CUSTOM_ID: set-element
1260 Replace an element with another in the parse tree.
1262 See also: [[#adopt-element][~org-element-adopt-element~]].
1264 ** ~org-export-activate-smart-quotes~
1266 :CUSTOM_ID: activate-smart-quotes
1269 Transform quotes and apostrophes into their "smart" counterpart in
1272 It should be used after a check against ~:with-smart-quotes~ value
1273 in communication channel.
1275 Since this function needs the original string, it may be useful to
1276 apply others transformations (i.e. characters protection) on a copy
1277 of that string and provide the pristine original string as the
1280 For example, in ~e-html~ back-end, it is necessary to protect "<",
1281 ">" and "&" characters before calling this function. Here's an
1282 excerpt of its ~plain-text~ transcoder:
1284 #+BEGIN_SRC emacs-lisp
1285 (let ((output text))
1286 ;; Protect following characters: <, >, &.
1287 (setq output (org-e-html-encode-plain-text output))
1288 ;; Handle smart quotes. Be sure to provide original string since
1289 ;; OUTPUT may have been modified.
1290 (when (plist-get info :with-smart-quotes)
1291 (setq output (org-export-activate-smart-quotes output :html info text)))
1297 ** ~org-export-collect-figures~
1299 :CUSTOM_ID: collect-figures
1302 Return a list of all exportable figures in parse tree.
1304 Used to build a table of figures.
1306 See also: [[#collect-headlines][~org-export-collect-headlines~]],
1307 [[#collect-tables][~org-export-collect-tables~]], [[#collect-listings][~org-export-collect-listings~]].
1309 ** ~org-export-collect-footnote-definitions~
1311 :CUSTOM_ID: collect-footnote-definitions
1314 List actually used footnotes definitions in order to add footnote
1315 listings throughout the transcoded data.
1317 Feed it with the whole parse tree to get the full footnote listing.
1318 Feed it with the current headline to get partial footnote listing
1319 relative to that headline.
1321 Number, label, if any, and definition are provided.
1323 See also: [[#footnote-first-reference-p][~org-export-footnote-first-reference-p~]],
1324 [[#get-footnote-definition][~org-export-get-footnote-definition~]],
1325 [[#get-footnote-number][~org-export-get-footnote-number~]].
1327 ** ~org-export-collect-headlines~
1329 :CUSTOM_ID: collect-headlines
1332 Return a list of all exportable headlines, possibly limited to
1335 Used to build a table of contents.
1337 See also: [[#collect-tables][~org-export-collect-tables~]],
1338 [[#collect-figures][~org-export-collect-figures~]], [[#collect-listings][~org-export-collect-listings~]].
1340 ** ~org-export-collect-listings~
1342 :CUSTOM_ID: collect-listings
1345 Return a list of all exportable source blocks with a caption or
1346 a name in parse tree.
1348 Used to build a table of listings.
1350 See also: [[#collect-headlines][~org-export-collect-headlines~]],
1351 [[#collect-tables][~org-export-collect-tables~]], [[#collect-figures][~org-export-collect-figures~]].
1352 ** ~org-export-collect-tables~
1354 :CUSTOM_ID: collect-tables
1357 Return a list of all exportable tables with a caption or a name in
1360 Used to build a table of tables.
1362 See also: [[#collect-headlines][~org-export-collect-headlines~]],
1363 [[#collect-figures][~org-export-collect-figures~]], [[#collect-listings][~org-export-collect-listings~]].
1365 ** ~org-export-data~
1370 Transcode a given element, object, secondary string or string using
1373 It is used primarily to transcode secondary strings, like ~:title~.
1374 For example =e-beamer= back-end uses the following:
1376 #+BEGIN_SRC emacs-lisp
1377 (defun org-e-beamer-template (contents info)
1378 (let ((title (org-export-data (plist-get info :title) info)))
1382 ** ~org-export-first-sibling-p~
1384 :CUSTOM_ID: first-sibling-p
1387 Non-nil if an headline is the first of its siblings.
1389 Used to know when to start a list if headline's relative level is
1390 below the one specified in [[#headline-levels][~:headline-levels~]] property.
1392 See also: [[#get-relative-level][~org-export-get-relative-level~]],
1393 [[#number-to-roman][~org-export-number-to-roman~]], [[#last-sibling-p][~org-export-last-sibling-p~]].
1395 ** ~org-export-footnote-first-reference-p~
1397 :CUSTOM_ID: footnote-first-reference-p
1400 Non-nil when a footnote reference if the first reference relative
1403 Used when a back-end needs to attach the footnote definition only
1404 to the first occurrence of the corresponding label.
1406 See also: [[#collect-footnote-definitions][~org-export-collect-footnote-definitions~]],
1407 [[#get-footnote-definition][~org-export-get-footnote-definition~]],
1408 [[#get-footnote-number][~org-export-get-footnote-number~]].
1410 ** ~org-export-format-code-default~
1412 :CUSTOM_ID: format-code-default
1415 Return contents of a =src-block= or =example-block= element in
1416 a format suited for raw text or verbatim output. More
1417 specifically, it takes care of line numbering and labels
1418 integration depending of element's switches, but no formatting is
1419 otherwise applied to source code.
1421 See also: [[#format-code][~org-export-format-code~]], [[#unravel-code][~org-export-unravel-code~]].
1423 ** ~org-export-format-code~
1425 :CUSTOM_ID: format-code
1428 Helper function to format source code. It applies a given function
1429 on each line of the code, passing current line number and
1430 associated code reference label, if any, as arguments.
1432 See also: [[#format-code-default][~org-export-format-code-default~]], [[#get-loc][~org-export-get-loc~]],
1433 [[#unravel-code][~org-export-unravel-code~]].
1435 ** ~org-export-get-caption~
1437 :CUSTOM_ID: get-caption
1440 Return the caption of a given element, as a secondary string. With
1441 an optional argument, return the short caption instead.
1443 As an example, =e-ascii= back-end, when creating a list of
1444 listings, uses the following:
1446 #+BEGIN_SRC emacs-lisp
1447 (defun org-e-ascii--list-listings (keyword info)
1448 (let ((title (org-e-ascii--translate "List of Listings" info)))
1454 ;; Use short name in priority, if available.
1455 (let ((caption (or (org-export-get-caption src-block t)
1456 (org-export-get-caption src-block))))
1457 (org-export-data caption info)
1459 (org-export-collect-listings info) "\n"))))
1462 See also: [[#read-attribute][~org-export-read-attribute~]].
1464 ** ~org-export-get-category~
1466 :CUSTOM_ID: get-category
1469 Return category associated to a given element or object. Unlike to
1470 the ~:category~ property from headlines and inlinetasks, this
1471 function handles inheritance and ~CATEGORY~ keywords. Therefore,
1472 it should be the preferred way to retrieve a category during
1475 See also: [[#get-node-property][~org-export-get-node-property~]].
1477 ** ~org-export-get-coderef-format~
1479 :CUSTOM_ID: get-coderef-format
1482 Return an appropriate format string for code reference links.
1484 See also: [[#resolve-coderef][~org-export-resolve-coderef~]].
1486 ** ~org-export-get-footnote-definition~
1488 :CUSTOM_ID: get-footnote-definition
1491 Retrieve the footnote definition relative to a given footnote
1494 If the footnote definition in inline, it is returned as a secondary
1495 string. Otherwise, it is full Org data.
1497 See also: [[#collect-footnote-definitions][~org-export-collect-footnote-definitions~]],
1498 [[#footnote-first-reference-p][~org-export-footnote-first-reference-p~]],
1499 [[#get-footnote-number][~org-export-get-footnote-number~]].
1501 ** ~org-export-get-footnote-number~
1503 :CUSTOM_ID: get-footnote-number
1506 Return the ordinal attached to a footnote reference or definition.
1508 See also: [[#collect-footnote-definitions][~org-export-collect-footnote-definitions~]],
1509 [[#footnote-first-reference-p][~org-export-footnote-first-reference-p~]],
1510 [[#get-footnote-definition][~org-export-get-footnote-definition~]].
1512 ** ~org-export-get-genealogy~
1514 :CUSTOM_ID: get-genealogy
1517 Return flat list of current object or element's parents from
1518 closest to farthest, along with their contents.
1520 See also: [[#get-next-element][~org-export-get-next-element~]], [[#get-parent][~org-export-get-parent~]],
1521 [[#get-parent-headline][~org-export-get-parent-headline~]],
1522 [[#get-parent-paragraph][~org-export-get-parent-paragraph~]],
1523 [[#get-previous-element][~org-export-get-previous-element~]].
1525 ** ~org-export-get-headline-number~
1527 :CUSTOM_ID: get-headline-number
1530 Return the section number of an headline, as a list of integers.
1532 See also: [[#headline-numbered-p][~org-export-headline-numbered-p~]],
1533 [[#number-to-roman][~org-export-number-to-roman~]].
1535 ** ~org-export-get-loc~
1540 Return count of accumulated lines of code from previous
1541 line-numbered =example-block= and =src-block= elements, according
1542 to current element's switches.
1544 In other words, the first line of code in the current block is
1545 supposed to be numbered as the returned value plus one, assuming
1546 its ~:number-lines~ properties is non-nil.
1548 See also: [[#format-code][~org-export-format-code~]], [[#unravel-code][~org-export-unravel-code~]].
1550 ** ~org-export-get-next-element~
1552 :CUSTOM_ID: get-next-element
1555 Return element (resp. object or string) after an element
1556 (resp. object), or nil.
1558 See also: [[#get-genealogy][~org-export-get-genealogy~]], [[#get-parent][~org-export-get-parent~]],
1559 [[#get-parent-headline][~org-export-get-parent-headline~]],
1560 [[#get-parent-paragraph][~org-export-get-parent-paragraph~]],
1561 [[#get-previous-element][~org-export-get-previous-element~]].
1563 ** ~org-export-get-node-property~
1565 :CUSTOM_ID: get-node-property
1568 Return the node property associated to an element or object. If
1569 the element is an headline, this is equivalent to reading the
1570 property with ~org-element-property~.
1572 Though, this function can optionally handle inheritance.
1574 See also: [[#get-category][~org-export-get-category~]].
1576 ** ~org-export-get-ordinal~
1578 :CUSTOM_ID: get-ordinal
1581 Associate a sequence number to any object or element. It is meant
1582 to be used to build captions.
1584 Also, it could be applied on a fuzzy link's destination, since such
1585 links are expected to be replaced with the sequence number of their
1586 destination, provided they have no description.
1588 Taken from =e-ascii= back-end, the following example shows how
1589 fuzzy links could be handled :
1591 #+BEGIN_SRC emacs-lisp :exports code
1592 (let ((type (org-element-property :type link)))
1595 ;; Do not apply a special syntax on fuzzy links pointing to targets.
1596 ((string= type "fuzzy")
1597 (let ((destination (org-export-resolve-fuzzy-link link info)))
1598 ;; Ignore invisible "#+TARGET: path".
1599 (unless (eq (org-element-type destination) 'keyword)
1600 ;; If link has a description, use it.
1601 (if (org-string-nw-p desc) desc
1603 (let ((number (org-export-get-ordinal destination info)))
1605 (if (atom number) (number-to-string number)
1606 (mapconcat 'number-to-string number ".")))))))))
1610 See also : [[#resolve-fuzzy-link][~org-export-resolve-fuzzy-link~]]
1612 ** ~org-export-get-parent-element~
1614 :CUSTOM_ID: get-parent-paragraph
1617 Return the first element containing provided object, if any.
1618 Return nil otherwise.
1620 See also: [[#get-genealogy][~org-export-get-genealogy~]], [[#get-parent][~org-export-get-parent~]],
1621 [[#get-parent-headline][~org-export-get-parent-headline~]],
1622 [[#get-previous-element][~org-export-get-previous-element~]], [[#get-next-element][~org-export-get-next-element~]].
1624 ** ~org-export-get-parent-headline~
1626 :CUSTOM_ID: get-parent-headline
1629 Return the headline containing provided element or object, if any.
1630 Return nil otherwise.
1632 See also: [[#get-genealogy][~org-export-get-genealogy~]],
1633 [[#get-next-element][~org-export-get-next-element~]], [[#get-parent][~org-export-get-parent~]],
1634 [[#get-parent-paragraph][~org-export-get-parent-paragraph~]],
1635 [[#get-previous-element][~org-export-get-previous-element~]].
1637 ** ~org-export-get-parent~
1639 :CUSTOM_ID: get-parent
1642 Return closest element containing current element or object, if
1643 any. Return nil otherwise.
1645 See also: [[#get-genealogy][~org-export-get-genealogy~]],
1646 [[#get-next-element][~org-export-get-next-element~]], [[#get-parent-paragraph][~org-export-get-parent-paragraph~]],
1647 [[#get-parent-headline][~org-export-get-parent-headline~]],
1648 [[#get-previous-element][~org-export-get-previous-element~]].
1650 ** ~org-export-get-previous-element~
1652 :CUSTOM_ID: get-previous-element
1655 Return element (resp. object or string) before an element
1656 (resp. object), or nil.
1658 See also: [[#get-genealogy][~org-export-get-genealogy~]],
1659 [[#get-next-element][~org-export-get-next-element~]], [[#get-parent][~org-export-get-parent~]],
1660 [[#get-parent-headline][~org-export-get-parent-headline~]],
1661 [[#get-parent-paragraph][~org-export-get-parent-paragraph~]].
1663 ** ~org-export-get-relative-level~
1665 :CUSTOM_ID: get-relative-level
1668 Return headline level, relatively to the lower headline level in
1669 the parsed tree. It is meant to be used over ~:level~ headline's
1672 See also:[[#first-sibling-p][~org-export-first-sibling-p~]],
1673 [[#get-headline-number][~org-export-get-headline-number~]],[[#headline-numbered-p][~org-export-headline-numbered-p~]],
1674 [[#last-sibling-p][~org-export-last-sibling-p~]].
1676 ** ~org-export-get-table-cell-at~
1678 :CUSTOM_ID: get-table-cell-at
1681 Return exportable cell object at a given position, or nil. Hence,
1682 position ~(0 . 0)~ will always point to the first exportable cell
1685 See also: [[#table-cell-address][~org-export-table-cell-address~]],
1686 [[#table-dimensions][~org-export-table-dimensions~]].
1688 ** ~org-export-get-tags~
1690 :CUSTOM_ID: get-tags
1693 Return list of exportable tags attached to a given headline or
1694 inlinetask element. With an optional argument, tags are inherited
1695 from parent headlines and ~FILETAGS~ keywords.
1697 In particular, it removes select tags and exclude tags. The
1698 function also accepts an arbitrary list of tags for further
1701 For example, =e-latex= back-end uses the following snippet in the
1702 inlinetask transcode function.
1704 #+BEGIN_SRC emacs-lisp
1705 (let ((title (org-export-data (org-element-property :title inlinetask) info))
1706 (todo (and (plist-get info :with-todo-keywords)
1707 (let ((todo (org-element-property :todo-keyword inlinetask)))
1708 (and todo (org-export-data todo info)))))
1709 (todo-type (org-element-property :todo-type inlinetask))
1710 (tags (and (plist-get info :with-tags)
1711 (org-export-get-tags inlinetask info)))
1712 (priority (and (plist-get info :with-priority)
1713 (org-element-property :priority inlinetask))))
1717 ** ~org-export-headline-numbered-p~
1719 :CUSTOM_ID: headline-numbered-p
1722 Non nil when a given headline should be numbered.
1724 See also: [[#get-headline-number][~org-export-get-headline-number~]],
1725 [[#get-relative-level][~org-export-get-relative-level~]].
1727 ** ~org-export-inline-image-p~
1729 :CUSTOM_ID: inline-image-p
1732 Non-nil when the link provided should be considered as an inline
1733 image. Note that it always return nil when the link has
1736 It accepts an optional set of rules in order to tweak the
1737 definition of an inline image, which is, by default, any link
1738 targetting a local file whose extension is either "png", "jpeg",
1739 "jpg", "gif", "tiff", "tif", "xbm", "xpm", "pbm", "pgm" or "ppm".
1741 A set of rules consists in an alist whose key is a type of link, as
1742 a string, and whose value is a regexp matching link's path. As an
1743 example, =e-html= back-end uses the following rules:
1745 #+BEGIN_SRC emacs-lisp
1746 '(("file" . "\\.\\(jpeg\\|jpg\\|png\\|gif\\|svg\\)\\'")
1747 ("http" . "\\.\\(jpeg\\|jpg\\|png\\|gif\\|svg\\)\\'")
1748 ("https" . "\\.\\(jpeg\\|jpg\\|png\\|gif\\|svg\\)\\'"))
1751 See also: [[#solidify-link-text][~org-export-solidify-link-text~]],
1752 [[#get-coderef-format][~org-export-get-coderef-format~]], [[#resolve-fuzzy-link][~org-export-resolve-fuzzy-link~]].
1754 ** ~org-export-last-sibling-p~
1756 :CUSTOM_ID: last-sibling-p
1759 Non-nil if an headline is the last of its siblings.
1761 Used to know when to close a list if headline's relative level is
1762 below the one specified in [[#headline-levels][~:headline-levels~]] property.
1764 See also: [[#get-relative-level][~org-export-get-relative-level~]],
1765 [[#number-to-roman][~org-export-number-to-roman~]], [[#first-sibling-p][~org-export-first-sibling-p~]].
1767 ** ~org-export-number-to-roman~
1769 :CUSTOM_ID: number-to-roman
1772 Convert numbers to roman numbers. It can be used to provide roman
1773 numbering for headlines and numbered lists.
1775 See also: [[#get-headline-number][~org-export-get-headline-number~]].
1777 ** ~org-export-read-attribute~
1779 :CUSTOM_ID: read-attribute
1782 Read a property from a given element as a plist. It can be used to
1783 normalize affiliated keywords' syntax. For example, the following
1784 affiliated keywords:
1787 ,#+ATTR_HTML: :width 10 :height 5
1788 ,#+ATTR_HTML: :file "filename.ext"
1791 would be returned as:
1793 #+BEGIN_SRC emacs-lisp
1794 '(:width 10 :height 5 :file "filename.ext")
1797 See also: [[#get-caption][~org-export-get-caption~]].
1799 ** ~org-export-resolve-coderef~
1801 :CUSTOM_ID: resolve-coderef
1804 Search for a code reference within ~src-block~ and ~example-block~
1805 elements. Return corresponding --possibly accumulated-- line
1806 number, or reference itself, depending on container's switches.
1808 See also : [[#get-coderef-format][~org-export-get-coderef-format~]],
1809 [[#resolve-fuzzy-link][~org-export-resolve-fuzzy-link~]], [[#resolve-id-link][~org-export-resolve-id-link~]],
1810 [[#resolve-radio-link][~org-export-resolve-radio-link~]].
1812 ** ~org-export-resolve-fuzzy-link~
1814 :CUSTOM_ID: resolve-fuzzy-link
1817 Search destination of a fuzzy link — i.e. it has a ~fuzzy~ ~:type~
1818 attribute – within the parsed tree, and return that element,
1821 See also: [[#get-ordinal][~org-export-get-ordinal~]], [[#resolve-coderef][~org-export-resolve-coderef~]],
1822 [[#resolve-id-link][~org-export-resolve-id-link~]], [[#resolve-radio-link][~org-export-resolve-radio-link~]],
1823 [[#solidify-link-text][~org-export-solidify-link-text~]].
1825 ** ~org-export-resolve-id-link~
1827 :CUSTOM_ID: resolve-id-link
1830 Search headline targetted by an id link --- i.e. it has a ~id~ or
1831 ~custom-id~ ~:type~ attribute --- within the parse tree. Return
1832 the matching headline in the tree, the name of the external file,
1833 as a string, or nil.
1835 See also : [[#resolve-coderef][~org-export-resolve-coderef~]],
1836 [[#resolve-fuzzy-link][~org-export-resolve-fuzzy-link~]], [[#resolve-radio-link][~org-export-resolve-radio-link~]],
1837 [[#solidify-link-text][~org-export-solidify-link-text~]].
1839 ** ~org-export-resolve-radio-link~
1841 :CUSTOM_ID: resolve-radio-link
1844 Return first radio target object matching a radio link --- that is
1845 with a ~radio~ ~:type~ attribute --- in the parse tree, or nil.
1847 Typically, target's contents are exported through ~org-export-data~
1848 and used as link description, as in the following excerpt from
1851 #+BEGIN_SRC emacs-lisp
1852 (defun org-e-latex-link (link desc info)
1853 (let* ((type (org-element-property :type link))
1857 ((string= type "radio")
1858 (let ((destination (org-export-resolve-radio-link link info)))
1860 (format "\\hyperref[%s]{%s}"
1861 (org-export-solidify-link-text path)
1862 (org-export-data (org-element-contents destination) info)))))
1866 See also : [[#resolve-coderef][~org-export-resolve-coderef~]],
1867 [[#resolve-fuzzy-link][~org-export-resolve-fuzzy-link~]], [[#resolve-id-link][~org-export-resolve-id-link~]],
1868 [[#solidify-link-text][~org-export-solidify-link-text~]].
1870 ** ~org-export-solidify-link-text~
1872 :CUSTOM_ID: solidify-link-text
1875 Normalize a string, replacing most non-standard characters with
1878 Used to turn targets names into safer versions for links.
1880 See also: [[#inline-image-p][~org-export-inline-image-p~]],
1881 [[#resolve-id-link][~org-export-resolve-id-link~]], [[#resolve-fuzzy-link][~org-export-resolve-fuzzy-link~]],
1882 [[#resolve-radio-link][~org-export-resolve-radio-link~]].
1884 ** ~org-export-table-cell-address~
1886 :CUSTOM_ID: table-cell-address
1889 Return row and column of a given cell object. Positions are
1890 0-indexed and only exportable rows and columns are considered. The
1891 function returns nil if called on a non-exportable cell.
1893 See also: [[#get-table-cell-at][~org-export-get-table-cell-at~]],
1894 [[#table-dimensions][~org-export-table-dimensions~]].
1896 ** ~org-export-table-cell-alignment~
1898 :CUSTOM_ID: table-cell-alignment
1901 Return expected alignment for the contents of a given cell object.
1902 It can be either ~left~, ~right~ or ~center~.
1904 See also: [[#table-cell-borders][~org-export-table-cell-borders~]],
1905 [[#table-cell-width][~org-export-table-cell-width~]].
1907 ** ~org-export-table-cell-borders~
1909 :CUSTOM_ID: table-cell-borders
1912 Indicate expected borders for a given cell object. When non-nil,
1913 return value is a list of symbols among ~top~, ~bottom~, ~above~,
1914 ~below~, ~left~ and ~right~.
1916 Special values ~top~ and ~bottom~ only happen for cells in,
1917 respectively, the first and the last exportable rows.
1919 See also: [[#table-cell-alignment][~org-export-table-cell-alignment~]],
1920 [[#table-cell-width][~org-export-table-cell-width~]].
1922 ** ~org-export-table-cell-ends-colgroup-p~
1924 :CUSTOM_ID: table-cell-ends-colgroup-p
1927 Non-nil when a table cell object ends a column group.
1929 See also: [[#table-cell-starts-colgroup-p][~org-export-table-cell-starts-colgroup-p~]].
1931 ** ~org-export-table-cell-starts-colgroup-p~
1933 :CUSTOM_ID: table-cell-starts-colgroup-p
1936 Non-nil when a table cell object starts a column group.
1938 See also: [[#table-cell-ends-colgroup-p][~org-export-table-cell-ends-colgroup-p~]].
1940 ** ~org-export-table-cell-width~
1942 :CUSTOM_ID: table-cell-width
1945 Return expected width for contents of a given cell object.
1947 Only width specified explicitely through meta-data is considered.
1948 If no such information can be found, return nil instead.
1950 Some back-end may still need to know the actual width of exported
1951 cell's contents in order to compute column's width. In that case,
1952 every cell in the column must be transcoded in order to find the
1953 widest one. The snippet below, extracted from =org-e-ascii.el=
1954 illustrates a possible implementation.
1956 #+BEGIN_SRC emacs-lisp
1957 (or (org-export-table-cell-width table-cell info)
1958 (let* ((max-width 0)
1959 (table (org-export-get-parent-table table-cell info))
1960 (specialp (org-export-table-has-special-column-p table))
1961 (col (cdr (org-export-table-cell-address table-cell info))))
1965 ;; For each exportable row, get the cell at column COL and
1966 ;; transcode its contents. Then compare its length with
1967 ;; MAX-WIDTH and keep the greater of two.
1971 (org-element-contents
1972 (elt (if specialp (car (org-element-contents row))
1973 (org-element-contents row))
1981 See also: [[#table-cell-alignment][~org-export-table-cell-alignment~]],
1982 [[#table-cell-borders][~org-export-table-cell-borders~]].
1984 ** ~org-export-table-dimensions~
1986 :CUSTOM_ID: table-dimensions
1989 Return the number of exportable rows and columns in a given table.
1991 See also: [[#get-table-cell-at][~org-export-get-table-cell-at~]],
1992 [[#table-cell-address][~org-export-table-cell-address~]].
1994 ** ~org-export-table-has-header-p~
1996 :CUSTOM_ID: table-has-header-p
1999 Non-nil when table has at least two row groups.
2001 See also: [[#table-has-special-column-p][~org-export-table-has-special-column-p~]],
2002 [[#table-row-is-special-p][~org-export-table-row-is-special-p~]].
2004 ** ~org-export-table-has-special-column-p~
2006 :CUSTOM_ID: table-has-special-column-p
2009 Non-nil when first column in the table only contains meta-data.
2011 See also: [[#table-has-header-p][~org-export-table-has-header-p~]],
2012 [[#table-row-is-special-p][~org-export-table-row-is-special-p~]].
2014 ** ~org-export-table-row-ends-header-p~
2016 :CUSTOM_ID: table-row-ends-header-p
2019 Non-nil when a table row element ends table's header.
2021 See also: [[#table-row-ends-rowgroup-p][~org-export-table-row-ends-rowgroup-p~]],
2022 [[#table-row-group][~org-export-table-row-group~]],
2023 [[#table-row-starts-header-p][~org-export-table-row-starts-header-p~]],
2024 [[#table-row-starts-rowgroup-p][~org-export-table-row-starts-rowgroup-p~]].
2026 ** ~org-export-table-row-ends-rowgroup-p~
2028 :CUSTOM_ID: table-row-ends-rowgroup-p
2031 Non-nil when a a table row element ends a rowgroup, header
2034 See also: [[#table-cell-starts-ends-header-p][~org-export-table-row-ends-header-p~]],
2035 [[#table-row-group][~org-export-table-row-group~]],
2036 [[#table-row-starts-header-p][~org-export-table-row-starts-header-p~]],
2037 [[#table-row-starts-rowgroup-p][~org-export-table-row-starts-rowgroup-p~]].
2039 ** ~org-export-table-row-group~
2041 :CUSTOM_ID: table-row-group
2044 Return row group number for a given table row element.
2046 See also: [[#table-cell-starts-ends-header-p][~org-export-table-row-ends-header-p~]],
2047 [[#table-row-ends-rowgroup-p][~org-export-table-row-ends-rowgroup-p~]],
2048 [[#table-row-starts-header-p][~org-export-table-row-starts-header-p~]],
2049 [[#table-row-starts-rowgroup-p][~org-export-table-row-starts-rowgroup-p~]].
2051 ** ~org-export-table-row-is-special-p~
2053 :CUSTOM_ID: table-row-is-special-p
2056 Non-nil a given table row element only contains meta-data.
2058 See also: [[#table-has-header-p][~org-export-table-has-header-p~]],
2059 [[#table-has-special-column-p][~org-export-table-has-special-column-p~]].
2061 ** ~org-export-table-row-starts-header-p~
2063 :CUSTOM_ID: table-row-starts-header-p
2066 Non-nil when a table row element starts table's header.
2068 See also: [[#table-cell-starts-ends-header-p][~org-export-table-row-ends-header-p~]],
2069 [[#table-row-ends-rowgroup-p][~org-export-table-row-ends-rowgroup-p~]],
2070 [[#table-row-group][~org-export-table-row-group~]],
2071 [[#table-row-starts-rowgroup-p][~org-export-table-row-starts-rowgroup-p~]].
2073 ** ~org-export-table-row-starts-rowgroup-p~
2075 :CUSTOM_ID: table-row-starts-rowgroup-p
2078 Non-nil when a table row element starts a rowgroup, header
2081 See also: [[#table-cell-starts-ends-header-p][~org-export-table-row-ends-header-p~]],
2082 [[#table-row-ends-rowgroup-p][~org-export-table-row-ends-rowgroup-p~]],
2083 [[#table-row-group][~org-export-table-row-group~]],
2084 [[#table-row-starts-header-p][~org-export-table-row-starts-header-p~]].
2086 ** ~org-export-translate~
2088 Translate a string, i.e. "Table of Contents", according to language
2091 Refer to ~org-export-dictionary~ variable for the list of all
2094 ** ~org-export-unravel-code~
2096 :CUSTOM_ID: unravel-code
2099 Clean source code from an =example-block= or a =src-block= element
2100 and extract code references out of it.
2102 Its purpose is to allow to transform raw source code first and then
2103 integrate line numbers or references back into the final output.
2104 That final task can be achieved with the help of
2105 ~org-export-format-code~ function.
2107 See also: [[#format-code][~org-export-format-code~]],
2108 [[#format-code-default][~org-export-format-code-default~]], [[#get-loc][~org-export-get-loc~]].
2110 ** ~org-export-with-backend~
2112 :CUSTOM_ID: with-backend
2115 Export an element or object using locally another back-end.
2117 In a derived back-end, it may be used as a fall-back function once
2118 all specific cases have been handled. Thus, =e-beamer= back-end,
2119 derived from =e-latex=, takes care of every internal link type and
2120 delagates everything else to its parent back-end:
2122 #+BEGIN_SRC emacs-lisp
2123 (let ((type (org-element-property :type link))
2124 (path (org-element-property :path link)))
2126 ;; Handle every internal link type, but be careful to ignore "id"
2127 ;; type links pointing to external files.
2128 ((equal type "radio") ...)
2129 ((and (member type '("custom-id" "fuzzy" "id"))
2130 (let ((destination (if (string= type "fuzzy")
2131 (org-export-resolve-fuzzy-link link info)
2132 (org-export-resolve-id-link link info))))
2133 (case (org-element-type destination)
2136 ;; Otherwise, use `e-latex' back-end.
2137 (t (org-export-with-backend 'e-latex link contents info))))
2140 * Interactive functions
2142 :CUSTOM_ID: interactive
2145 Once the back-end is complete, interactive functions have to be
2146 offered for the user to use it. Depending on the desired output,
2147 three functions are provided to help in this task, along with
2148 a wrapper function allowing to make export asynchronous.
2150 Hence, ~org-export-to-buffer~ may be used if the expected output is
2151 a temporary buffer whereas ~org-export-to-file~ will be used when
2152 exporting to a file. In the latter case,
2153 ~org-export-output-file-name~ can be useful to guess the name of the
2154 output file --- though, don't use it in an external process, since
2155 it will ask the user for a file name when guessing fails. At the
2156 lowest level, ~org-export-as~ returns the output as a string. It
2157 may be used in conjunction with ~org-export-async-start~ in order to
2158 export asynchronously to a temporary buffer, since buffer creation
2159 cannot happen in the external process.
2161 When exporting in background, the output is expected to be displayed
2162 in the Export Stack. The function ~org-export-add-to-stack~ helps
2165 While it is suggested to have a look at their respective docstring,
2166 the following examples illustrate how to combine all these
2169 1. Export to a temporary buffer:
2171 #+BEGIN_SRC emacs-lisp
2173 (defun org-e-latex-export-as-latex
2174 (&optional async subtreep visible-only body-only ext-plist)
2177 (org-export-async-start
2179 (with-current-buffer (get-buffer-create "*Org E-LATEX Export*")
2182 (goto-char (point-min))
2184 (org-export-add-to-stack (current-buffer) 'e-latex)))
2185 `(org-export-as 'e-latex ,subtreep ,visible-only ,body-only
2188 (org-export-to-buffer 'e-latex "*Org E-LATEX Export*"
2189 subtreep visible-only body-only ext-plist)))
2190 (with-current-buffer outbuf (LaTeX-mode))
2191 (when org-export-show-temporary-export-buffer
2192 (switch-to-buffer-other-window outbuf)))))
2195 2. Export to a file:
2197 #+BEGIN_SRC emacs-lisp
2199 (defun org-e-latex-export-to-latex
2200 (&optional async subtreep visible-only body-only ext-plist)
2202 (let ((outfile (org-export-output-file-name ".tex" subtreep)))
2204 (org-export-async-start
2205 (lambda (f) (org-export-add-to-stack f 'e-latex))
2208 'e-latex ,outfile ,subtreep ,visible-only ,body-only ',ext-plist)))
2210 'e-latex outfile subtreep visible-only body-only ext-plist))))
2213 It may also be interesting to provide a publishing function for the
2214 back-end. Such function must accept three arguments: a plist
2215 containing properties relative to the project being exported, the
2216 name of the current file being published and the publishing
2217 directory. It often is a simple wrapper around
2218 ~org-e-publish-org-to~ function defined in =org-e-publish.el=, as
2219 shown in the following example:
2221 #+BEGIN_SRC emacs-lisp
2222 (defun org-e-html-publish-to-html (plist filename pub-dir)
2223 (org-e-publish-org-to 'e-html filename ".html" plist pub-dir))
2228 # sentence-end-double-space: t