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 ~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 latex
76 :options-alist ((:date "DATE" nil "\\today" t)
77 (:date-format nil nil org-latex-date-timestamp-format)
78 (:latex-class "LATEX_CLASS" nil org-latex-default-class t)
79 (:latex-class-options "LATEX_CLASS_OPTIONS" nil nil t)
80 (:latex-header-extra "LATEX_HEADER" nil nil newline)
81 (:latex-hyperref-p nil "texht" org-latex-with-hyperref t)))
84 It is also possible, with ~:export-block~ keyword, to associate
85 given block names to the ~export-block~ type. Such blocks can
86 contain raw code that will be directly inserted in the output, as
87 long as the corresponding translator function says so.
89 In the following example, in the ~html~ back-end, =HTML= blocks are
90 export blocks. The associated translator function inserts their
91 contents as-is, and ignores any other export block.
93 #+BEGIN_SRC emacs-lisp
94 (org-export-define-backend html
96 (export-block . org-html-export-block)
100 (defun org-html-export-block (export-block contents info)
101 "Transcode a EXPORT-BLOCK element from Org to HTML.
102 CONTENTS is nil. INFO is a plist used as a communication
104 (when (string= (org-element-property :type export-block) "HTML")
105 (org-element-property :value export-block)))
108 Eventually ~org-export-define-backend~ allows to define back-ends
109 specific filters. Refer to [[#filter-system][The Filter System]] section for more
112 If the new back-end shares most properties with another one,
113 ~org-export-define-derived-backend~ macro can be used to simplify
114 the process. In the example below, we implement a new back-end
115 which behaves like ~latex~ excepted for headlines and the template.
117 #+BEGIN_SRC emacs-lisp
118 (org-export-define-derived-backend my-latex latex
119 :translate-alist ((headline . my-latex-headline-translator)
120 (template . my-latex-template)))
123 Back-ends defined with either function can be registered in the
124 export dispatcher using special keyword =:menu-entry=. See macros
125 docstrings for more information.
127 * Elements Attributes
129 :CUSTOM_ID: attributes
132 Element attributes are accessed with ~org-element-property~
133 function. Other accessors relative to elements are
134 ~org-element-type~ and ~org-element-contents~.
136 Each greater element, element and object has a fixed set of
137 properties attached to it. Among them, four are shared by all
138 types: ~:begin~ and ~:end~, which refer to the beginning and ending
139 buffer positions of the considered element or object, ~:post-blank~,
140 which holds the number of blank lines, or white spaces, at its end
141 and ~:parent~ which refers to the element or object containing it.
143 Greater elements, elements and objects containing objects will have
144 ~:contents-begin~ and ~:contents-end~ properties to delimit
145 contents. Greater elements and elements accepting affiliated
146 keywords will also have a ~:post-affiliated~ property, referring to
147 the buffer position after any affiliated keyword, when applicable.
149 In addition to these properties, each element can optionally get
150 some more from affiliated keywords, namely: ~:attr_ascii~,
151 ~:attr_docbook~, ~:attr_html~, ~:attr_latex~, ~:attr_odt~,
152 ~:caption~, ~:header~, ~:name~, ~:plot~, and ~:results~.
154 At the lowest level, a ~:parent~ property is also attached to any
155 string, as a text property.
157 Other properties, specific to each element or object, are listed
164 - ~:info~ :: Information about function being called, as returned
165 by ~ob-babel-lob-get-info~ (string).
170 No specific property.
176 - ~:hiddenp~ :: Non-nil if the block is hidden (boolean).
182 - ~:duration~ :: Clock duration for a closed clock, or nil (string
184 - ~:status~ :: Status of current clock (symbol: ~closed~ or
186 - ~:value~ :: Timestamp associated to clock keyword (timestamp
193 - ~:value~ :: Contents (string).
199 - ~:value~ :: Comments, with pound signs (string).
205 - ~:value~ :: Comments, without block's boundaries (string).
206 - ~:hiddenp~ :: Non-nil if block is hidden (boolean).
212 - ~:value~ :: Full Sexp (string).
218 - ~:drawer-name~ :: Drawer's name (string).
219 - ~:hiddenp~ :: Non-nil if the drawer is hidden (boolean).
221 /Note relative to export:/ The idea behind drawers is that they are
222 transparent export-wise. By default, they should return their
223 contents without additional decorations.
229 - ~:arguments~ :: Block's parameters (string).
230 - ~:block-name~ :: Block's name (string).
231 - ~:drawer-name~ :: Drawer's name (string).
232 - ~:hiddenp~ :: Non-nil if the block is hidden (boolean).
238 - ~:ascii~ :: Entity's ASCII representation (string).
239 - ~:html~ :: Entity's HTML representation (string).
240 - ~:latex~ :: Entity's LaTeX representation (string).
241 - ~:latex-math-p~ :: Non-nil if entity's LaTeX representation
242 should be in math mode (boolean).
243 - ~:latin1~ :: Entity's Latin-1 encoding representation (string).
244 - ~:name~ :: Entity's name, without backslash nor brackets
246 - ~:use-brackets-p~ :: Non-nil if entity is written with optional
247 brackets in original buffer (boolean).
248 - ~:utf-8~ :: Entity's UTF-8 encoding representation (string).
254 - ~:hiddenp~ :: Non-nil if block is hidden (boolean).
255 - ~:label-fmt~ :: Format string used to write labels in current
256 block, if different from
257 ~org-coderef-label-format~ (string or nil).
258 - ~:language~ :: Language of the code in the block, if specified
260 - ~:number-lines~ :: Non-nil if code lines should be numbered.
261 A ~new~ value starts numbering from 1 wheareas ~continued~
262 resume numbering from previous numbered block (symbol: ~new~,
264 - ~:options~ :: Block's options located on the block's opening line
266 - ~:parameters~ :: Optional header arguments (string or nil).
267 - ~:preserve-indent~ :: Non-nil when indentation within the block
268 mustn't be modified upon export (boolean).
269 - ~:retain-labels~ :: Non-nil if labels should be kept visible upon
271 - ~:switches~ :: Optional switches for code block export (string or
273 - ~:use-labels~ :: Non-nil if links to labels contained in the
274 block should display the label instead of the
275 line number (boolean).
276 - ~:value~ :: Contents (string).
282 - ~:hiddenp~ :: Non-nil if block is hidden (boolean).
283 - ~:type~ :: Related back-end's name (string).
284 - ~:value~ :: Contents (string).
290 - ~:back-end~ :: Relative back-end's name (string).
291 - ~:value~ :: Export code (string).
297 - ~:value~ :: Contents, with colons (string).
299 ** Footnote Definition
303 - ~:label~ :: Label used for references (string).
305 ** Footnote Reference
309 - ~:inline-definition~ :: Footnote's definition, when inlined
310 (secondary string or nil).
311 - ~:label~ :: Footnote's label, if any (string or nil).
312 - ~:raw-definition~ :: Uninterpreted footnote's definition, when
313 inlined (string or nil).
314 - ~:type~ :: Determine whether reference has its definition inline,
315 or not (symbol: ~inline~, ~standard~).
321 In addition to the following list, any property specified in
322 a property drawer attached to the headline will be accessible as an
323 attribute (with underscores replaced with hyphens and a lowercase
324 name, i.e. ~:custom-id~).
326 - ~:archivedp~ :: Non-nil if the headline has an archive tag
328 - ~:closed~ :: Headline's CLOSED reference, if any (timestamp
330 - ~:commentedp~ :: Non-nil if the headline has a comment keyword
332 - ~:deadline~ :: Headline's DEADLINE reference, if any (timestamp
334 - ~:footnote-section-p~ :: Non-nil if the headline is a footnote
336 - ~:hiddenp~ :: Non-nil if the headline is hidden (boolean).
337 - ~:level~ :: Reduced level of the headline (integer).
338 - ~:pre-blank~ :: Number of blank lines between the headline and
339 the first non-blank line of its contents
341 - ~:priority~ :: Headline's priority, as a character (integer).
342 - ~:quotedp~ :: Non-nil if the headline contains a quote keyword
344 - ~:raw-value~ :: Raw headline's text, without the stars and the
346 - ~:scheduled~ :: Headline's SCHEDULED reference, if any (timestamp
348 - ~:tags~ :: Headline's tags, if any, without the archive
349 tag. (list of strings).
350 - ~:title~ :: Parsed headline's text, without the stars and the
351 tags (secondary string).
352 - ~:todo-keyword~ :: Headline's TODO keyword without quote and
353 comment strings, if any (string or nil).
354 - ~:todo-type~ :: Type of headline's TODO keyword, if any (symbol:
361 No specific property.
367 - ~:info~ :: Information about function called, as returned by
368 ~org-babel-lob-get-info~ (list).
370 /Note relative to export:/ Since Babel related blocks are expanded
371 before parsing, these can safely be ignored by back-ends.
377 - ~:language~ :: Language of the code in the block (string).
378 - ~:parameters~ :: Optional header arguments (string or nil).
379 - ~:value~ :: Source code (string).
385 In addition to the following list, any property specified in
386 a property drawer attached to the headline will be accessible as an
387 attribute (with underscores replaced with hyphens and a lowercase
388 name, i.e. ~:custom-id~).
390 - ~:closed~ :: Inlinetask's CLOSED reference, if any (timestamp
392 - ~:deadline~ :: Inlinetask's DEADLINE reference, if any (timestamp
394 - ~:hiddenp~ :: Non-nil if the headline is hidden (boolean).
395 - ~:level~ :: Reduced level of the inlinetask (integer).
396 - ~:priority~ :: Headline's priority, as a character (integer).
397 - ~:raw-value~ :: Raw inlinetask's text, without the stars and the
399 - ~:scheduled~ :: Inlinetask's SCHEDULED reference, if any
400 (timestamp object or nil).
401 - ~:tags~ :: Inlinetask's tags, if any (list of strings).
402 - ~:title~ :: Parsed inlinetask's text, without the stars and the
403 tags (secondary string).
404 - ~:todo-keyword~ :: Inlinetask's TODO keyword, if any (string or
406 - ~:todo-type~ :: Type of inlinetask's TODO keyword, if any
407 (symbol: ~done~, ~todo~).
413 No specific property.
419 - ~:bullet~ :: Item's bullet (string).
420 - ~:checkbox~ :: Item's check-box, if any (symbol: ~on~, ~off~,
422 - ~:counter~ :: Item's counter, if any. Literal counters become
424 - ~:raw-tag~ :: Uninterpreted item's tag, if any (string or nil).
425 - ~:tag~ :: Parsed item's tag, if any (secondary string or nil).
426 - ~:hiddenp~ :: Non-nil if item is hidden (boolean).
427 - ~:structure~ :: Full list's structure, as returned by
428 ~org-list-struct~ (alist).
434 - ~:key~ :: Keyword's name (string).
435 - ~:value~ :: Keyword's value (string).
437 /Note relative to export:/ Each back-end should, as far as
438 possible, support a number of common keywords. These include:
440 - Back-end relative keyword (i.e. "LATEX" for =e-latex=), which
441 should always return its value as-is.
443 - "TARGET" keyword, which should always return a nil value.
445 - "TOC" keyword. It accepts four common values: "headlines",
446 "tables", "figures", "listings". Also, "headlines" value can
447 have an optional numeric argument to specify depth of the
450 See [[#collect-headlines][~org-export-collect-headlines~]], [[#collect-tables][~org-export-collect-tables~]],
451 [[#collect-figures][~org-export-collect-figures~]] and [[#collect-listings][~org-export-collect-listings~]].
459 - ~:begin~ :: Buffer position at first affiliated keyword or at the
460 beginning of the first line of environment (integer).
461 - ~:end~ :: Buffer position at the first non-blank line after last
462 line of the environment, or buffer's end (integer).
463 - ~:post-blank~ :: Number of blank lines between last environment's
464 line and next non-blank line or buffer's end
466 - ~:value~ :: LaTeX code (string).
472 - ~:value~ :: LaTeX code (string).
478 No specific property.
484 - ~:application~ :: Name of application requested to open the link
485 in Emacs (string or nil). It only applies to
487 - ~:path~ :: Identifier for link's destination. It is usually the
488 link part with type, if specified, removed (string).
489 - ~:raw-link~ :: Uninterpreted link part (string).
490 - ~:search-option~ :: Additional information for file location
491 (string or nil). It only applies to "file" type links.
492 - ~:type~ :: Link's type. Possible types (string) are:
493 - ~coderef~ :: Line in some source code,
494 - ~custom-id~ :: Specific headline's custom-id,
495 - ~file~ :: External file,
496 - ~fuzzy~ :: Target, target keyword, a named element or an
497 headline in the current parse tree,
498 - ~id~ :: Specific headline's id,
499 - ~radio~ :: Radio-target.
500 It can also be any ~org-link-types~ element.
503 /Notes relative to export:/
505 - A fuzzy link leading to a target keyword should be ignored during
506 export: it's an invisible target.
508 - A fuzzy link with no description should display the
509 cross-reference number of its target. This number can be:
511 - If link's destination is a target object within a footnote, it
512 will be footnote's number.
514 - If link's destination is a target object in a list, it will be
517 - If link leads to a named element, it will be the sequence number
518 of that element among named elements of the same type.
520 - Otherwise, it will be the number of the headline containing
523 See [[#get-ordinal][~org-export-get-ordinal~]] function.
529 - ~:args~ :: Arguments passed to the macro (list of strings).
530 - ~:key~ :: Macro's name (string).
531 - ~:value~ :: Replacement text (string).
533 /Note relative to export:/ Macro expansion takes place before
534 buffer parsing. As such, export back-ends don't have to handle:
535 they'll never see them.
539 Element containing objects.
541 No specific property.
547 - ~:structure~ :: Full list's structure, as returned by
548 ~org-list-struct~ (alist).
549 - ~:type~ :: List's type (symbol: ~descriptive~, ~ordered~,
556 - ~:closed~ :: Timestamp associated to closed keyword, if any
557 (timestamp object or nil).
558 - ~:deadline~ :: Timestamp associated to deadline keyword, if any
559 (timestamp object or nil).
560 - ~:scheduled~ :: Timestamp associated to scheduled keyword, if any
561 (timestamp object or nil).
567 - ~:hiddenp~ :: Non-nil if drawer is hidden (boolean).
568 - ~:properties~ :: Properties defined in the drawer (alist).
574 - ~:hiddenp~ :: Non-nil if block is hidden (boolean).
580 - ~:value~ :: Quoted text (string).
586 - ~:raw-value~ :: Uninterpreted contents (string).
592 No specific property.
598 - ~:hiddenp~ :: Non-nil if block is hidden (boolean).
599 - ~:type~ :: Block's name (string).
605 - ~:hiddenp~ :: Non-nil if block is hidden (boolean).
606 - ~:label-fmt~ :: Format string used to write labels in current
607 block, if different from
608 ~org-coderef-label-format~ (string or nil).
609 - ~:language~ :: Language of the code in the block, if specified
611 - ~:number-lines~ :: Non-nil if code lines should be numbered.
612 A ~new~ value starts numbering from 1 wheareas ~continued~
613 resume numbering from previous numbered block (symbol: ~new~,
615 - ~:parameters~ :: Optional header arguments (string or nil).
616 - ~:preserve-indent~ :: Non-nil when indentation within the block
617 mustn't be modified upon export (boolean).
618 - ~:retain-labels~ :: Non-nil if labels should be kept visible upon
620 - ~:switches~ :: Optional switches for code block export (string or
622 - ~:use-labels~ :: Non-nil if links to labels contained in the
623 block should display the label instead of the
624 line number (boolean).
625 - ~:value~ :: Source code (string).
631 - ~:value~ :: Full cookie (string).
637 No specific property.
643 - ~:use-brackets-p~ :: Non-nil if contents are enclosed in curly
650 - ~:use-brackets-p~ :: Non-nil if contents are enclosed in curly
657 - ~:tblfm~ :: Formulas associated to the table, if any (string or
659 - ~:type~ :: Table's origin (symbol: ~table.el~, ~org~).
660 - ~:value~ :: Raw ~table.el~ table or nil (string or nil).
666 No specific property.
670 Element containing objects.
672 - ~:type~ :: Row's type (symbol: ~standard~, ~rule~).
678 - ~:value~ :: Target's ID (string).
681 Notes relatives to export:
683 - Target should become an anchor, if back-end permits it.
684 - Target's ID shouldn't be visible on export.
690 - ~:day-end~ :: Day part from timestamp end. If no ending date is
691 defined, it defaults to start day part (integer).
692 - ~:day-start~ :: Day part from timestamp start (integer).
693 - ~:hour-start~ :: Hour part from timestamp end. If no ending date
694 is defined, it defaults to start hour part, if
695 any (integer or nil).
696 - ~:hour-start~ :: Hour part from timestamp start, if specified
698 - ~:minute-start~ :: Minute part from timestamp end. If no ending
699 date is defined, it defaults to start minute part, if any
701 - ~:minute-start~ :: Minute part from timestamp start, if specified
703 - ~:month-end~ :: Month part from timestamp end. If no ending date
704 is defined, it defaults to start month part
706 - ~:month-start~ :: Month part from timestamp start (integer).
707 - ~:raw-value~ :: Raw timestamp (string).
708 - ~:repeater-type~ :: Type of repeater, if any (symbol: ~catch-up~,
709 ~restart~, ~cumulate~ or nil)
710 - ~:repeater-unit~ :: Unit of shift, if a repeater is defined
711 (symbol: ~year~, ~month~, ~week~, ~day~, ~hour~ or nil).
712 - ~:repeater-value~ :: Value of shift, if a repeater is defined
714 - ~:type~ :: Type of timestamp (symbol: ~active~, ~active-range~,
715 ~diary~, ~inactive~, ~inactive-range~).
716 - ~:year-end~ :: Year part from timestamp end. If no ending date
717 is defined, it defaults to start year part
719 - ~:year-start~ :: Year part from timestamp start (integer).
721 Note relative to export: =org.el= provides tools to work on
722 timestamps objects. In particular, back-ends usually make use of
723 ~org-timestamp-translate~ function. Thus, in =ox-html.el=, the
724 timestamp object is first translated:
726 #+BEGIN_SRC emacs-lisp
727 (defun org-html-timestamp (timestamp contents info)
728 "Transcode a TIMESTAMP object from Org to HTML.
729 CONTENTS is nil. INFO is a plist holding contextual
731 (let ((value (org-html-plain-text
732 (org-timestamp-translate timestamp) info)))
733 (format "<span class=\"timestamp-wrapper\"><span class=\"timestamp\">%s</span></span>"
734 (replace-regexp-in-string "--" "–" value))))
741 No specific property.
747 - ~:value~ :: Contents (string).
751 Element containing objects.
753 - ~:hiddenp~ :: Non-nil if block is hidden (boolean).
755 * The Communication Channel
757 :CUSTOM_ID: communication
760 This is the full list of properties available during transcode
761 process, with their category (~option~ or ~tree~) and their value
773 Current back-end used for transcoding.
780 String to write as creation information.
787 String to use as date.
794 Description text for the current data.
808 Tags for exclusion of sub-trees from export process.
811 - type :: list of strings
815 Hash table used to memoize results from [[#data][~org-export-data~]].
822 List of global tags for buffer. Used by [[#get-tags][~org-export-get-tags~]] to
823 get tags with inheritance.
826 - type :: list of strings
828 ** ~:footnote-definition-alist~
830 Alist between footnote labels and their definition, as parsed data.
831 Only non-inline footnotes are represented in this alist. Also,
832 every definition isn't guaranteed to be referenced in the parse
833 tree. The purpose of this property is to preserve definitions from
834 oblivion – i.e. when the parse tree comes from a part of the
835 original buffer –, it isn't meant for direct use in a back-end. To
836 retrieve a definition relative to a reference, use
837 [[#get-footnote-definition][~org-export-get-footnote-definition~]] instead.
840 - type :: alist (STRING . LIST)
842 ** ~:headline-levels~
844 :CUSTOM_ID: headline-levels
847 Maximum level being exported as an headline. Comparison is done
848 with the relative level of headlines in the parse tree, not
849 necessarily with their actual level.
854 ** ~:headline-numbering~
856 Alist between headlines' beginning position and their numbering, as
857 a list of numbers – cf. [[#get-headline-number][~org-export-get-headline-number~]].
860 - type :: alist (INTEGER . LIST)
862 ** ~:headline-offset~
864 Difference between relative and real level of headlines in the
865 parse tree. For example, a value of -1 means a level 2 headline
866 should be considered as level 1 —
867 cf. [[#get-relative-level][~org-export-get-relative-level~]].
874 List of elements and objects that will be unconditionally ignored
878 - type :: list of elements
882 Alist between ID strings and destination file's path, relative to
886 - type :: alist (STRING . STRING)
890 Full path to input file, if any.
893 - type :: string or nil
897 List of keywords attached to data.
904 Default language used for translations.
911 Whole parse tree, available at any time during transcoding.
914 - type :: list (as returned by ~org-element-parse-buffer~)
916 ** ~:preserve-breaks~
918 Non-nil means transcoding should preserve all line breaks.
921 - type :: symbol (nil, t)
923 ** ~:section-numbers~
925 Non-nil means transcoding should add section numbers to headlines.
928 - type :: symbol (nil, t)
932 :CUSTOM_ID: select-tags
935 List of tags enforcing inclusion of sub-trees in transcoding. When
936 such a tag is present, sub-trees without it are /de facto/ excluded
937 from the process. See [[#use-select-tags][~:use-select-tags~]].
940 - type :: list of strings
942 ** ~:time-stamp-file~
944 Non-nil means transcoding should insert a time stamp in the output.
947 - type :: symbol (nil, t)
949 ** ~:translate-alist~
951 Alist between element and object types and transcoding functions
952 relative to the current back-end. Special keys ~template~ and
953 ~plain-text~ are also possible.
956 - type :: alist (SYMBOL . FUNCTION)
958 ** ~:use-select-tags~
960 :CUSTOM_ID: use-select-tags
963 When non-nil, a select tags has been found in the parse tree.
964 Thus, any headline without one will be filtered out. See
965 [[#select-tags][~:select-tags~]].
968 - type :: interger or nil
970 ** ~:with-archived-trees~
972 Non-nil when archived sub-trees should also be transcoded. If it
973 is set to the ~headline~ symbol, only the archived headline's name
977 - type :: symbol (nil, t, ~headline~)
981 Non-nil means author's name should be included in the output.
984 - type :: symbol (nil, t)
988 Non-nil means clock keywords should be exported.
991 - type :: symbol (nil, t)
995 Non-nil means a creation sentence should be inserted at the end of
996 the transcoded string. If the value is ~comment~, it should be
1000 - type :: symbol (~comment~, nil, t)
1004 Non nil means output should contain a date.
1006 - category :: option
1007 - type :: symbol (nil, t)
1011 Non-nil means drawers should be exported. If its value is a list
1012 of names, only drawers with such names will be transcoded.
1014 - category :: option
1015 - type :: symbol (nil, t) or list of strings
1019 Non-nil means output should contain author's email.
1021 - category :: option
1022 - type :: symbol (nil, t)
1024 ** ~:with-emphasize~
1026 Non-nil means emphasized text should be interpreted.
1028 - category :: option
1029 - type :: symbol (nil, t)
1031 ** ~:with-fixed-width~
1033 Non-nil if transcoder should interpret strings starting with
1034 a colon as a fixed-with — verbatim — area.
1036 - category :: option
1037 - type :: symbol (nil, t)
1039 ** ~:with-footnotes~
1041 Non-nil if transcoder should interpret footnotes.
1043 - category :: option
1044 - type :: symbol (nil, t)
1048 Non-nil means ~latex-environment~ elements and ~latex-fragment~
1049 objects should appear in export output. When this property is set
1050 to ~verbatim~, they will be left as-is.
1052 - category :: option
1053 - type :: symbol (~verbatim~, nil, t)
1055 ** ~:with-plannings~
1057 Non-nil means transcoding should include planning info.
1059 - category :: option
1060 - type :: symbol (nil, t)
1064 Non-nil means transcoding should include priority cookies.
1066 - category :: option
1067 - type :: symbol (nil, t)
1069 ** ~:with-smart-quotes~
1071 Non-nil means activate smart quotes during export.
1073 - category :: option
1074 - type :: symbol (nil ,t)
1076 ** ~:with-special-strings~
1078 Non-nil means transcoding should interpret special strings in plain
1081 - category :: option
1082 - type :: symbol (nil, t)
1084 ** ~:with-sub-superscript~
1086 Non-nil means transcoding should interpret subscript and
1087 superscript. With a value of ~{}~, only interpret those using
1090 - category :: option
1091 - type :: symbol (nil, ~{}~, t)
1095 Non-nil means transcoding should interpret tables.
1097 - category :: option
1098 - type :: symbol (nil, t)
1102 Non-nil means transcoding should keep tags in headlines.
1103 A ~not-in-toc~ value will remove them from the table of contents,
1104 if any, nonetheless.
1106 - category :: option
1107 - type :: symbol (nil, t, ~not-in-toc~)
1111 Non-nil means transcoding should include headlines with a TODO
1112 keyword. A ~todo~ value will only include headlines with a TODO
1113 type keyword while a ~done~ value will do the contrary. If a list
1114 of strings is provided, only tasks with keywords belonging to that
1117 - category :: option
1118 - type :: symbol (t, ~todo~, ~done~, nil) or list of strings
1120 ** ~:with-timestamps~
1122 Non-nil means transcoding should include time stamps. Special
1123 value ~active~ (resp. ~inactive~) ask to export only active
1124 (resp. inactive) timestamps. Otherwise, completely remove them.
1126 - category :: option
1127 - type :: symbol: (~active~, ~inactive~, t, nil)
1131 Non-nil means that a table of contents has to be added to the
1132 output. An integer value limits its depth.
1134 - category :: option
1135 - type :: symbol (nil, t or integer)
1137 ** ~:with-todo-keywords~
1139 Non-nil means transcoding should include TODO keywords.
1141 - category :: option
1142 - type :: symbol (nil, t)
1146 :CUSTOM_ID: filter-system
1149 Filters sets are lists of functions. They allow to pre-process
1150 parse tree before export and to post-process output of each
1151 transcoded object or element.
1153 Each function in a set must accept three arguments: a string (or
1154 a parse tree as a special case), a symbol representing the current
1155 back-end, and the communication channel, as a plist.
1157 As an exception, functions in options filter only accept two
1158 arguments: the property list containing the export options and the
1159 back-end, as a symbol.
1161 From the developer side, filters sets can be installed using
1162 ~:filters-alist~ keyword while defining the back-end with
1163 ~org-export-define-derived-backend~. Each association has a key
1164 among the following symbols and a function or a list of functions as
1167 - ~:filter-babel-call~
1169 - ~:filter-center-block~
1173 - ~:filter-comment-block~
1175 - ~:filter-dynamic-block~
1177 - ~:filter-example-block~
1178 - ~:filter-export-block~
1179 - ~:filter-export-snippet~
1180 - ~:filter-final-output~
1181 - ~:filter-fixed-width~
1182 - ~:filter-footnote-definition~
1183 - ~:filter-footnote-reference~
1184 - ~:filter-headline~
1185 - ~:filter-horizontal-rule~
1186 - ~:filter-inline-babel-call~
1187 - ~:filter-inline-src-block~
1188 - ~:filter-inlinetask~
1192 - ~:filter-latex-environment~
1193 - ~:filter-latex-fragment~
1194 - ~:filter-line-break~
1197 - ~:filter-node-property~
1199 - ~:filter-paragraph~
1200 - ~:filter-parse-tree~
1201 - ~:filter-plain-list~
1202 - ~:filter-plain-text~
1203 - ~:filter-planning~
1204 - ~:filter-property-drawer~
1205 - ~:filter-quote-block~
1206 - ~:filter-quote-section~
1207 - ~:filter-radio-target~
1209 - ~:filter-special-block~
1210 - ~:filter-src-block~
1211 - ~:filter-strike-through~
1212 - ~:filter-statistics-cookie~
1213 - ~:filter-subscript~
1214 - ~:filter-superscript~
1216 - ~:filter-table-cell~
1217 - ~:filter-table-row~
1219 - ~:filter-timestamp~
1220 - ~:filter-underline~
1221 - ~:filter-verbatim~
1222 - ~:filter-verse-block~
1225 For example, ~ascii~ back-end implements a filter that makes sure
1226 headlines end with two blank lines:
1228 #+BEGIN_SRC emacs-lisp
1229 (org-export-define-backend ascii
1231 :filters-alist ((:filter-headline . org-ascii-filter-headline-blank-lines)
1232 (:filter-section . org-ascii-filter-headline-blank-lines)))
1234 (defun org-ascii-filter-section-blank-lines (headline back-end info)
1235 "Filter controlling number of blank lines after a section."
1236 (let ((blanks (make-string 2 ?\n)))
1237 (replace-regexp-in-string "\n\\(?:\n[ \t]*\\)*\\'" blanks headline)))
1245 A whole set of tools is available to help build new exporters. Any
1246 function general enough to have its use across a couple of back-ends
1249 Many of them are high-level access to properties from the
1250 communication channel. As such, they should be preferred to
1251 straight access to communication channel, when possible.
1253 ** ~org-element-adopt-element~
1255 :CUSTOM_ID: adopt-element
1258 Add an element to the contents of another element.
1260 See also: [[#set-element][~org-element-set-element~]]
1262 ** ~org-element-set-element~
1264 :CUSTOM_ID: set-element
1267 Replace an element with another in the parse tree.
1269 See also: [[#adopt-element][~org-element-adopt-element~]].
1271 ** ~org-export-activate-smart-quotes~
1273 :CUSTOM_ID: activate-smart-quotes
1276 Transform quotes and apostrophes into their "smart" counterpart in
1279 It should be used after a check against ~:with-smart-quotes~ value
1280 in communication channel.
1282 Since this function needs the original string, it may be useful to
1283 apply others transformations (i.e. characters protection) on a copy
1284 of that string and provide the pristine original string as the
1287 For example, in ~html~ back-end, it is necessary to protect "<",
1288 ">" and "&" characters before calling this function. Here's an
1289 excerpt of its ~plain-text~ transcoder:
1291 #+BEGIN_SRC emacs-lisp
1292 (let ((output text))
1293 ;; Protect following characters: <, >, &.
1294 (setq output (org-html-encode-plain-text output))
1295 ;; Handle smart quotes. Be sure to provide original string since
1296 ;; OUTPUT may have been modified.
1297 (when (plist-get info :with-smart-quotes)
1298 (setq output (org-export-activate-smart-quotes output :html info text)))
1304 ** ~org-export-collect-figures~
1306 :CUSTOM_ID: collect-figures
1309 Return a list of all exportable figures in parse tree.
1311 Used to build a table of figures.
1313 See also: [[#collect-headlines][~org-export-collect-headlines~]],
1314 [[#collect-tables][~org-export-collect-tables~]], [[#collect-listings][~org-export-collect-listings~]].
1316 ** ~org-export-collect-footnote-definitions~
1318 :CUSTOM_ID: collect-footnote-definitions
1321 List actually used footnotes definitions in order to add footnote
1322 listings throughout the transcoded data.
1324 Feed it with the whole parse tree to get the full footnote listing.
1325 Feed it with the current headline to get partial footnote listing
1326 relative to that headline.
1328 Number, label, if any, and definition are provided.
1330 See also: [[#footnote-first-reference-p][~org-export-footnote-first-reference-p~]],
1331 [[#get-footnote-definition][~org-export-get-footnote-definition~]],
1332 [[#get-footnote-number][~org-export-get-footnote-number~]].
1334 ** ~org-export-collect-headlines~
1336 :CUSTOM_ID: collect-headlines
1339 Return a list of all exportable headlines, possibly limited to
1342 Used to build a table of contents.
1344 See also: [[#collect-tables][~org-export-collect-tables~]],
1345 [[#collect-figures][~org-export-collect-figures~]], [[#collect-listings][~org-export-collect-listings~]].
1347 ** ~org-export-collect-listings~
1349 :CUSTOM_ID: collect-listings
1352 Return a list of all exportable source blocks with a caption or
1353 a name in parse tree.
1355 Used to build a table of listings.
1357 See also: [[#collect-headlines][~org-export-collect-headlines~]],
1358 [[#collect-tables][~org-export-collect-tables~]], [[#collect-figures][~org-export-collect-figures~]].
1359 ** ~org-export-collect-tables~
1361 :CUSTOM_ID: collect-tables
1364 Return a list of all exportable tables with a caption or a name in
1367 Used to build a table of tables.
1369 See also: [[#collect-headlines][~org-export-collect-headlines~]],
1370 [[#collect-figures][~org-export-collect-figures~]], [[#collect-listings][~org-export-collect-listings~]].
1372 ** ~org-export-data~
1377 Transcode a given element, object, secondary string or string using
1380 It is used primarily to transcode secondary strings, like ~:title~.
1381 For example ~beamer~ back-end uses the following:
1383 #+BEGIN_SRC emacs-lisp
1384 (defun org-beamer-template (contents info)
1385 (let ((title (org-export-data (plist-get info :title) info)))
1389 ** ~org-export-data-with-backend~
1391 :CUSTOM_ID: data-with-backend
1394 Recursively convert some data (an element, an object, a secondary
1395 string or a string) using another backend.
1397 See also: [[#with-backend][~org-export-with-backend~]],
1398 [[#data-with-translations][~org-export-data-with-translations~]]
1400 ** ~org-export-data-with-translations~
1402 :CUSTOM_ID: data-with-translations
1405 Recursively convert some data (an element, an object, a secondary
1406 string or a string) using a given translation table, which
1407 basically acts as an anonymous back-end.
1409 See also: [[#with-backend][~org-export-with-backend~]],
1410 [[#data-with-backend][~org-export-data-with-backend~]]
1412 ** ~org-export-first-sibling-p~
1414 :CUSTOM_ID: first-sibling-p
1417 Non-nil if an headline is the first of its siblings.
1419 Used to know when to start a list if headline's relative level is
1420 below the one specified in [[#headline-levels][~:headline-levels~]] property.
1422 See also: [[#get-relative-level][~org-export-get-relative-level~]],
1423 [[#number-to-roman][~org-export-number-to-roman~]], [[#last-sibling-p][~org-export-last-sibling-p~]].
1425 ** ~org-export-footnote-first-reference-p~
1427 :CUSTOM_ID: footnote-first-reference-p
1430 Non-nil when a footnote reference if the first reference relative
1433 Used when a back-end needs to attach the footnote definition only
1434 to the first occurrence of the corresponding label.
1436 See also: [[#collect-footnote-definitions][~org-export-collect-footnote-definitions~]],
1437 [[#get-footnote-definition][~org-export-get-footnote-definition~]],
1438 [[#get-footnote-number][~org-export-get-footnote-number~]].
1440 ** ~org-export-format-code-default~
1442 :CUSTOM_ID: format-code-default
1445 Return contents of a =src-block= or =example-block= element in
1446 a format suited for raw text or verbatim output. More
1447 specifically, it takes care of line numbering and labels
1448 integration depending of element's switches, but no formatting is
1449 otherwise applied to source code.
1451 See also: [[#format-code][~org-export-format-code~]], [[#unravel-code][~org-export-unravel-code~]].
1453 ** ~org-export-format-code~
1455 :CUSTOM_ID: format-code
1458 Helper function to format source code. It applies a given function
1459 on each line of the code, passing current line number and
1460 associated code reference label, if any, as arguments.
1462 See also: [[#format-code-default][~org-export-format-code-default~]], [[#get-loc][~org-export-get-loc~]],
1463 [[#unravel-code][~org-export-unravel-code~]].
1465 ** ~org-export-get-caption~
1467 :CUSTOM_ID: get-caption
1470 Return the caption of a given element, as a secondary string. With
1471 an optional argument, return the short caption instead.
1473 As an example, ~ascii~ back-end, when creating a list of listings,
1476 #+BEGIN_SRC emacs-lisp
1477 (defun org-ascii--list-listings (keyword info)
1478 (let ((title (org-ascii--translate "List of Listings" info)))
1484 ;; Use short name in priority, if available.
1485 (let ((caption (or (org-export-get-caption src-block t)
1486 (org-export-get-caption src-block))))
1487 (org-export-data caption info)
1489 (org-export-collect-listings info) "\n"))))
1492 See also: [[#read-attribute][~org-export-read-attribute~]].
1494 ** ~org-export-get-category~
1496 :CUSTOM_ID: get-category
1499 Return category associated to a given element or object. Unlike to
1500 the ~:category~ property from headlines and inlinetasks, this
1501 function handles inheritance and ~CATEGORY~ keywords. Therefore,
1502 it should be the preferred way to retrieve a category during
1505 See also: [[#get-node-property][~org-export-get-node-property~]].
1507 ** ~org-export-get-coderef-format~
1509 :CUSTOM_ID: get-coderef-format
1512 Return an appropriate format string for code reference links.
1514 See also: [[#resolve-coderef][~org-export-resolve-coderef~]].
1516 ** ~org-export-get-footnote-definition~
1518 :CUSTOM_ID: get-footnote-definition
1521 Retrieve the footnote definition relative to a given footnote
1524 If the footnote definition in inline, it is returned as a secondary
1525 string. Otherwise, it is full Org data.
1527 See also: [[#collect-footnote-definitions][~org-export-collect-footnote-definitions~]],
1528 [[#footnote-first-reference-p][~org-export-footnote-first-reference-p~]],
1529 [[#get-footnote-number][~org-export-get-footnote-number~]].
1531 ** ~org-export-get-footnote-number~
1533 :CUSTOM_ID: get-footnote-number
1536 Return the ordinal attached to a footnote reference or definition.
1538 See also: [[#collect-footnote-definitions][~org-export-collect-footnote-definitions~]],
1539 [[#footnote-first-reference-p][~org-export-footnote-first-reference-p~]],
1540 [[#get-footnote-definition][~org-export-get-footnote-definition~]].
1542 ** ~org-export-get-genealogy~
1544 :CUSTOM_ID: get-genealogy
1547 Return flat list of current object or element's parents from
1548 closest to farthest, along with their contents.
1550 See also: [[#get-next-element][~org-export-get-next-element~]], [[#get-parent][~org-export-get-parent~]],
1551 [[#get-parent-headline][~org-export-get-parent-headline~]],
1552 [[#get-parent-paragraph][~org-export-get-parent-paragraph~]],
1553 [[#get-previous-element][~org-export-get-previous-element~]].
1555 ** ~org-export-get-headline-number~
1557 :CUSTOM_ID: get-headline-number
1560 Return the section number of an headline, as a list of integers.
1562 See also: [[#headline-numbered-p][~org-export-headline-numbered-p~]],
1563 [[#number-to-roman][~org-export-number-to-roman~]].
1565 ** ~org-export-get-loc~
1570 Return count of accumulated lines of code from previous
1571 line-numbered =example-block= and =src-block= elements, according
1572 to current element's switches.
1574 In other words, the first line of code in the current block is
1575 supposed to be numbered as the returned value plus one, assuming
1576 its ~:number-lines~ properties is non-nil.
1578 See also: [[#format-code][~org-export-format-code~]], [[#unravel-code][~org-export-unravel-code~]].
1580 ** ~org-export-get-next-element~
1582 :CUSTOM_ID: get-next-element
1585 Return element (resp. object or string) after an element
1586 (resp. object), or nil.
1588 See also: [[#get-genealogy][~org-export-get-genealogy~]], [[#get-parent][~org-export-get-parent~]],
1589 [[#get-parent-headline][~org-export-get-parent-headline~]],
1590 [[#get-parent-paragraph][~org-export-get-parent-paragraph~]],
1591 [[#get-previous-element][~org-export-get-previous-element~]].
1593 ** ~org-export-get-node-property~
1595 :CUSTOM_ID: get-node-property
1598 Return the node property associated to an element or object. If
1599 the element is an headline, this is equivalent to reading the
1600 property with ~org-element-property~.
1602 Though, this function can optionally handle inheritance.
1604 See also: [[#get-category][~org-export-get-category~]].
1606 ** ~org-export-get-ordinal~
1608 :CUSTOM_ID: get-ordinal
1611 Associate a sequence number to any object or element. It is meant
1612 to be used to build captions.
1614 Also, it could be applied on a fuzzy link's destination, since such
1615 links are expected to be replaced with the sequence number of their
1616 destination, provided they have no description.
1618 Taken from ~ascii~ back-end, the following example shows how fuzzy
1619 links could be handled :
1621 #+BEGIN_SRC emacs-lisp :exports code
1622 (let ((type (org-element-property :type link)))
1625 ;; Do not apply a special syntax on fuzzy links pointing to targets.
1626 ((string= type "fuzzy")
1627 (let ((destination (org-export-resolve-fuzzy-link link info)))
1628 ;; Ignore invisible "#+TARGET: path".
1629 (unless (eq (org-element-type destination) 'keyword)
1630 ;; If link has a description, use it.
1631 (if (org-string-nw-p desc) desc
1633 (let ((number (org-export-get-ordinal destination info)))
1635 (if (atom number) (number-to-string number)
1636 (mapconcat 'number-to-string number ".")))))))))
1640 See also : [[#resolve-fuzzy-link][~org-export-resolve-fuzzy-link~]]
1642 ** ~org-export-get-parent-element~
1644 :CUSTOM_ID: get-parent-paragraph
1647 Return the first element containing provided object, if any.
1648 Return nil otherwise.
1650 See also: [[#get-genealogy][~org-export-get-genealogy~]], [[#get-parent][~org-export-get-parent~]],
1651 [[#get-parent-headline][~org-export-get-parent-headline~]],
1652 [[#get-previous-element][~org-export-get-previous-element~]], [[#get-next-element][~org-export-get-next-element~]].
1654 ** ~org-export-get-parent-headline~
1656 :CUSTOM_ID: get-parent-headline
1659 Return the headline containing provided element or object, if any.
1660 Return nil otherwise.
1662 See also: [[#get-genealogy][~org-export-get-genealogy~]],
1663 [[#get-next-element][~org-export-get-next-element~]], [[#get-parent][~org-export-get-parent~]],
1664 [[#get-parent-paragraph][~org-export-get-parent-paragraph~]],
1665 [[#get-previous-element][~org-export-get-previous-element~]].
1667 ** ~org-export-get-parent~
1669 :CUSTOM_ID: get-parent
1672 Return closest element containing current element or object, if
1673 any. Return nil otherwise.
1675 See also: [[#get-genealogy][~org-export-get-genealogy~]],
1676 [[#get-next-element][~org-export-get-next-element~]], [[#get-parent-paragraph][~org-export-get-parent-paragraph~]],
1677 [[#get-parent-headline][~org-export-get-parent-headline~]],
1678 [[#get-previous-element][~org-export-get-previous-element~]].
1680 ** ~org-export-get-previous-element~
1682 :CUSTOM_ID: get-previous-element
1685 Return element (resp. object or string) before an element
1686 (resp. object), or nil.
1688 See also: [[#get-genealogy][~org-export-get-genealogy~]],
1689 [[#get-next-element][~org-export-get-next-element~]], [[#get-parent][~org-export-get-parent~]],
1690 [[#get-parent-headline][~org-export-get-parent-headline~]],
1691 [[#get-parent-paragraph][~org-export-get-parent-paragraph~]].
1693 ** ~org-export-get-relative-level~
1695 :CUSTOM_ID: get-relative-level
1698 Return headline level, relatively to the lower headline level in
1699 the parsed tree. It is meant to be used over ~:level~ headline's
1702 See also:[[#first-sibling-p][~org-export-first-sibling-p~]],
1703 [[#get-headline-number][~org-export-get-headline-number~]],[[#headline-numbered-p][~org-export-headline-numbered-p~]],
1704 [[#last-sibling-p][~org-export-last-sibling-p~]].
1706 ** ~org-export-get-table-cell-at~
1708 :CUSTOM_ID: get-table-cell-at
1711 Return exportable cell object at a given position, or nil. Hence,
1712 position ~(0 . 0)~ will always point to the first exportable cell
1715 See also: [[#table-cell-address][~org-export-table-cell-address~]],
1716 [[#table-dimensions][~org-export-table-dimensions~]].
1718 ** ~org-export-get-tags~
1720 :CUSTOM_ID: get-tags
1723 Return list of exportable tags attached to a given headline or
1724 inlinetask element. With an optional argument, tags are inherited
1725 from parent headlines and ~FILETAGS~ keywords.
1727 In particular, it removes select tags and exclude tags. The
1728 function also accepts an arbitrary list of tags for further
1731 For example, ~latex~ back-end uses the following snippet in the
1732 inlinetask transcode function.
1734 #+BEGIN_SRC emacs-lisp
1735 (let ((title (org-export-data (org-element-property :title inlinetask) info))
1736 (todo (and (plist-get info :with-todo-keywords)
1737 (let ((todo (org-element-property :todo-keyword inlinetask)))
1738 (and todo (org-export-data todo info)))))
1739 (todo-type (org-element-property :todo-type inlinetask))
1740 (tags (and (plist-get info :with-tags)
1741 (org-export-get-tags inlinetask info)))
1742 (priority (and (plist-get info :with-priority)
1743 (org-element-property :priority inlinetask))))
1747 ** ~org-export-headline-numbered-p~
1749 :CUSTOM_ID: headline-numbered-p
1752 Non nil when a given headline should be numbered.
1754 See also: [[#get-headline-number][~org-export-get-headline-number~]],
1755 [[#get-relative-level][~org-export-get-relative-level~]].
1757 ** ~org-export-inline-image-p~
1759 :CUSTOM_ID: inline-image-p
1762 Non-nil when the link provided should be considered as an inline
1763 image. Note that it always return nil when the link has
1766 It accepts an optional set of rules in order to tweak the
1767 definition of an inline image, which is, by default, any link
1768 targetting a local file whose extension is either "png", "jpeg",
1769 "jpg", "gif", "tiff", "tif", "xbm", "xpm", "pbm", "pgm" or "ppm".
1771 A set of rules consists in an alist whose key is a type of link, as
1772 a string, and whose value is a regexp matching link's path. As an
1773 example, ~html~ back-end uses the following rules:
1775 #+BEGIN_SRC emacs-lisp
1776 '(("file" . "\\.\\(jpeg\\|jpg\\|png\\|gif\\|svg\\)\\'")
1777 ("http" . "\\.\\(jpeg\\|jpg\\|png\\|gif\\|svg\\)\\'")
1778 ("https" . "\\.\\(jpeg\\|jpg\\|png\\|gif\\|svg\\)\\'"))
1781 See also: [[#solidify-link-text][~org-export-solidify-link-text~]],
1782 [[#get-coderef-format][~org-export-get-coderef-format~]], [[#resolve-fuzzy-link][~org-export-resolve-fuzzy-link~]].
1784 ** ~org-export-last-sibling-p~
1786 :CUSTOM_ID: last-sibling-p
1789 Non-nil if an headline is the last of its siblings.
1791 Used to know when to close a list if headline's relative level is
1792 below the one specified in [[#headline-levels][~:headline-levels~]] property.
1794 See also: [[#get-relative-level][~org-export-get-relative-level~]],
1795 [[#number-to-roman][~org-export-number-to-roman~]], [[#first-sibling-p][~org-export-first-sibling-p~]].
1797 ** ~org-export-number-to-roman~
1799 :CUSTOM_ID: number-to-roman
1802 Convert numbers to roman numbers. It can be used to provide roman
1803 numbering for headlines and numbered lists.
1805 See also: [[#get-headline-number][~org-export-get-headline-number~]].
1807 ** ~org-export-read-attribute~
1809 :CUSTOM_ID: read-attribute
1812 Read a property from a given element as a plist. It can be used to
1813 normalize affiliated keywords' syntax. For example, the following
1814 affiliated keywords:
1817 ,#+ATTR_HTML: :width 10 :height 5
1818 ,#+ATTR_HTML: :file "filename.ext"
1821 would be returned as:
1823 #+BEGIN_SRC emacs-lisp
1824 '(:width 10 :height 5 :file "filename.ext")
1827 See also: [[#get-caption][~org-export-get-caption~]].
1829 ** ~org-export-resolve-coderef~
1831 :CUSTOM_ID: resolve-coderef
1834 Search for a code reference within ~src-block~ and ~example-block~
1835 elements. Return corresponding --possibly accumulated-- line
1836 number, or reference itself, depending on container's switches.
1838 See also : [[#get-coderef-format][~org-export-get-coderef-format~]],
1839 [[#resolve-fuzzy-link][~org-export-resolve-fuzzy-link~]], [[#resolve-id-link][~org-export-resolve-id-link~]],
1840 [[#resolve-radio-link][~org-export-resolve-radio-link~]].
1842 ** ~org-export-resolve-fuzzy-link~
1844 :CUSTOM_ID: resolve-fuzzy-link
1847 Search destination of a fuzzy link — i.e. it has a ~fuzzy~ ~:type~
1848 attribute – within the parsed tree, and return that element,
1851 See also: [[#get-ordinal][~org-export-get-ordinal~]], [[#resolve-coderef][~org-export-resolve-coderef~]],
1852 [[#resolve-id-link][~org-export-resolve-id-link~]], [[#resolve-radio-link][~org-export-resolve-radio-link~]],
1853 [[#solidify-link-text][~org-export-solidify-link-text~]].
1855 ** ~org-export-resolve-id-link~
1857 :CUSTOM_ID: resolve-id-link
1860 Search headline targetted by an id link --- i.e. it has a ~id~ or
1861 ~custom-id~ ~:type~ attribute --- within the parse tree. Return
1862 the matching headline in the tree, the name of the external file,
1863 as a string, or nil.
1865 See also : [[#resolve-coderef][~org-export-resolve-coderef~]],
1866 [[#resolve-fuzzy-link][~org-export-resolve-fuzzy-link~]], [[#resolve-radio-link][~org-export-resolve-radio-link~]],
1867 [[#solidify-link-text][~org-export-solidify-link-text~]].
1869 ** ~org-export-resolve-radio-link~
1871 :CUSTOM_ID: resolve-radio-link
1874 Return first radio target object matching a radio link --- that is
1875 with a ~radio~ ~:type~ attribute --- in the parse tree, or nil.
1877 Typically, target's contents are exported through ~org-export-data~
1878 and used as link description, as in the following excerpt from
1881 #+BEGIN_SRC emacs-lisp
1882 (defun org-latex-link (link desc info)
1883 (let* ((type (org-element-property :type link))
1887 ((string= type "radio")
1888 (let ((destination (org-export-resolve-radio-link link info)))
1890 (format "\\hyperref[%s]{%s}"
1891 (org-export-solidify-link-text path)
1892 (org-export-data (org-element-contents destination) info)))))
1896 See also : [[#resolve-coderef][~org-export-resolve-coderef~]],
1897 [[#resolve-fuzzy-link][~org-export-resolve-fuzzy-link~]], [[#resolve-id-link][~org-export-resolve-id-link~]],
1898 [[#solidify-link-text][~org-export-solidify-link-text~]].
1900 ** ~org-export-solidify-link-text~
1902 :CUSTOM_ID: solidify-link-text
1905 Normalize a string, replacing most non-standard characters with
1908 Used to turn targets names into safer versions for links.
1910 See also: [[#inline-image-p][~org-export-inline-image-p~]],
1911 [[#resolve-id-link][~org-export-resolve-id-link~]], [[#resolve-fuzzy-link][~org-export-resolve-fuzzy-link~]],
1912 [[#resolve-radio-link][~org-export-resolve-radio-link~]].
1914 ** ~org-export-table-cell-address~
1916 :CUSTOM_ID: table-cell-address
1919 Return row and column of a given cell object. Positions are
1920 0-indexed and only exportable rows and columns are considered. The
1921 function returns nil if called on a non-exportable cell.
1923 See also: [[#get-table-cell-at][~org-export-get-table-cell-at~]],
1924 [[#table-dimensions][~org-export-table-dimensions~]].
1926 ** ~org-export-table-cell-alignment~
1928 :CUSTOM_ID: table-cell-alignment
1931 Return expected alignment for the contents of a given cell object.
1932 It can be either ~left~, ~right~ or ~center~.
1934 See also: [[#table-cell-borders][~org-export-table-cell-borders~]],
1935 [[#table-cell-width][~org-export-table-cell-width~]].
1937 ** ~org-export-table-cell-borders~
1939 :CUSTOM_ID: table-cell-borders
1942 Indicate expected borders for a given cell object. When non-nil,
1943 return value is a list of symbols among ~top~, ~bottom~, ~above~,
1944 ~below~, ~left~ and ~right~.
1946 Special values ~top~ and ~bottom~ only happen for cells in,
1947 respectively, the first and the last exportable rows.
1949 See also: [[#table-cell-alignment][~org-export-table-cell-alignment~]],
1950 [[#table-cell-width][~org-export-table-cell-width~]].
1952 ** ~org-export-table-cell-ends-colgroup-p~
1954 :CUSTOM_ID: table-cell-ends-colgroup-p
1957 Non-nil when a table cell object ends a column group.
1959 See also: [[#table-cell-starts-colgroup-p][~org-export-table-cell-starts-colgroup-p~]].
1961 ** ~org-export-table-cell-starts-colgroup-p~
1963 :CUSTOM_ID: table-cell-starts-colgroup-p
1966 Non-nil when a table cell object starts a column group.
1968 See also: [[#table-cell-ends-colgroup-p][~org-export-table-cell-ends-colgroup-p~]].
1970 ** ~org-export-table-cell-width~
1972 :CUSTOM_ID: table-cell-width
1975 Return expected width for contents of a given cell object.
1977 Only width specified explicitely through meta-data is considered.
1978 If no such information can be found, return nil instead.
1980 Some back-end may still need to know the actual width of exported
1981 cell's contents in order to compute column's width. In that case,
1982 every cell in the column must be transcoded in order to find the
1983 widest one. The snippet below, extracted from =ox-ascii.el=
1984 illustrates a possible implementation.
1986 #+BEGIN_SRC emacs-lisp
1987 (or (org-export-table-cell-width table-cell info)
1988 (let* ((max-width 0)
1989 (table (org-export-get-parent-table table-cell info))
1990 (specialp (org-export-table-has-special-column-p table))
1991 (col (cdr (org-export-table-cell-address table-cell info))))
1995 ;; For each exportable row, get the cell at column COL and
1996 ;; transcode its contents. Then compare its length with
1997 ;; MAX-WIDTH and keep the greater of two.
2001 (org-element-contents
2002 (elt (if specialp (car (org-element-contents row))
2003 (org-element-contents row))
2011 See also: [[#table-cell-alignment][~org-export-table-cell-alignment~]],
2012 [[#table-cell-borders][~org-export-table-cell-borders~]].
2014 ** ~org-export-table-dimensions~
2016 :CUSTOM_ID: table-dimensions
2019 Return the number of exportable rows and columns in a given table.
2021 See also: [[#get-table-cell-at][~org-export-get-table-cell-at~]],
2022 [[#table-cell-address][~org-export-table-cell-address~]].
2024 ** ~org-export-table-has-header-p~
2026 :CUSTOM_ID: table-has-header-p
2029 Non-nil when table has at least two row groups.
2031 See also: [[#table-has-special-column-p][~org-export-table-has-special-column-p~]],
2032 [[#table-row-is-special-p][~org-export-table-row-is-special-p~]].
2034 ** ~org-export-table-has-special-column-p~
2036 :CUSTOM_ID: table-has-special-column-p
2039 Non-nil when first column in the table only contains meta-data.
2041 See also: [[#table-has-header-p][~org-export-table-has-header-p~]],
2042 [[#table-row-is-special-p][~org-export-table-row-is-special-p~]].
2044 ** ~org-export-table-row-ends-header-p~
2046 :CUSTOM_ID: table-row-ends-header-p
2049 Non-nil when a table row element ends table's header.
2051 See also: [[#table-row-ends-rowgroup-p][~org-export-table-row-ends-rowgroup-p~]],
2052 [[#table-row-group][~org-export-table-row-group~]],
2053 [[#table-row-starts-header-p][~org-export-table-row-starts-header-p~]],
2054 [[#table-row-starts-rowgroup-p][~org-export-table-row-starts-rowgroup-p~]].
2056 ** ~org-export-table-row-ends-rowgroup-p~
2058 :CUSTOM_ID: table-row-ends-rowgroup-p
2061 Non-nil when a a table row element ends a rowgroup, header
2064 See also: [[#table-cell-starts-ends-header-p][~org-export-table-row-ends-header-p~]],
2065 [[#table-row-group][~org-export-table-row-group~]],
2066 [[#table-row-starts-header-p][~org-export-table-row-starts-header-p~]],
2067 [[#table-row-starts-rowgroup-p][~org-export-table-row-starts-rowgroup-p~]].
2069 ** ~org-export-table-row-group~
2071 :CUSTOM_ID: table-row-group
2074 Return row group number for a given table row element.
2076 See also: [[#table-cell-starts-ends-header-p][~org-export-table-row-ends-header-p~]],
2077 [[#table-row-ends-rowgroup-p][~org-export-table-row-ends-rowgroup-p~]],
2078 [[#table-row-starts-header-p][~org-export-table-row-starts-header-p~]],
2079 [[#table-row-starts-rowgroup-p][~org-export-table-row-starts-rowgroup-p~]].
2081 ** ~org-export-table-row-is-special-p~
2083 :CUSTOM_ID: table-row-is-special-p
2086 Non-nil a given table row element only contains meta-data.
2088 See also: [[#table-has-header-p][~org-export-table-has-header-p~]],
2089 [[#table-has-special-column-p][~org-export-table-has-special-column-p~]].
2091 ** ~org-export-table-row-starts-header-p~
2093 :CUSTOM_ID: table-row-starts-header-p
2096 Non-nil when a table row element starts table's header.
2098 See also: [[#table-cell-starts-ends-header-p][~org-export-table-row-ends-header-p~]],
2099 [[#table-row-ends-rowgroup-p][~org-export-table-row-ends-rowgroup-p~]],
2100 [[#table-row-group][~org-export-table-row-group~]],
2101 [[#table-row-starts-rowgroup-p][~org-export-table-row-starts-rowgroup-p~]].
2103 ** ~org-export-table-row-starts-rowgroup-p~
2105 :CUSTOM_ID: table-row-starts-rowgroup-p
2108 Non-nil when a table row element starts a rowgroup, header
2111 See also: [[#table-cell-starts-ends-header-p][~org-export-table-row-ends-header-p~]],
2112 [[#table-row-ends-rowgroup-p][~org-export-table-row-ends-rowgroup-p~]],
2113 [[#table-row-group][~org-export-table-row-group~]],
2114 [[#table-row-starts-header-p][~org-export-table-row-starts-header-p~]].
2116 ** ~org-export-translate~
2118 Translate a string, i.e. "Table of Contents", according to language
2121 Refer to ~org-export-dictionary~ variable for the list of all
2124 ** ~org-export-unravel-code~
2126 :CUSTOM_ID: unravel-code
2129 Clean source code from an =example-block= or a =src-block= element
2130 and extract code references out of it.
2132 Its purpose is to allow to transform raw source code first and then
2133 integrate line numbers or references back into the final output.
2134 That final task can be achieved with the help of
2135 ~org-export-format-code~ function.
2137 See also: [[#format-code][~org-export-format-code~]],
2138 [[#format-code-default][~org-export-format-code-default~]], [[#get-loc][~org-export-get-loc~]].
2140 ** ~org-export-with-backend~
2142 :CUSTOM_ID: with-backend
2145 Export an element or object using locally another back-end.
2147 In a derived back-end, it may be used as a fall-back function once
2148 all specific cases have been handled. Thus, ~beamer~ back-end,
2149 derived from ~latex~, takes care of every internal link type and
2150 delagates everything else to its parent back-end:
2152 #+BEGIN_SRC emacs-lisp
2153 (let ((type (org-element-property :type link))
2154 (path (org-element-property :path link)))
2156 ;; Handle every internal link type, but be careful to ignore "id"
2157 ;; type links pointing to external files.
2158 ((equal type "radio") ...)
2159 ((and (member type '("custom-id" "fuzzy" "id"))
2160 (let ((destination (if (string= type "fuzzy")
2161 (org-export-resolve-fuzzy-link link info)
2162 (org-export-resolve-id-link link info))))
2163 (case (org-element-type destination)
2166 ;; Otherwise, use `latex' back-end.
2167 (t (org-export-with-backend 'latex link contents info))))
2170 See also: [[#data-with-backend][~org-export-data-with-backend~]],
2171 [[#data-with-translations][~org-export-data-with-translations~]]
2173 * Interactive functions
2175 :CUSTOM_ID: interactive
2178 Once the back-end is complete, interactive functions have to be
2179 offered for the user to use it. Depending on the desired output,
2180 three functions are provided to help in this task, along with
2181 a wrapper function allowing to make export asynchronous.
2183 Hence, ~org-export-to-buffer~ may be used if the expected output is
2184 a temporary buffer whereas ~org-export-to-file~ will be used when
2185 exporting to a file. In the latter case,
2186 ~org-export-output-file-name~ can be useful to guess the name of the
2187 output file --- though, don't use it in an external process, since
2188 it will ask the user for a file name when guessing fails. At the
2189 lowest level, ~org-export-as~ returns the output as a string. It
2190 may be used in conjunction with ~org-export-async-start~ in order to
2191 export asynchronously to a temporary buffer, since buffer creation
2192 cannot happen in the external process.
2194 When exporting in background, the output is expected to be displayed
2195 in the Export Stack. The function ~org-export-add-to-stack~ helps
2198 While it is suggested to have a look at their respective docstring,
2199 the following examples illustrate how to combine all these
2202 1. Export to a temporary buffer:
2204 #+BEGIN_SRC emacs-lisp
2206 (defun org-latex-export-as-latex
2207 (&optional async subtreep visible-only body-only ext-plist)
2210 (org-export-async-start
2212 (with-current-buffer (get-buffer-create "*Org E-LATEX Export*")
2215 (goto-char (point-min))
2217 (org-export-add-to-stack (current-buffer) 'latex)))
2218 `(org-export-as 'latex ,subtreep ,visible-only ,body-only ',ext-plist))
2219 (let ((outbuf (org-export-to-buffer 'latex "*Org E-LATEX Export*"
2220 subtreep visible-only body-only ext-plist)))
2221 (with-current-buffer outbuf (LaTeX-mode))
2222 (when org-export-show-temporary-export-buffer
2223 (switch-to-buffer-other-window outbuf)))))
2226 2. Export to a file:
2228 #+BEGIN_SRC emacs-lisp
2230 (defun org-latex-export-to-latex
2231 (&optional async subtreep visible-only body-only ext-plist)
2233 (let ((outfile (org-export-output-file-name ".tex" subtreep)))
2235 (org-export-async-start
2236 (lambda (f) (org-export-add-to-stack f 'latex))
2239 'latex ,outfile ,subtreep ,visible-only ,body-only ',ext-plist)))
2241 'latex outfile subtreep visible-only body-only ext-plist))))
2244 It may also be interesting to provide a publishing function for the
2245 back-end. Such function must accept three arguments: a plist
2246 containing properties relative to the project being exported, the
2247 name of the current file being published and the publishing
2248 directory. It often is a simple wrapper around ~org-publish-org-to~
2249 function defined in =ox-publish.el=, as shown in the following
2252 #+BEGIN_SRC emacs-lisp
2253 (defun org-html-publish-to-html (plist filename pub-dir)
2254 (org-publish-org-to 'html filename ".html" plist pub-dir))
2259 # sentence-end-double-space: t