* contrib/lisp/org-element.el (org-element-example-block-parser,
org-element-src-block-parser): Add `:number-lines',
`:preserve-indent, `:retain-labels', `:use-labels' and
`:label-fmt' properties.
* contrib/lisp/org-export.el (org-export-resolve-coderef,
org-export-get-loc): Apply changes to src-block and example-block
elements' properties.
(org-export-unravel-code, org-export-format-code,
org-export-format-code-default): New functions.
(org-export-handle-code): Removed function.
* EXPERIMENTAL/org-e-latex.el (org-e-latex-example-block): Use new
function.
(org-e-latex-src-block): Use new API. Better handling of numbered
lines with special packages.
* EXPERIMENTAL/org-e-ascii.el (org-e-ascii-example-block,
org-e-ascii-src-block): Use new functions.
* testing/lisp/test-org-element.el: Add tests.
* testing/lisp/test-org-export.el: Add tests.
* contrib/lisp/org-element.el (org-element-map): New optional argument
to avoid recursion into certain recursive types.
* contrib/lisp/org-export.el (org-export-footnote-first-reference-p,
org-export-get-footnote-number,
org-export-collect-footnote-definitions): Use new argument from
`org-element-map'.
* testing/lisp/test-org-export.el: Add test.
The new argument allows to force entering footnotes definitions at
a certain time (when their first reference is found) but not a second
time when they are encountered in the parse tree.
Thanks to Jambunathan for reporting this.
* lisp/org.el (org-link-search): Search for #+name affiliated keywords
and invisible targets.
* contrib/lisp/org-element.el (org-element-link-parser): Remove "ref"
links relative part.
(org-element-target-parser): Move property name from `:raw-value' to
`:value'.
(org-element-recursive-objects): Remove targets from tables. Cells
are not parsed unless explicitely asked by back-end developer, too
late. A target wouldn't be noticed in time. One solution could be to
parse every table, but that's time consumming.
(org-element-object-restrictions): Target are not recursive anymore.
* contrib/lisp/org-export.el (org-export-resolve-fuzzy-link): Find
elements with a matching "#+name: path" affiliated keyword.
(org-export-get-ordinal): Make special cases for headlines, items,
footnotes definitions and references.
(org-export-resolve-ref-link): Removed function.
* EXPERIMENTAL/org-e-latex.el (org-e-latex-link): Handle
cross-reference numbers.
(org-e-latex-target): Targets have no contents.
* EXPERIMENTAL/org-e-ascii.el (org-e-ascii--describe-links): Ignore
fuzzy links in link description at the end of the section.
(org-e-ascii-link): Handle cross-reference numbers.
* testing/contrib/lisp/test-org-export.el: Add tests.
* testing/lisp/test-org.el: Add tests.
* contrib/lisp/org-export.el (org-export-numbered-headline-p): New function.
* EXPERIMENTAL/org-e-ascii.el: Apply new function.
* EXPERIMENTAL/org-e-latex.el: Apply new function.
* testing/lisp/test-org-export.el: Add a test.
* contrib/lisp/org-element.el (org-element-map): Don't forget to apply
function on paragraph even when no object should be mapped. Just
don't recurse in it.
* EXPERIMENTAL/org-e-latex.el (org-e-latex-footnote-reference):
Correctly handle numbering with nested footnotes.
* contrib/lisp/org-element.el (org-element-map): Apply function to
element or object before applying it to its secondary string, if
any. Otherwise, linearity is broken.
* contrib/lisp/org-export.el (org-export-footnote-first-reference-p,
org-export-get-footnote-number): Take care of recursive footnotes.
(org-export-get-genealogy): Correctly get genealogy of an item within
a secondary string.
* testing/contrib/lisp/test-org-export.el: Add tests.
* EXPERIMENTAL/org-e-latex.el (org-e-latex-footnote-reference): Allow
nested footnotes.
* contrib/lisp/org-element.el (org-element-string-restrictions): Allow
footnote references within a footnote reference.
* testing/contrib/lisp/test-org-export.el: Add a test for nested
footnotes.
* contrib/lisp/org-export.el (org-export-collect-tree-properties):
Do not overwrite any user's ignore list.
* testing/contrib/lisp/test-org-export.el: Add test.
A good way to populate `:ignore-list' is through the use of
`org-export-filter-parse-tree-functions', with the help of
`org-element-map' and `org-export-ignore-element'. As an example, the
following code will skip every headline containing the word "note"
in its title during a LaTeX export:
(defun user-skip-note-headlines (data backend info)
;; For now LaTeX back-end is called `e-latex'.
(when (eq backend 'test)
;; Traverse the parse tree, adding to ignore list any headline
;; matching criteria.
(org-element-map
data 'headline
(lambda (headline)
(when (string-match "\\<note\\>"
(org-element-property :raw-value headline))
(org-export-ignore-element headline info)))
info))
;; Return original DATA.
data)
Then install it in parse-tree filters:
(add-to-list 'user-skip-note-headlines org-export-filter-parse-tree-functions)
Back-end delevopers will install it via `org-BACKEND-filters-alist'
where BACKEND stands for the name of the back-end considered. Se
`org-export-filters-alist' for more information.
* contrib/lisp/org-element.el (org-element-map): Remove use of an
alternate communication channel. Function is now called with only
one argument.
* contrib/lisp/org-export.el (org-export-collect-tree-properties):
(org-export-collect-headline-numbering, org-export--selected-trees,
org-export-collect-footnote-definitions,
org-export-footnote-first-reference-p,
org-export-get-footnote-number, org-export-resolve-fuzzy-link,
org-export-resolve-id-link, org-export-resolve-ref-link,
org-export-resolve-coderef, org-export-get-ordinal,
org-export-get-loc, org-export-collect-headlines): Apply changes.
* EXPERIMENTAL/org-e-ascii.el (org-e-ascii--unique-links): Apply
changes.
* EXPERIMENTAL/org-e-publish.el (org-e-publish-collect-index): Apply
changes.
* contrib/lisp/org-export.el (org-export-expand-include-keyword): Use
another optional argument to specify the current working directory.
(org-export-as): Apply changes.
* testing/contrib/lisp/test-org-export.el: Add tests.
* testing/examples/include.org: New test file.
* testing/examples/include2.org: New test file.
* contrib/lisp/org-export.el (org-export-snippet-backend): New
function.
(org-export--skip-p): Remove automatic skip of export snippets.
* EXPERIMENTAL/org-e-ascii.el (org-e-ascii-export-snippet): Use new
function.
* EXPERIMENTAL/org-e-html.el (org-e-html-export-snippet): Use new
function.
* EXPERIMENTAL/org-e-latex.el (org-e-latex-export-snippet): Use new
function.
* EXPERIMENTAL/org-e-odt.el (org-e-odt-export-snippet): Use new
function.
* testing/contrib/lisp/test-org-export.el: Add test.
The idea behind this change is that a given back-end may decide to
keep an export snippet not directly targetted at it (i.e. a beamer
back-end that would want to keep latex snippets). Hence, filtering
snippets is on back-ends side, and a new function is added to help
them in that task.
* contrib/lisp/org-element.el (org-element-headline-parser): COMMENT
and QUOTE keywords, ARCHIVE tags are case sensitive.
* testing/contrib/lisp/test-org-element.el: New file.
* contrib/lisp/org-export.el (org-export-collect-tree-properties):
Remove `:use-select-tags' property.
(org-export-populate-ignore-list): Renamed from
`org-export-get-ignore-list'.
(org-export--selected-trees): Renamed from
`org-export-use-select-tag-p'.
(org-export--skip-p): Use an additional argument to specify list of
trees containing a select tag.
(org-export-select-tags, org-export-exclude-tags,
org-export-with-priority): Change doc-string.
* testing/contrib/lisp/test-org-export.el: Tests modified
accordingly.
* contrib/lisp/org-element.el: Move archived tree handling out of
org-element-map.
* contrib/lisp/org-export.el (org-export-get-ignore-list): Properly
ignore archived with `org-export-with-archived-trees' set to
`headline'.
* testing/contrib/lisp/test-org-export.el (test-org-export/handle-options):
Add a test for that.
* contrib/lisp/org-export.el (org-export-get-inbuffer-options): Fix
but with incomplete macros returning an error. Also with behaviour
`nil', only insert new value if none was defined before.
(org-export-use-select-tags-p): Fix bug preventing it from properly
detecting select-tags.
(org-export--skip-p): Small refactoring
* testing/contrib/lisp/test-org-export.el: New test file.
* contrib/lisp/org-export.el (org-export-get-parent): New function.
(org-export-data, org-export-get-previous-element,
org-export-get-next-element): Use new function.
* EXPERIMENTAL/org-e-ascii.el (org-e-ascii-item): Use new function.
Refactor code.
(org-e-ascii-paragraph): Use new function.
* EXPERIMENTAL/org-e-latex.el (org-e-latex-item): Use new function.
* EXPERIMENTAL/org-e-html.el (org-e-html-item): Use new function.
* EXPERIMENTAL/org-e-odt.el (org-e-odt-item): Use new function.
* EXPERIMENTAL/org-e-ascii.el (org-e-ascii--current-text-width,
org-e-ascii-item, org-e-ascii-paragraph): Apply `:genealogy' removal.
* EXPERIMENTAL/org-e-latex.el (org-e-latex-item): Apply `:genealogy'
removal.
* contrib/lisp/org-element.el (org-element-map): Do not compile
genealogy. Also use `:ignore-list' when possible.
* contrib/lisp/org-export.el (org-export-collect-tree-properties):
Populate `:ignore-list' before starting to transcode each element in
subtree.
(org-export-get-min-level): Use `:ignore-list'.
(org-export--skip-p): Renamed from `org-export-skip-p'. This is now
an internal function.
(org-export-data): Use and update `:ignore-list'. Do not update
genealogy.
(org-export-ignore-element): New function
(org-export-last-sibling-p): Small refactoring.
(org-export-resolve-fuzzy-link): Apply `:genealogy' removal.
(org-export-get-genealogy): Use a more efficient algorithm.
The equivalent of (plist-get info :genealogy) is
now (org-export-get-genealogy blob info), blob being any element or
object.
* contrib/lisp/org-element.el (org-element-object-restrictions):
Modify docstring.
(org-element-secondary-value-alist): New variable.
(org-element-map): Possibly look into secondary strings when mapping
through objects. Also sanitize some function names.
* EXPERIMENTAL/org-e-ascii.el (org-e-ascii--unique-links): Make use of
org-element-map improvement.
* EXPERIMENTAL/org-e-ascii.el (org-e-ascii-item): Use new
`org-list-get-item-number' function.
* contrib/lisp/org-element.el (org-element-item-interpreter): Use new
`org-list-get-item-number' function.
* contrib/lisp/org-element.el (org-element-string-restrictions): Allow
targets in tables. Also fix wrong symbol for verse-blocks.
(org-element-verse-block-parser): Apply change.
* contrib/lisp/org-element.el (org-element-link-parser): Recognize
"ref" type links as a new type of Org link.
* contrib/lisp/org-export.el (org-export-resolve-ref-link): New
function.
* EXPERIMENTAL/org-e-ascii.el (org-e-ascii--describe-links): Do not
describe "ref" type links at the end of each section.
(org-e-ascii-link): Handle "ref" type links.
* EXPERIMENTAL/org-e-latex.el (org-e-latex-link): Handle "ref" type
links.
"ref" type links are Org answer to LaTeXisms like "\ref{some-label}".
Hence, [[ref:some-label]] will be replaced with the sequence number of
the element with name "#+name: some-label" during export.
* contrib/lisp/org-export.el (org-export-dispatch): Put
temporary buffer that holds exported HTML source in either
`nxhtml-mode' or `nxml-mode'.
`nxhtml-mode' is *not* part of stock Emacs while `nxml-mode' is.
* contrib/lisp/org-export.el (org-export-dispatch)
(org-export-dispatch-ui): Add new entries for the new HTML
exporter.
* EXPERIMENTAL/org-e-html.el: New file. This is a very rough
cut based out on org-xhtml.el and org-e-latex.el. The file
retains all the LaTeXisms in either commented form or
otherwise. This is deliberate so as to have a quick look at
the reference implementation. Retaining the organization
style of org-xhtml.el would enable easy creation of
org-e-odt.el by simply replacing e-html with e-odt for the
most part.
The changes here covers fairly a good ground - say 90% - of my
unit test file.
* contrib/lisp/org-export.el (org-export-as, org-export-to-buffer,
org-export-to-file): Add an optional argument to prevent including
files and executing Babel code.
This can be used as a basis for an Org to Org exporter.
* contrib/lisp/org-element.el (org-element-recursive-objects): Add
macro object type to recursive types.
(org-element-object-restrictions): Macros can only contain other
macros.
* contrib/lisp/org-export.el (org-export-get-inbuffer-options): Parse
macro value, unless it it meant to be eval'ed.
(org-export-expand-macro): Expand macros recursively.
* contrib/lisp/org-element.el (org-element-link-parser): Do not parse
radio link as a recursive link.
* contrib/lisp/org-export.el (org-export-solidify-link-text): Make
sure "\" isn't allowed in solidified strings. This is required to
allow entities in radio targets.
* EXPERIMENTAL/org-e-latex.el (org-e-latex-link): Apply changes to
radio links.
* EXPERIMENTAL/org-e-ascii.el (org-e-ascii-link): Apply changes to
radio links.
* contrib/lisp/org-export.el (org-export-get-genealogy,
org-export-get-parent-paragraph): New functions.
(org-export-get-parent-headline, org-export-get-previous-element,
org-export-get-next-element): Internally use new function.
* EXPERIMENTAL/org-e-latex.el (org-e-latex-link--inline-image,
org-e-latex-link): Apply changes to topology functions.
This new function is especially useful since every object derives its
properties from those the containing paragraph.
* contrib/lisp/org-element.el (org-element-object-restrictions): Allow
plain links in link description.
* contrib/lisp/org-export.el (org-export-default-inline-image-rule):
New variable.
(org-export-inline-image-p): Use rules instead of extensions. A rule
is a regexp applied to path for a given type of link. It allows to
extend inline images to non-local files.
* EXPERIMENTAL/org-e-latex.el (org-e-latex-inline-image-rules): New
variable.
(org-e-latex-inline-image-extensions): Removed variable
There are two motivations behind this change. The first one is to
allow, for example, an HTML exporter to define a rule like the
following:
("http" . "\\.\\(png\\|jpg\\|jpeg\\|gif\\)\\(\\?\\(\\w+=\\w+&?\\)*\\)?")
The other one is to properly define thumbnails (clickable images),
like the following:
[[http://orgmode.org][file:~/my-logo.png]]
* contrib/lisp/org-export.el (org-export-filters-alist): New variable.
(org-export-install-filters): New function.
* EXPERIMENTAL/org-e-ascii.el (org-e-ascii-filters-alist): New variable.
Back-end specific filters can now be installed in communication
channel with `org-BACKEND-filters-alist' variable.
* contrib/lisp/org-export.el (org-export-get-environment): Renamed
function from org-export-collect-options. Also make arguments
optionals.
(org-export-as): Apply renaming. Refactor code a bit.
(org-export-get-inbuffer-options): Remove string argument from
signature. Backend is now optional. Also, check if option match is
really a keyword.
(org-export-get-global-options, org-export-parse-option-keyword): Make
backend argument optional.
* contrib/lisp/org-export.el (org-export-collect-options): Remove
useless argument.
(org-export-initial-options): Add an `:input-file' property in
communication channel.
* contrib/lisp/org-export.el (org-export-initial-options): Initialize
correctly some macros when buffer is a clone.
(org-export-expand-macro): Ignore output when macro's value is nil.
* contrib/lisp/org-element.el (org-element-map): Remove included file
expansion part.
* contrib/lisp/org-export.el (org-export-as): Expand include keywords
before executing blocks.
(org-export-expand-include-keyword, org-export-prepare-file-contents):
New functions.
(org-export-included-file, org-export-parse-included-file): Removed
functions.
* EXPERIMENTAL/org-e-ascii.el (org-e-ascii-keyword): Remove include
keyword handling.
* EXPERIMENTAL/org-e-latex.el (org-e-latex-keyword): Remove include
keyword handling.
Back-ends do not need anymore to take care of #+include keywords.
This change is required since file inclusion can potentially break any
structure. Hence, it should be done before parsing.
* contrib/lisp/org-export.el (org-export-with-current-buffer-copy):
Copy `outline-level' value in the temporary buffer. This fixes
a bug introduced by commit
10b06ae53c.
* contrib/lisp/org-element.el (org-element-item-parser): If item's
first line is empty, ensure contents start at a beginning of line so
that child can be correctly parsed.
* contrib/lisp/org-element.el (org-element-dual-keywords): Move
caption in the dual keywords category.
(org-element--affiliated-re): Change regexp matching a dual keyword.
(org-element-collect-affiliated-keywords): Dual parsed keywords also
get their optional value parsed as a secondary string.
* EXPERIMENTAL/org-e-latex.el (org-e-latex--caption/label-string,
org-e-latex-src-block): Apply caption status change.
* EXPERIMENTAL/org-e-ascii.el (org-e-ascii--build-caption): Apply
caption status change.
(org-e-ascii--list-listings, org-e-ascii--list-tables): Apply caption
status change. Also use short caption name when available.
The status change implies a syntax change. Captions can now share
#+results: syntax, which mean that they can have a secondary
value. Thus, the following Org snippets are valid, the first two being
equivalent.
#+caption: long name
#+caption[]: long name
#+caption[short name]: long name
* contrib/lisp/org-export.el (org-export-get-inbuffer-options):
Replace macro with an empty string when no value is provided.
Ignore macros with an ill-formed key.
* contrib/lisp/org-export.el (org-export-option-alist): Add filters as
properties in the communication channel. This allows back-end
developers to install their own filters at run time instead of
making them reside in a global variable.
(org-export-data, org-export-as): Read filters from communication
channel instead of global variables.
(org-export-filter-apply-functions): Only accept list of functions.
Also change order of calling: it is now LIFO.
* contrib/lisp/org-export.el (org-export-collect-elements): Change
output to list of elements instead of their beginning position.
Also add an optional predicate argument for fine grain control.
Remove back-end argument.
(org-export-collect-tables, org-export-collect-listings): Apply
changes from previous function.
(org-export-collect-figures): Apply changes from previous function.
Also require a predicate to correctly define the concept of figure.
* contrib/lisp/org-export.el (org-export-get-ordinal): Correctly
handle predicate in `org-export-get-ordinal'. Also allow to count
more than one element type in the same sequence with optional
argument TYPES.
* contrib/lisp/org-element.el (org-element-quote-section-parser):
Assume point is at quote-section beginning.
(org-element-guess-type): Move point to section beginning before
calling for quote-section parser.
(org-element-parse-elements, org-element-current-element): Correctly
detect and parse quote section.
* EXPERIMENTAL/org-e-latex.el (org-e-latex-export-to-latex,
org-e-latex-export-to-pdf): New functions.
* contrib/lisp/org-export.el (org-export-dispatch): Make use of new
functions.
* contrib/lisp/org-export.el (org-export-output-file-name): New function.
(org-export-to-file): Remove post-process and pub-dir arguments. Add
a file argument to specify an output file.