Commit Graph

300 Commits

Author SHA1 Message Date
Nicolas Goaziou fa64b59b05 org-macro: Allow macros in parsed keywords and associated properties
* lisp/org-macro.el (org-macro-replace-all): Add optional argument.
  Now accept macros in parsed keywords and associated properties.

* lisp/ox.el (org-export-as): Apply signature change.

* testing/lisp/test-ox.el (test-org-export/expand-macro): Add test.
2015-04-05 13:48:28 +02:00
Nicolas Goaziou ae9db17482 ox: Implement `parse' behavior for options
* lisp/ox.el (org-export-options-alist): Implement `parse' behavior
  and use it for parsed keywords.  Update docstring.
(org-export-document-properties): Remove variable.

(org-export--get-subtree-options):
(org-export--get-inbuffer-options):
(org-export--get-global-options):
(org-export--prune-tree):
(org-export--remove-uninterpreted-data): Handle `parse' behavior.

(org-export-as): Do not assume :date is always a secondary string
and :email is never one.

* testing/lisp/test-ox.el (test-org-export/get-inbuffer-options):
  Update tests.
2015-04-05 12:21:25 +02:00
Rasmus 79c0aa21ca ox: Remove #+KEYWORD and #+DESCRIPTION
* ox.el: Remove #+KEYWORD: and #+DESCRIPTION:.
* ox-deck.el, ox-rss.el, ox-html, ox-latex, ox-odt, ox-org: Add
  #+KEYWORD and #+DESCRIPTION.
* org.texi (Export settings): Explicit state which backends
  support #+DESCRIPTION and #+KEYWORDS.
2015-03-29 14:08:13 +02:00
Nicolas Goaziou a8f8ea8b69 ox: New smart quote algorithm
* lisp/ox.el (org-export-smart-quotes-alist): Fix indentation.
(org-export-smart-quotes-regexps): Remove variable.
(org-export--smart-quote-status): New function.
(org-export-activate-smart-quotes): Use new function.

* testing/lisp/test-ox.el (test-org-export/activate-smart-quotes):
  Update tests.
2015-03-28 15:41:46 +01:00
Nicolas Goaziou 3ece4c5e5e ox: Tiny fix
* lisp/ox.el (org-export--get-inbuffer-options): Do not consider
  `quote' value as t.
2015-03-28 10:56:16 +01:00
Nicolas Goaziou 0ac26737f0 ox: Remove filter associated to comments
* lisp/ox.el (org-export-filters-alist): Remove reference to comment
  filters.
(org-export-filter-comment-functions,
org-export-filter-comment-block-functions): Remove variables.

* doc/org.texi (Advanced configuration): Remove reference to comment
  filters.

* etc/ORG-NEWS: Signal removal.

Comments are removed before parsing the buffer.  As a consequence,
filters are never called.
2015-03-28 10:45:36 +01:00
Nicolas Goaziou 69dd4301ab ox: Remove comments and comment blocks prior to export
* lisp/ox.el (org-export--delete-comments): Renamed from
  `org-export--delete-commented-subtrees'.  Also remove comments and
  comment blocks.
(org-export-as): Apply renaming.

* testing/lisp/test-ox.el (org-test-with-parsed-data): Apply renaming.

From the export point of view COMMENTed subtrees and regular comments
are expected to be treated in the same way.
2015-03-28 10:27:04 +01:00
Nicolas Goaziou e8b2a120c2 ox: Fix `org-export--delete-commented-subtrees'
* lisp/ox.el (org-export--delete-commented-subtrees): Match COMMENT
  subtree even with a priority cookie or a TODO keyword.
2015-03-28 09:59:08 +01:00
Nicolas Goaziou fa0cc0ab70 Revert "Fix c9a52787c14c3a7429bcd3c8975350525e0baa04"
This reverts commit 359572d37e.

COMMENT headlines are expected to be ignored completely during export.
2015-03-28 09:54:37 +01:00
Nicolas Goaziou 359572d37e Fix c9a52787c1
* lisp/org-macro.el (org-macro--collect-macros): Ignore macro
  definitions in commented subtrees.
* lisp/ox.el (org-export--get-inbuffer-options): Ignore options in
  commented subtrees.
(org-export--delete-commented-subtrees): Remove function.
(org-export-as): Apply removal.

Removing the whole subtree is not subtle as Babel might want to use
data there.

Reported-by: Robert Klein <RoKlein@roklein.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/96347>
2015-03-24 09:35:39 +01:00
Nicolas Goaziou c9a52787c1 ox: Ignore export settings in commented subtrees
* lisp/ox.el (org-export--delete-commented-subtrees): New function.
(org-export-as): Use new function.

* testing/lisp/test-ox.el (org-test-with-parsed-data,
  test-org-export/get-inbuffer-options): Use new function.
(test-org-export/expand-macro): Add tests.

Reported-by: Andreas Leha <andreas.leha@med.uni-goettingen.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/96267>
2015-03-24 00:32:15 +01:00
Nicolas Goaziou f7b27896e9 ox: Rename some internal functions
* lisp/ox.el (org-export--prune-tree): Renamed from
  `org-export-prune-tree'.  Move it close to its caller.
(org-export--remove-uninterpreted-data): Renamed from
`org-export-remove-uninterpreted-data'.  Move it close to its caller.
(org-export--remove-uninterpreted-data-1): Move internal function
close to its caller.
(org-export-as): Apply renaming.

* testing/lisp/test-ox.el (org-test-with-parsed-data): Apply renaming.
2015-03-24 00:09:46 +01:00
Nicolas Goaziou e0b19dedb9 ox: Throw an error on unresolved id links
* lisp/ox.el (org-export-get-environment): Properly find file
  associated to id link.
(org-export-resolve-id-link): Throw an error on unresolved id links.

Use `org-id-find' instead of `org-id-find-id-file' as the latter may
returns the file attached to current buffer on search failure.

Reported-by: Jacob Gerlach <jacobgerlach@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/96020>
2015-03-17 23:31:49 +01:00
Jacob Gerlach dc08e98885 ox.el: Issue error for unresolved fuzzy link
* lisp/ox.el (org-export-resolve-fuzzy-link): Throw an error instead
  of returning nil when link can't be resolved.

* testing/lisp/test-ox.el (test-org-export/resolve-fuzzy-link): Change
  last test from should-not to should-error

In addition to throwing an error, don't store the failed match in the
link cache.

TINYCHANGE
2015-03-17 22:46:05 +01:00
Nicolas Goaziou a886b23476 ox: Throw an error on unresolved coderef
* lisp/ox.el (org-export-resolve-coderef): Throw an error on
  unresolved coderef.

* testing/lisp/test-ox.el (test-org-export/resolve-coderef): Update
  test.
2015-03-17 22:42:45 +01:00
Nicolas Goaziou 22ff8381ed ox: Fix defcustom
* lisp/ox.el (org-export-with-title): Fix :package-information value.
2015-03-17 15:51:30 +01:00
Nicolas Goaziou 16cea3d7b7 ox: Remove `comment' special value for `org-export-with-creator'
* lisp/ox.el (org-export-with-creator): Change default value.

* lisp/ox-ascii.el (org-ascii-template):
* lisp/ox-beamer.el (org-beamer-template):
* lisp/ox-latex.el (org-latex-template):
* lisp/ox-odt.el (org-odt-template):
* lisp/ox-org.el (org-org-template):
* lisp/ox-texinfo.el (org-texinfo-template): Treat
  `org-export-with-creator' as a boolean.

* testing/lisp/test-ox.el (test-org-export/parse-option-keyword):
  Update test.

* doc/org.texi (Export settings): Update allowed values in
  `org-export-with-creator'.

* etc/ORG-NEWS: Signal change.

Special `comment' value isn't meaningful for all back-ends and is not
implemented in every back-end where it makes sense anyway.

It is possible to add a comment including creator at the end of the
document using a body filter instead.
2015-03-17 15:51:22 +01:00
Nicolas Goaziou 1c5db20860 ox: Small refactoring
* lisp/ox.el (org-export-collect-footnote-definitions): Small
  refactoring.
2015-02-27 12:06:37 +01:00
Nicolas Goaziou 5738086a6b ox: Small refactoring
* lisp/ox.el (org-export-prune-tree): Small refactoring.
2015-02-27 11:53:24 +01:00
Nicolas Goaziou c76f254e8b ox: Fix custom link handling in anonymous back-end
* lisp/ox.el (org-export-custom-protocol-maybe): Change signature.
* contrib/lisp/ox-groff.el (org-groff-link):
* lisp/ox-ascii.el (org-ascii-link):
* lisp/ox-beamer.el (org-beamer-link):
* lisp/ox-html.el (org-html-link):
* lisp/ox-latex.el (org-latex-link):
* lisp/ox-man.el (org-man-link):
* lisp/ox-md.el (org-md-link):
* lisp/ox-odt.el (org-odt-link):
* lisp/ox-org.el (org-org-link):
* lisp/ox-texinfo.el (org-texinfo-link): Apply signature change.

* testing/lisp/test-ox.el (test-org-export/custom-protocol-maybe):
  Update test.

Provide explicitly back-end used instead of guessing it from INFO
channel as an anonymous back-end could be used, masquerading the real
one.

Reported-by: Christian Moe <mail@christianmoe.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/95402>
2015-02-24 15:54:01 +01:00
Nicolas Goaziou fa145361ec ox: Allow to narrow scope in footnotes API
* lisp/ox.el (org-export--footnote-reference-map,
  org-export-collect-footnote-definitions,
  org-export-footnote-first-reference-p,
  org-export-get-footnote-number): Allow to specify scope, through
  a new optional argument.

* lisp/ox-odt.el (org-odt-footnote-reference): Apply API change.

* testing/lisp/test-ox.el (test-org-export/footnote-first-reference-p,
  test-org-export/get-footnote-number,
  test-org-export/collect-footnote-definitions): Update tests.
2015-02-21 11:29:40 +01:00
Nicolas Goaziou 719dda85ea ox: Small refactoring
* lisp/ox.el (org-export-document-properties): New variable.
(org-export-prune-tree, org-export-remove-uninterpreted-data): Use new variable.
2015-02-20 18:50:27 +01:00
Nicolas Goaziou 014de0a532 ox: Change `org-export-collect-footnote-definitions' signature
* lisp/ox.el (org-export-collect-footnote-definitions): Refactor
  code.  Change signature.

* testing/lisp/test-ox.el (test-org-export/collect-footnote-definitions):
  New test.
(test-org-export/footnotes): Update test.

* lisp/ox-ascii.el (org-ascii-inner-template):
* lisp/ox-html.el (org-html-footnote-section): Apply signature change.

* etc/ORG-NEWS: Document signature change.

This change makes `org-export-collect-footnote-definitions' compatible
with `org-export-get-footnote-number' and
`org-export-footnote-first-reference-p'.
2015-02-20 18:06:23 +01:00
Nicolas Goaziou ccb663c742 ox: Add optional order argument to some footnotes related functions
* lisp/ox.el (org-export--footnote-reference-map): New function.
(org-export-footnote-first-reference-p,
org-export-get-footnote-number): Allow to change order when footnotes
references are contained within footnote definitions.

* testing/lisp/test-ox.el (test-org-export/footnote-first-reference-p):
(test-org-export/get-footnote-number):  New tests.
(test-org-export/footnotes): Update test.
2015-02-13 14:10:51 +01:00
Rasmus e6fcc853c5 ox: Optional export of title
* ox.el (org-export-with-title): New variable.
* ox (org-export-options-alist),
  ox-ascii.el (org-ascii-template--document-title),
  ox-beamer.el (org-beamer-template), ox-html.el (org-html-template),
  ox-latex.el (org-latex-template), ox-man.el (org-man-template),
  ox-odt.el (org-odt-template), ox-org.el (org-org-template),
  ox-publish.el (org-publish-project-alist),
  ox-texinfo.el (org-texinfo-template),
  ox-groff.el (org-groff--mt-head): Use new variable.
* ox-koma-letter.el (org-koma-letter-use-title): Mark obsolete.
* test-ox.el (test-org-export/parse-option-keyword): Add :with-title.
* ORG-NEWS, org.texi: Mention org-export-with-title.

This is useful in e.g. ox-html where title can be set via
`org-html-preamble-template' or when using the {{{title}}}-macro.
2015-02-12 01:45:39 +01:00
Nicolas Goaziou 16841306ed Use `org-element-copy'
* lisp/org.el (org-timestamp-split-range): Use `org-element-copy'.  Do
  not preserve :parent property anymore.

* lisp/ox.el (org-export-as): Use `org-element-copy'.

* testing/lisp/test-org.el (test-org/timestamp-split-range): Update test.
2015-02-09 10:15:59 +01:00
Rasmus 8f38f037b4 ox.el: {{{date}}} formatting argument
* ox.el (org-export-as): Allow {{{date}}} to take formatting-argument.
* org.texi (Macro replacement): Document {{{date}}} formatting.
* test-ox.el (test-org-export/expand-macro): Test {{{data(format)}}}
* org-NEWS: Mention optional {{{data}}} argument.

Optional argument to {{{date}}} like {{{date(FMT)}}} are treated
similar to {{{time(FMT)}}} if \#+DATE is a timestamp.
2015-02-09 01:47:21 +01:00
Charles Berry 638cde3ac9 lisp/ox.el: Enable removable inline src results
* lisp/ox.el: (org-export-as): Treat `results' as an `identity' macro
  with one argument after Babel executes.
2015-01-29 12:05:31 -08:00
Nicolas Goaziou a1f54021c9 org-element: Remove :alt-title property for headlines
* lisp/org-element.el (org-element-headline-parser): Remove :alt-title.
* lisp/ox.el (org-export-get-alt-title): Check regular :ALT_TITLE
  property instead of :alt-title.

`:alt-title' is an export-specific property. As a consequence, it's
value doesn't need to be parsed at "org-element.el"'s level. There, it
is treated as a regular property : `ALT_TITLE'.

This also removes the last call to
`org-element-parse-secondary-string' from "org-element.el".
2015-01-28 11:41:39 +01:00
Nicolas Goaziou b6fce5c90b ox: Prune parse tree before calling tree filter
* lisp/ox.el (org-export-collect-tree-properties): Do not
  set :ignore-list.
(org-export--populate-ignore-list): Remove function.
(org-export--selected-trees): Small refactoring.
(org-export-prune-tree): New function.
(org-export-remove-uninterpreted-data): Fix docstring.
(org-export-as): Prune tree before calling tree filter.

* testing/lisp/test-ox.el (org-test-with-parsed-data): Fix macro.

This patch introduces two changes in the export process:

  1. Non-exported elements are removed from the tree instead of being
     moved into an ignore list (with the exceptions of tables rows
     and cells)

  2. Parse tree filter is called on the tree being exported, not the
     original one.

Reported-by: Eric S Fraga <e.fraga@ucl.ac.uk>
<http://permalink.gmane.org/gmane.emacs.orgmode/94162>
2015-01-23 23:59:23 +01:00
Nicolas Goaziou f15b17688c ox: Fix docstrings
* lisp/ox.el (org-export-dictionary, org-export-translate): Fix spaces
  at the end of sentences.  Do not upcase `car' and `cdr'.
2015-01-22 00:23:06 +01:00
Nicolas Goaziou 6b450ce81c ox: Remove `org-export-ignore-element'
* lisp/ox.el (org-export-ignore-element): Remove function.
(org-export-collect-tree-properties): Do not assume users can
modify :ignore-list export property.

* testing/lisp/test-ox.el (test-org-export/user-ignore-list): Remove
  test.

:ignore-property is an implementation detail, which should not be
exposed to users.  Also, it is easier to simply remove the element to
ignore from the parse tree with `org-element-extract-element'.
2015-01-22 00:11:35 +01:00
Nicolas Goaziou b07e2f6ff1 ox: Implement local table of contents
* lisp/ox.el (org-export-collect-headlines): Allow to collect
  headlines locally.
* testing/lisp/test-ox.el (test-org-export/collect-headlines): Add
  tests.

* lisp/ox-ascii.el (org-ascii--build-toc):
(org-ascii-keyword):
* lisp/ox-html.el (org-html-toc):
(org-html-keyword):
* lisp/ox-odt.el (org-odt-toc): Allow local table of contents.
(org-odt--format-toc): New function.
(org-odt-begin-toc, org-odt-end-toc): Remove functions.

* lisp/ox-latex.el (org-latex-logfiles-extensions): Optionally remove
  "ptc" files.
(org-latex-headline, org-latex-keyword): Implement partial table of
contents assuming "titletoc" package is loaded.

* etc/ORG-NEWS:
* doc/org.texi (Table of contents): Document new parameter.
2015-01-11 22:47:02 +01:00
Nicolas Goaziou 3900155788 Implement `org-export-custom-protocol-maybe' and use it
* lisp/ox.el (org-export-custom-protocol-maybe): New function.
* contrib/lisp/ox-groff.el (org-groff-link):
* lisp/ox-ascii.el (org-ascii-link):
* lisp/ox-beamer.el (org-beamer-link):
* lisp/ox-html.el (org-html-link):
* lisp/ox-latex.el (org-latex-link):
* lisp/ox-man.el (org-man-link):
* lisp/ox-md.el (org-md-link):
* lisp/ox-odt.el (org-odt-link):
* lisp/ox-texinfo.el (org-texinfo-link): Use new function.

* testing/lisp/test-ox.el (test-org-export/custom-protocol-maybe): New
  test.
2015-01-04 22:16:36 +01:00
Nicolas Goaziou 8ce845ba6c ox: Tiny refactoring
* lisp/ox.el (org-export-inline-image-p): Tiny refactoring.
2015-01-04 21:13:27 +01:00
Rasmus 130dcdb0cb ox.el: Infer :minlevel for INCLUDE-keywords
* ox.el (org-export-expand-include-keyword): Infer :minlevel for
included Org documents if not set explicitly.
* test-ox.el (org-export-expand-include-keyword): Add tests for inferred :minlevel.
2014-12-24 12:44:51 +01:00
rasmus 7509d6d721 ox.el: Fix footnote-bug in #+INCLUDE-keyword
* ox.el (org-export--prepare-file-contents): Preserve footnotes
when using the LINES argument.  New optional argument FOOTNOTES.
 (org-export-expand-include-keyword): New optional argument
 FOOTNOTES.
* test-ox.el (test-org-export/expand-include): Add test for INCLUDE
  with :lines and footnotes.
2014-12-24 11:58:50 +01:00
Nicolas Goaziou 61ba40c371 ox: Deprecate `org-export-get-genealogy' for `org-element-lineage'
* lisp/ox.el (org-export-collect-tree-properties,
  org-export-numbered-headline-p, org-export-get-tags,
  org-export-resolve-fuzzy-link, org-export-get-ordinal,
  org-export-get-parent-headline, org-export-get-parent-element,
  org-export-get-parent-table):

* lisp/ox-ascii.el (org-ascii--current-text-width):

* lisp/ox-beamer.el (org-beamer--frame-level):

* lisp/ox-icalendar.el (org-icalendar-blocked-headline-p):

* lisp/ox-latex.el (org-latex-footnote-reference):

* lisp/ox-odt.el (org-odt--enumerate, org-odt-link--infer-description,
  org-odt-table): Use `org-element-lineage' instead of
  `org-export-get-genealogy'.
2014-11-16 13:30:33 +01:00
Nicolas Goaziou a2f8a48ab5 Merge branch 'maint'
Conflicts:
	lisp/ox.el
2014-11-07 00:16:42 +01:00
Leslie H. Watter d4a4fc740e ox.el: Add pt_BR translations to export engine
* lisp/ox.el: (org-export-dictionary) Add pt_BR messages to the list.

TINYCHANGE
2014-11-06 23:47:28 +01:00
Nicolas Goaziou 1c34ec85b0 ox: Update INCLUDE keywords wrt property drawers
* lisp/ox.el (org-export--inclusion-absolute-lines): Fix comment.
(org-export--prepare-file-contents):  Do not look for property drawers
after a drawer, since this is impossible.

* testing/examples/include.org: Fix test data.
2014-10-28 14:23:52 +01:00
Nicolas Goaziou d849804ac7 ox: Remove unnecessary code comments 2014-10-24 21:13:47 +02:00
Nicolas Goaziou 89f5ad36d7 Merge branch 'maint' 2014-10-12 22:55:38 +02:00
Nicolas Goaziou a0ac1344fc ox: Fix 88457acff4
* lisp/ox.el (org-export-async-start): Limit first argument to lambda
  expressions.
* lisp/ox-publish.el (org-publish, org-publish-all,
  org-publish-current-file): Replace `ignore', per limit stated above.

Due to a hack allowing to provide quasi-quoted lambda expressions,
symbols are not allowed as result handler.  This limitation is not
much of a problem as `org-export-async-start' is only meant to be used
internally.
2014-10-12 22:53:01 +02:00
Aaron Ecay bc9a582f1e [export] Raise an error if footnote definition is not found.
* lisp/ox.el (org-export-get-footnote-definition): Raise an error if
footnote definition is not found.
2014-10-12 16:47:09 +01:00
Aaron Ecay 5f423f1208 Warn about unexpanded macros on export
* lisp/org-macro.el (org-macro-replace-all): Add optional `finalize'
argument.
* lisp/ox.el (org-export-as): Use it.
2014-10-12 16:47:09 +01:00
Nicolas Goaziou fac4677e51 Merge branch 'maint' 2014-10-10 11:11:06 +02:00
Nicolas Goaziou 88457acff4 ox: Fix "void-variable ignore" error when publishing
* lisp/ox.el (org-export-async-start): Allow to use symbols as
  function.

Thanks to Julien Cubizolles for reporting it.
http://permalink.gmane.org/gmane.emacs.orgmode/91532
2014-10-10 11:05:06 +02:00
Rasmus 464cd965cb ox: Support unnumbered headlines via property
* ox.el (org-export--collect-headline-numbering): Ignore unnumbered headline.
(org-export-get-headline-id,
org-export--collect-unnumbered-headline-id): New functions.
(org-export-numbered-headline-p): Further tests for unnumbered headline.
* ox-odt.el (org-odt-headline, org-odt-link,
org-odt-link--infer-description)
ox-md.el (org-md-headline, org-md-link),
ox-latex.el (org-latex-headline, org.latex-link),
ox-html.el (org-html-headline, org-html-link),
ox-ascii.el (org-ascii-link): Support unnumbered headlines.
* test-ox.el (test-org-export/org-export-get-headline-id): New test.
* OrgOdtStyles.xml: Add styles for unnumbered headings.
2014-10-03 22:06:34 +02:00
Rasmus 986037a538 ox: Allow file-links with #+INCLUDE-keyword
* org.el (org-edit-special): Handle file-links for INCLUDE.
* ox.el (org-export--prepare-file-contents): Handle links and
add option no-heading.
* ox.el (org-export-expand-include-keyword): Resolve headline
links and add option :only-contents.
* orgguide.texi (Include files)
org.texi (Include files): Updated.
* testing/examples/include.org: New examples.
* test-ox.el (test-org-export/expand-include): New tests.
2014-10-02 18:51:37 +02:00