Commit Graph

263 Commits

Author SHA1 Message Date
Nicolas Goaziou 8fb5987e56 org-export: Fix smart quotes with isolated quotes
* contrib/lisp/org-export.el (org-export-activate-smart-quotes): Fix
  smart quotes in some corner-cases.  Refactor code.
* testing/lisp/test-org-export.el: Add test.
2012-10-29 20:36:03 +01:00
Nicolas Goaziou a2120a9d73 org-export: Expand correctly {{{title}}} and such
* contrib/lisp/org-export.el (org-export-as): Expand correctly
  {{{title}}} and such when they already contain a regular macro.
  This is done by expanding macros in two steps: at first regular
  macros,  then document specific macros.
(org-export-expand-macro): Remove function.
* testing/lisp/test-org-export.el: Add test.
2012-10-29 14:01:20 +01:00
Nicolas Goaziou a8c026cb26 org-export: Explicit error when using invalid syntax for INCLUDE keywords
* contrib/lisp/org-export.el (org-export-expand-include-keyword):
  Error out when file isn't specified within double quotes.
* testing/lisp/test-org-export.el: Add test.
2012-10-29 11:31:19 +01:00
Nicolas Goaziou 90fcb4b841 org-export: Add filter set for diary sexp elements
* contrib/lisp/org-export.el (org-export-filters-alist): Add filter
  set for diary sexp elements.
(org-export-filter-comment-block-functions): Fix docstring.
(org-export-filter-diary-sexp-functions): New variable.
2012-10-28 23:00:04 +01:00
Nicolas Goaziou ccc98ebc2d org-export: Fix expansion of babel calls in included files
* contrib/lisp/org-export.el (org-export-as):
  `org-current-export-file' should refer to current, temporary, buffer
  containing included contents, not to original buffer with include
  keywords.
(org-export-with-current-buffer-copy): Buffer copy must contain the
whole buffer, possibly narrowed to a proper part, not only the
narrowed part.
* testing/lisp/test-org-export.el: Tweak tests.
2012-10-28 16:21:30 +01:00
Nicolas Goaziou b2047a2565 org-export: Implement a generic smart quote module
* contrib/lisp/org-export.el (org-export-options-alist): Add an option
  item to toggle smart quotes during export.
(org-export-with-smart-quotes, org-export-smart-quotes-alist,
org-export-smart-quotes-regexps): New variables.
(org-export-activate-smart-quotes): New function.
(org-export-data): Remove residual text properties.
* testing/lisp/test-org-export.el: Add tests.
2012-10-27 11:42:31 +02:00
Nicolas Goaziou 00eaa4dc97 org-export: Fix error when exporting buffers not visiting a file
* contrib/lisp/org-export.el (org-export-output-file-name): Do not
  return an error when exported buffer isn't visiting a file.
2012-10-27 00:02:52 +02:00
Nicolas Goaziou 6e73c22d15 org-export: Fix commit 468d860528
* contrib/lisp/org-export.el (org-export-dispatch-ui): Ensure fitting
  happens once contents have been inserted in the displayed buffer.
2012-10-22 23:56:26 +02:00
Nicolas Goaziou 9751dc4561 org-export: Use relative path for target filenames
* contrib/lisp/org-export.el (org-export-output-file-name): Use
  relative path for target filenames.
2012-10-22 20:58:27 +02:00
Nicolas Goaziou 468d860528 org-export: Make sure that window displaying UI is tall enough
* contrib/lisp/org-export.el (org-export-dispatch-ui): Make sure that
  window displaying UI is tall enough. This fixes a bug where only
  a part of the menu was displayed.
2012-10-21 14:54:23 +02:00
Nicolas Goaziou 9497098dd4 org-export: Don't modify inlinetasks stars when including a file
* contrib/lisp/org-export.el (org-export--prepare-file-contents):
  Don't modify inlinetasks stars when including a file.
2012-10-16 22:00:39 +02:00
Nicolas Goaziou c1c0c70c89 org-export: Add tag inheritance to `org-export-get-tags'
* contrib/lisp/org-export.el (org-export-get-tags): Add optional tag
  inheritance.
* testing/lisp/test-org-export.el: Add test.
2012-10-14 13:19:12 +02:00
Nicolas Goaziou 0a99cf7249 org-export: Tweak dispatch UI
* contrib/lisp/org-export.el (org-export-dispatch-use-expert-ui):
  Complete docstring.
(org-export-dispatch): Fix docstring. Clean dispatch buffer, if any,
each time the function is called.
(org-export-dispatch-ui): Make sure window containing dispatch buffer
is active when user is prompted for a key.  Also remove cursor from
view.
(org-export-dispatch-action): Ring a bell when a wrong key is pressed.
In regular UI, also inform the user by a message.
2012-10-11 21:32:21 +02:00
Nicolas Goaziou b6822edce3 org-export: Update radio targets after expanding include keywords
* contrib/lisp/org-export.el (org-export-as): Update radio targets
  after expanding include keywords.
2012-10-10 13:55:51 +02:00
Nicolas Goaziou 89d6a26f8d org-export: Expand include keywords before macros
* contrib/lisp/org-export.el (org-export-as): Expand include keywords
  before macros.  This allows to specify macro templates in the
  included file.
* testing/examples/macro-templates.org: New file for testing purposes.
* testing/lisp/test-org-export.el: Add test.
2012-10-10 13:52:54 +02:00
Achim Gratz 424a1c5d2f correct reference to non-existing source file
* contrib/lisp/org-export.el: Correct reference to non-existing source
  file, org-exp-blocks has been removed and the imported function is
  now in ob-exp.
2012-10-07 19:16:20 +02:00
Nicolas Goaziou 956858a395 org-export: Fix menu leak when reloading Org
* contrib/lisp/org-export.el (org-export-define-backend,
  org-export-define-derived-backend): Make sure a given entry won't be
  added to menu more than once.
2012-10-06 22:04:27 +02:00
Nicolas Goaziou 58b42debb1 org-export: Include title, author, date and email macros
* contrib/lisp/org-export.el (org-export-expand-macro): New function.
(org-export-as): Use new function.
* lisp/org.el (org-macro-expand, org-macro-replace-all): Change
  signature.  The function now accepts an alist of templates so it
  doesn't have to rely only on `org-macro-templates'.
(org-macro-initialize-templates): {{{date}}} is not anymore an alias
for {{{time}}}.  During export, it will provide the value stored in
DATE keyword instead.
* testing/lisp/test-org-export.el: Add tests.
* testing/lisp/test-org.el: Update tests.
2012-10-06 10:29:37 +02:00
Nicolas Goaziou 0af2f6068f org-export: Fix comma escape in included files
* contrib/lisp/org-export.el (org-export-expand-include-keyword): Use
  new functions to comma escape contents of included files when in an
  example or a src block.
2012-10-06 09:19:41 +02:00
Nicolas Goaziou e4799ef25e org-export: Remove unused function declarations 2012-10-04 14:42:51 +02:00
Nicolas Goaziou 2a95a47c5f Merge branch 'maint' 2012-10-01 21:37:48 +02:00
Nicolas Goaziou 3bd22fb045 org-element: Store value of example-blocks and src-blocks unescaped
* lisp/org-element.el (org-element-example-block-parser,
  org-element-src-block-parser): Store value of example-blocks and
  src-blocks unescaped.
(org-element-example-block-interpreter,
org-element-src-block-interpreter): Escape value again when storing
it.
* contrib/lisp/org-export.el (org-export-unravel-code): Don't clean
  commas from code since org-element already took care of it.
* testing/lisp/test-org-export.el: Update test.
* testing/lisp/test-org-element.el: Add tests.
2012-10-01 21:35:50 +02:00
Nicolas Goaziou e74523905b org-element: Distinguish parsed affiliated keywords from document properties
* lisp/org-element.el (org-element-parsed-keywords): Remove document
  properties from the value.
(org-element-dual-keywords): Fix docstring.
(org-element-document-properties): New variable
* contrib/lisp/org-export.el (org-export--get-subtree-options,
  org-export--get-inbuffer-options, org-export--get-global-options):
  Use new variable instead of parsed keywords.
2012-09-30 23:57:45 +02:00
Nicolas Goaziou e189be5720 org-export: Small refactoring
* contrib/lisp/org-export.el (org-export--get-buffer-attributes):
  Small refactoring.
2012-09-30 14:03:37 +02:00
Nicolas Goaziou 179a5224f6 org-export: Signal an error when back-end isn't registered
* contrib/lisp/org-export.el (org-export-barf-if-invalid-backend): New
  function.
(org-export-as): Signal an error when back-end isn't registered.
2012-09-24 22:35:55 +02:00
Nicolas Goaziou 9ebf47afbf org-export: Re-order filter variables 2012-09-24 08:30:46 +02:00
Nicolas Goaziou ddfaa6fe7a org-export: Add filters for new element type
* contrib/lisp/org-export.el (org-export-filter-node-property-functions):
  New variable.
(org-export-filters-alist): Use new variable.
2012-09-23 22:50:33 +02:00
Nicolas Goaziou 66fe322120 org-export: New function to return a node property, even inherited
* contrib/lisp/org-export.el (org-export-get-node-property): New
  function.
* testing/lisp/test-org-export.el: Add tests.
2012-09-23 19:37:21 +02:00
Nicolas Goaziou baed7dc7db org-element: Optimize affiliated keywords parsing
* lisp/org-element.el (org-element-center-block-parser,
  org-element-drawer-parser, org-element-dynamic-block-parser,
  org-element-footnote-definition-parser,
  org-element-plain-list-parser, org-element-quote-block-parser,
  org-element-special-block-parser, org-element-babel-call-parser,
  org-element-comment-parser, org-element-comment-block-parser,
  org-element-example-block-parser, org-element-export-block-parser,
  org-element-fixed-width-parser, org-element-horizontal-rule-parser,
  org-element-keyword-parser, org-element-latex-environment-parser,
  org-element-paragraph-parser, org-element-property-drawer-parser,
  org-element-src-block-parser, org-element-table-parser,
  org-element-verse-block-parser): Change signature. Now use an
  additional argument: affiliated.
(org-element--current-element): Skip affiliated keywords and pass them
  as an argument to parsers.  It prevents to walk through these
  keywords twice: the first time to get to the first line of the
  element, and a second time to collect the affiliated keywords.
* contrib/lisp/org-export.el (org-export-get-caption): Update function
  since multiple affiliated keywords are now reversed.
* testing/lisp/test-org-element.el: Update tests.
2012-09-20 20:08:16 +02:00
Nicolas Goaziou f0bcf780a3 org-export: Fix collision between old export menu and new one
* contrib/lisp/org-export.el (org-export-dispatch-ui): Do not use same
  buffer name as previous export dispatcher.  Also make sure the
  temporary buffer is deleted once the export is done.
2012-09-14 13:54:43 +02:00
Nicolas Goaziou cedf5190e5 org-export: Update code comments 2012-09-13 21:01:10 +02:00
Nicolas Goaziou fe140488aa org-element: Allow multiple caption keywords
* lisp/org-element.el (org-element-multiple-keywords): Allow multiple
  caption keywords.
* contrib/lisp/org-export.el (org-export-get-caption): New function.
* testing/lisp/test-org-element.el: Add tests.
* testing/lisp/test-org-export.el: Add tests.
2012-09-13 17:33:46 +02:00
Nicolas Goaziou faa2be8d57 org-export: Don't overwrite menus or add redundant entries
* contrib/lisp/org-export.el (org-export-define-backend,
  org-export-define-derived-backend): Don't overwrite menus or add
  redundant entries.
2012-09-09 15:39:28 +02:00
Nicolas Goaziou 113ca8767a org-export: Define new interface for `org-export-dispatch'
* contrib/lisp/org-export.el (org-export-define-backend):
  Add :menu-entry keyword.
(org-export-define-derived-backend): Add :menu-entry
and :sub-menu-entry keywords.
(org-export-dispatch-menu-entries): New variable.
(org-export-dispatch): Define a new interface.
(org-export-dispatch-ui): Rewrite function.
(org-export-dispatch-action): New function.

Every back-end defined through `org-export-define-backend' or
`org-export-define-derived-backend' can specify a menu entry for
`org-export-dispatch'. Navigating the menu is now a two levels
process.
2012-09-09 13:13:57 +02:00
Jambunathan K c276eeebee org-export.el: Revert an erroneous commit, sigh 2012-09-05 03:33:16 +05:30
Jambunathan K 272c5fb74f org-e-freemind.el: Reverted accidental commit 2012-09-05 03:25:50 +05:30
Jambunathan K 8ff4ea03b0 org-export.el (org-export-dispatch): Open ODT files with system app 2012-09-03 19:19:28 +05:30
Nicolas Goaziou 7ce732b294 org-export: Make BIND keywords case insensitive
* contrib/lisp/org-export.el (org-export--install-letbind-maybe): Make
  BIND keywords case insensitive.
* testing/lisp/test-org-export.el: Add test.
2012-09-01 14:21:09 +02:00
Nicolas Goaziou 57da184a5c org-export: Allow in-buffer keywords at any column
* contrib/lisp/org-export.el (org-export--get-inbuffer-options): Allow
  in-buffer keywords at any column.

`org-make-options-regexp' enforces keywords at column 0. This is an
unnecessary restriction, as we can imagine the following Org buffer:

* Export Setup              :noexport:

  #+AUTHOR: Me
  #+DATE: 29/03/2012

* Headline 1

  ...
2012-09-01 13:04:14 +02:00
Nicolas Goaziou 61ad50d758 org-export: Fix #+BIND: keywords evaluation
* contrib/lisp/org-export.el (org-export--install-letbind-maybe): If
  a variable is bound two times in the buffer, be sure to set its
  value to the last bound. Use correct function to confirm binding.
  Allow keyword to start on any column.
* testing/lisp/test-org-export.el: Add tests.
2012-09-01 12:59:57 +02:00
Nicolas Goaziou ea77b2ccb2 org-export: Use new API for macro expansion
* contrib/lisp/org-export.el (org-export-define-backend): Update
  docstring.
(org-export-special-keywords): Remove "MACRO".
(org-export--get-inbuffer-options, org-export--get-buffer-attributes):
Remove internal macro handling.
(org-export-as): Use external tool instead.
(org-export-expand-macro): Remove function.
* contrib/lisp/org-e-ascii.el (org-e-ascii-macro): Remove function.
* contrib/lisp/org-e-groff.el (org-e-groff-macro): Remove function.
* contrib/lisp/org-e-html.el (org-e-html-macro): Remove function.
* contrib/lisp/org-e-latex.el (org-e-latex-macro): Remove function.
* contrib/lisp/org-e-man.el (org-e-man-macro): Remove function.
* contrib/lisp/org-e-odt.el (org-e-odt-macro): Remove function.
* contrib/lisp/org-e-texinfo.el (org-e-texinfo-macro): Remove
  function.
* testing/lisp/test-org-export.el: Remove tests.

Since macros are now expanded before parsing (and produce Org syntax),
back-ends will never see them (unless NO-EXPAND argument from
`org-export-as' is non-nil, which isn't the case for any back-end so
far).
2012-09-01 10:56:00 +02:00
Nicolas Goaziou caf2432c52 org-export: Add an option to toggle export of stat cookies
* contrib/lisp/org-export.el (org-export-with-statistics-cookies): New
  variable.
(org-export-options-alist): Use new variable.
(org-export--skip-p): Handle new option.
* testing/lisp/test-org-export.el: Add test.
2012-08-27 15:27:02 +02:00
Nicolas Goaziou 9f2824852c org-export: Objects in secondary strings can also be ignored
* contrib/lisp/org-export.el (org-export--populate-ignore-list): Move
  into secondary strings when looking for objects to ignore in the
  parse tree.
2012-08-27 15:27:02 +02:00
Nicolas Goaziou 86b1be57b9 org-export: Handle "\-" as a special string
* contrib/lisp/org-export.el (org-export-with-special-strings): Fix
  docstring.
* contrib/lisp/org-e-ascii.el (org-e-ascii-plain-text): Remove soft
  hyphens.
* contrib/lisp/org-e-latex.el (org-e-latex-plain-text): Handle soft
  hyphens.
2012-08-27 14:35:54 +02:00
Nicolas Goaziou 4d789f4c30 org-export: Fix filters returning a nil value
* contrib/lisp/org-export.el (org-export-filter-apply-functions): If
  a filter returns nil, return last non-nil value.
2012-08-27 14:35:54 +02:00
Nicolas Goaziou 61b5e28509 org-export: Flesh out dictionary
* contrib/lisp/org-export.el (org-export-dictionary): Flesh out
  dictionary.
(org-export-translate): Allow for a :default charset in order to
simplify dictionary completion.
2012-08-25 14:07:41 +02:00
Nicolas Goaziou 7e466ea883 org-export: Small clean-up 2012-08-24 10:44:05 +02:00
Nicolas Goaziou 095f9322e5 org-export: Make sure back-end specific filters do not make any back-end check
* contrib/lisp/org-e-ascii.el (org-e-ascii-filter-headline-blank-lines):
  Remove backend check.
* contrib/lisp/org-e-texinfo.el (org-e-texinfo-filter-section-blank-lines):
  Remove backend check.
* contrib/lisp/org-export.el (org-export-define-backend): Update
  docstring accordingly.
2012-08-24 10:41:41 +02:00
Nicolas Goaziou cced6735a7 org-export: Run export hook with current back-end as argument
* contrib/lisp/org-export.el (org-export-as): Run export hook with
  current back-end as argument.
* testing/lisp/test-org-export.el: Update test.
2012-08-24 10:10:44 +02:00
Nicolas Goaziou cc839259a4 org-export: Nil value from a filter means filter will be skipped
* contrib/lisp/org-export.el (org-export-filter-apply-functions): Nil
  value from a filter means filter will be skipped. To ignore the
  current element or object, the filter has to return the empty string
  instead.

This change is done to ease filter writing. When writing
a backend-specific filter (and I guess most are), there's no more need
for the somewhat contrived:

  (if (not (eq backend 'e-latex)) data
    ... filter's job...)

A more straightforward:

  (when (eq backend 'e-latex)
    ... filter's job...)

is now enough.

On the other hand, it is not possible anymore to specify 'ignore as
a filter to ignore every element or object of a given type. To
achieve that goal, one can now write, for example:

  (add-to-list 'org-export-filter-example-block-functions
                 (lambda (value backend info)
                   (when (eq backend 'e-html) "")))

It will ignore every example block in the `e-html' export back-end.
2012-08-24 09:56:48 +02:00