Commit Graph

168 Commits

Author SHA1 Message Date
Bastien Guerry ecd0562c5f Fix the master branch.
I started from the 78ec8e commit then cherry-picked and squashed
commits that have been done in master since then, except the bad
commits that overwrote the tree (in master) with the tree in maint.

This commit also bumps the version number to 7.8.06.

The only "fix" that was made between 78ec8e and the previous commit
is e0072f which has been reported to break stuff.
2012-03-19 22:01:29 +01:00
Bastien Guerry 6e306f65ff Fix copyright years in maint. 2012-03-17 16:31:04 +01:00
Bastien Guerry de42649f7b Manually revert maint to e85080.
e85080 is the last correct commit in the maint branch
before releasing 7.8.04.  The 7.8.05 release should be
done from this commit.
2012-03-17 16:28:46 +01:00
Bastien Guerry 73bb18ba37 Manually revert to the Release 7.8.04 tag. 2012-03-17 15:52:24 +01:00
Bastien Guerry fdc20f7792 Fix more copyright years. 2012-03-17 14:39:43 +01:00
Bastien Guerry 6e534f9c61 Manually revert back to commit e85080.
This fixes a wrong merge that should not have happened:
commit 7e903a merges the master branch into the maint branch,
while we really want to keep the maint branch a bugfix-only
branch.

This commit reverts back the maint branch to its state before
merging the master branch.  From there, we will fix remaining
problems with the maint branch (e.g. copyright issues) then
release this maint branch as Org-mode 7.8.05.
2012-03-17 14:34:01 +01:00
Nicolas Goaziou beb024687b org-export: Remove useless INFO argument from `org-export-unravel-code'
* contrib/lisp/org-export.el (org-export-unravel-code): Remove INFO
  argument.  Fix a bug preventing code references to be properly
  recognized.
(org-export-format-code-default): Apply signature change.
(org-export-resolve-coderef): Fix a bug preventing code references to
be properly recognized.
* EXPERIMENTAL/org-e-latex.el (org-e-latex-src-block): Apply signature
  change.
* testing/lisp/test-org-export.el: Add tests.
2012-03-10 20:25:32 +01:00
Nicolas Goaziou c7203b4142 org-export: Change source code handling API
* 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.
2012-03-10 13:42:46 +01:00
Nicolas Goaziou 62a631e236 org-export: Small fix
* contrib/lisp/org-export.el (org-export-get-ordinal): Change signature.
* EXPERIMENTAL/org-e-ascii.el (org-e-ascii--build-caption): Apply
  changes to previous function
2012-03-07 18:02:57 +01:00
Nicolas Goaziou bbbdff9f81 org-export: Predicate in `org-export-get-ordinal' accepts two arguments
* contrib/lisp/org-export.el (org-export-get-ordinal): Predicate in
  `org-export-get-ordinal' accepts two arguments.
2012-03-07 17:18:20 +01:00
Nicolas Goaziou bf609d8844 org-export: Avoid duplicates in `org-export-collect-footnote-definitions'
* 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.
2012-03-04 11:57:16 +01:00
Nicolas Goaziou 933c0fa441 Implement numbered cross-references
* 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.
2012-03-01 14:49:53 +01:00
Nicolas Goaziou 73c5044963 org-export: Add `org-export-headline-numbered-p' predicate
* 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.
2012-02-29 19:05:45 +01:00
Nicolas Goaziou c166bfbb1a org-export: fix bug with nested footnotes in invisible definitions
* contrib/lisp/org-export.el (org-export-collect-footnote-definitions):
  Also collect footnotes in footnote definitions
(org-export-get-footnote-number): Remove unused check.
* testing/contrib/lisp/test-org-export.el: Add test.
2012-02-26 10:57:42 +01:00
Nicolas Goaziou 12c94310a2 org-export: Allow nested footnotes (part 2)
* 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.
2012-02-26 01:38:26 +01:00
Nicolas Goaziou 5313dc9d09 org-export: Allow user to explicitely ignore parts of parse tree
* 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.
2012-02-25 14:55:21 +01:00
Nicolas Goaziou 9f7965a80e org-element: Function mapped through org-element-map accepts only one argument
* 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.
2012-02-25 14:53:35 +01:00
Nicolas Goaziou 3b3936b9a9 org-export: Do not ignore automatically elements with empty output
* contrib/lisp/org-export.el (org-export-data): org-export: Do not
  ignore automatically elements with empty output.
2012-02-25 14:53:34 +01:00
Nicolas Goaziou fc7c80c37e org-export: Minor UI change
* contrib/lisp/org-export.el (org-export-dispatch-ui): Small UI change.
2012-02-24 17:52:43 +01:00
Nicolas Goaziou 94185eac92 org-export: Fix bug with recursive file inclusion and relative paths
* 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.
2012-02-23 21:28:15 +01:00
Nicolas Goaziou 0fa24209cf org-export: Export snippets are not skipped automatically: back-ends decide
* 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.
2012-02-23 18:21:29 +01:00
Nicolas Goaziou 675713c539 org-export: Fix select-tag handling
* 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.
2012-02-23 14:57:16 +01:00
Nicolas Goaziou a87c463818 org-element: Move archived tree handling out of org-element-map
* 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.
2012-02-23 11:24:58 +01:00
Nicolas Goaziou 5e849070be org-export: Add a require to e-odt back-end
* contrib/lisp/org-export.el (org-e-odt): Add a require to e-odt
  back-end.
2012-02-23 09:13:06 +01:00
Nicolas Goaziou 6b0a302ead org-export: Remove call to a phantom function
* contrib/lisp/org-export.el (org-export-get-min-level): Remove call
  to a phantom function.
2012-02-23 08:33:35 +01:00
Nicolas Goaziou a940e3d22c org-export: Fix some small bugs, include tests
* 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.
2012-02-23 00:58:55 +01:00
Nicolas Goaziou c20402fd14 org-export: Fix export to subtree
* contrib/lisp/org-export.el (org-export-as): Subtree option was
  ignored.  Also, narrowing to region and to subtree are exclusive.
2012-02-22 19:29:05 +01:00
Nicolas Goaziou 7f816c6073 org-export: Small changes to UI, allow q to quit
* contrib/lisp/org-export.el (org-export-dispatch): Small changes to
  UI, allow q to quit.
2012-02-22 19:05:07 +01:00
Nicolas Goaziou 40e42b9dca org-export: New function `org-export-get-parent'
* 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.
2012-02-22 18:23:44 +01:00
Nicolas Goaziou 620f1d5181 org-export: Remove `:genealogy', introduce `:ignore-list'
* 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.
2012-02-22 18:19:09 +01:00
Jambunathan K bfd31d7268 org-export: Modify dispatcher to accommodate e-odt backend
* contrib/lisp/org-export.el (org-export-dispatch)
(org-export-dispatch-ui): New entries for ODT backend.
2012-02-22 20:17:25 +05:30
Nicolas Goaziou 60caccc7e9 org-element: Rename accessors
* contrib/lisp/org-element.el (org-element-property,
  org-element-contents): New functions, renamed from, respecively
  `org-element-get-property' and `org-element-get-contents'.
(org-element-link-successor): Small refactoring.
(org-element-drawer-interpreter,
  org-element-dynamic-block-interpreter,
  org-element-footnote-definition-interpreter,
  org-element-headline-interpreter,
  org-element-inlinetask-interpreter, org-element-item-interpreter,
  org-element-special-block-interpreter,
  org-element-babel-call-interpreter,
  org-element-comment-interpreter,
  org-element-comment-block-interpreter,
  org-element-example-block-interpreter,
  org-element-export-block-interpreter,
  org-element-fixed-width-interpreter,
  org-element-keyword-interpreter,
  org-element-latex-environment-interpreter,
  org-element-property-drawer-interpreter,
  org-element-quote-section-interpreter,
  org-element-src-block-interpreter, org-element-table-interpreter,
  org-element-verse-block-interpreter,
  org-element-emphasis-interpreter, org-element-entity-interpreter,
  org-element-export-snippet-interpreter,
  org-element-footnote-reference-interpreter,
  org-element-inline-babel-call-interpreter,
  org-element-inline-src-block-interpreter,
  org-element-latex-fragment-interpreter,
  org-element-link-interpreter, org-element-macro-interpreter,
  org-element-statistics-cookie-interpreter,
  org-element-subscript-interpreter,
  org-element-superscript-interpreter,
  org-element-time-stamp-interpreter,
  org-element-verbatim-interpreter, org-element-map,
  org-element-parse-elements, org-element-parse-objects,
  org-element-interpret-data,
  org-element-interpret--affiliated-keywords,
  org-element-normalize-contents, org-element-swap-A-B,
  org-element-backward, org-element-drag-backward,
  org-element-drag-forward, org-element-forward,
  org-element-mark-element, org-narrow-to-element,
  org-transpose-elements, org-element-unindent-buffer,
  org-element-up): Use new names.
* contrib/lisp/org-export.el (org-export-get-inbuffer-options,
  org-export-use-select-tags-p, org-export-get-min-level,
  org-export-data, org-export-skip-p, org-export-interpret-p,
  org-export-collect-footnote-definitions,
  org-export-footnote-first-reference-p,
  org-export-get-footnote-number, org-export-get-relative-level,
  org-export-last-sibling-p, org-export-inline-image-p,
  org-export-resolve-fuzzy-link, org-export-resolve-id-link,
  org-export-resolve-ref-link, org-export-resolve-coderef,
  org-export-expand-macro, org-export-get-loc,
  org-export-handle-code, org-export-collect-elements,
  org-export-get-genealogy, org-export-get-previous-element): Use new names.
* EXPERIMENTAL/org-e-ascii.el (org-e-ascii--current-text-width,
  org-e-ascii--build-title, org-e-ascii--build-caption,
  org-e-ascii--list-listings, org-e-ascii--list-tables,
  org-e-ascii--unique-links, org-e-ascii--describe-links,
  org-e-ascii-template, org-e-ascii-drawer, org-e-ascii-emphasis,
  org-e-ascii-entity, org-e-ascii-export-snippet,
  org-e-ascii-export-block, org-e-ascii-fixed-width,
  org-e-ascii-headline, org-e-ascii-horizontal-rule,
  org-e-ascii-inline-src-block, org-e-ascii-inlinetask,
  org-e-ascii-item, org-e-ascii-keyword,
  org-e-ascii-latex-environment, org-e-ascii-latex-fragment,
  org-e-ascii-link, org-e-ascii-paragraph, org-e-ascii-quote-section,
  org-e-ascii-statistics-cookie, org-e-ascii-subscript,
  org-e-ascii-superscript, org-e-ascii-table, org-e-ascii-verbatim,
  org-e-ascii-verse-block): Use new names
* EXPERIMENTAL/org-e-latex.el (org-e-latex--wrap-label,
  org-e-latex-drawer, org-e-latex-emphasis, org-e-latex-entity,
  org-e-latex-example-block, org-e-latex-export-snippet,
  org-e-latex-export-block, org-e-latex-fixed-width,
  org-e-latex-footnote-reference, org-e-latex-headline,
  org-e-latex-link--inline-image, org-e-latex-latex-fragment,
  org-e-latex-latex-environment, org-e-latex-keyword,
  org-e-latex-item, org-e-latex-inlinetask,
  org-e-latex-inline-src-block, org-e-latex-special-block,
  org-e-latex-radio-target, org-e-latex-quote-section,
  org-e-latex-plain-list, org-e-latex-src-block,
  org-e-latex-statistics-cookie, org-e-latex-table--format-string,
  org-e-latex-target, org-e-latex-time-stamp, org-e-latex-verbatim):
  Use new names
* EXPERIMENTAL/org-e-publish.el (org-e-publish-collect-index,
  org-e-publish-index-generate-theindex): Use new names.
2012-02-22 13:47:20 +01:00
Nicolas Goaziou 0ff3d47d13 org-element: Introduce a new accessor: `org-element-type'
* EXPERIMENTAL/org-e-ascii.el (org-e-ascii--current-text-width,
  org-e-ascii--build-caption, org-e-ascii--build-title,
  org-e-ascii--describe-links, org-e-ascii-template,
  org-e-ascii-paragraph): Use new accessor
* EXPERIMENTAL/org-e-latex.el (org-e-latex--guess-inputenc): Small
  refactoring.
  (org-e-latex-footnote-reference, org-e-latex-link):  Use new
  accessor.
* contrib/lisp/org-element.el (org-element-type): New function.
  (org-element-map, org-element-parse-elements,
  org-element-interpret-data, org-element-normalize-contents,
  org-element-forward, org-element-unindent-buffer): Use new
  accessor.
* contrib/lisp/org-export.el (org-export-get-inbuffer-options,
  org-export-get-min-level, org-export-data, org-export-skip-p,
  org-export-interpret-p, org-export-expand,
  org-export-expand-include-keyword,
  org-export-prepare-file-contents, org-export-first-sibling-p,
  org-export-resolve-fuzzy-link, org-export-get-ordinal,
  org-export-get-loc, org-export-get-genealogy,
  org-export-get-parent-headline): Use new accessor.
2012-02-22 13:21:13 +01:00
Nicolas Goaziou 0ab12148bc org-export: Don't export tables rows containing parameters for formulas
* contrib/lisp/org-export.el (org-export-clean-table): Don't export
  tables rows containing parameters for formulas.
2012-02-22 09:34:06 +01:00
Nicolas Goaziou a8fcca7526 org-export: Small cosmetic changes to export UI
* contrib/lisp/org-export.el (org-export-dispatch-ui): Small cosmetic
  changes to export UI.
2012-02-20 23:08:18 +01:00
Nicolas Goaziou af2a46a76f org-export: Implement "ref" type links
* 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.
2012-02-19 18:24:22 +01:00
Jambunathan K f1e5dfdbe9 org-export: Put HTML buffers in either nxhtml-mode or nxml-mode
* 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.
2012-02-18 22:39:58 +05:30
Nicolas Goaziou 5fa426bfe2 org-export: Allow to have HTML back-end output in a temporary buffer
* contrib/lisp/org-export.el (org-export-dispatch,
  org-export-dispatch-ui): Add a key to export to a temporary buffer.
2012-02-18 10:11:10 +01:00
Jambunathan K 93ec2c7a50 org-e-html: New HTML exporter - a first attempt
* 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.
2012-02-18 12:25:53 +05:30
Nicolas Goaziou 1cc27e0d3a org-export: allow toggling Babel execution and file inclusion
* 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.
2012-02-17 20:48:57 +01:00
Nicolas Goaziou 4b33c23af8 org-export: Make macros recursives
* 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.
2012-02-17 20:20:38 +01:00
Nicolas Goaziou 6782d6f77b Fix infloop when parsing radio targets
* 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.
2012-02-17 18:46:05 +01:00
Nicolas Goaziou de0c86ffeb org-export: Fix small bug in `org-export-get-genealogy'
* contrib/lisp/org-export.el (org-export-get-genealogy): Return
  `:genealgy' value, not the full communication channel.
2012-02-17 14:20:19 +01:00
Nicolas Goaziou 664271cde7 org-export: New `org-export-get-parent-paragraph' function
* 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.
2012-02-16 20:14:31 +01:00
Nicolas Goaziou 7d3f7f60e0 Make inline image definition more configurable
* 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]]
2012-02-16 20:14:31 +01:00
Nicolas Goaziou 432c3d60c6 Implement a cleaner way to install back-end specific filters in new exporter
* 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.
2012-02-13 13:51:22 +01:00
Nicolas Goaziou b5082974c8 Publishing system compatible with new export engine
* contrib/lisp/org-e-publish.el: New file.
* contrib/lisp/org-export.el (org-export-dispatch,
  org-export-dispatch-ui): Install publishing commands into dispatcher.
2012-02-12 23:00:33 +01:00
Nicolas Goaziou 862fc8f479 org-export: Small documentation and indentation changes 2012-02-12 21:37:02 +01:00
Nicolas Goaziou 6bde2dfd1a org-export: Internal modification to in-buffer options retrieval
* 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.
2012-02-12 21:33:05 +01:00
Nicolas Goaziou be43806794 org-export: Allow access to input file's full path in communication channel
* contrib/lisp/org-export.el (org-export-collect-options): Remove
  useless argument.
(org-export-initial-options): Add an `:input-file' property in
communication channel.
2012-02-06 12:26:01 +01:00
Nicolas Goaziou 223b618393 org-export: Fix bug when a macro returns a nil value
* 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.
2012-02-05 18:04:55 +01:00
Nicolas Goaziou 176b959c4f Handling of file inclusion through keywords is done before export
* 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.
2012-02-05 12:57:50 +01:00
Nicolas Goaziou d2fbf45c82 org-export: Fix docstrings 2012-02-04 15:32:03 +01:00
Nicolas Goaziou c8d9f1438f Fix bugs related to includes files in new export system 2012-02-04 12:39:31 +01:00
Nicolas Goaziou 42c96c4c26 org-export: Filters now require a third argument: the communication channel
* EXPERIMENTAL/org-e-ascii.el (org-e-ascii-filter-headline-blank-lines):
  Apply signature change.
* contrib/lisp/org-export.el (org-export-filter-apply-functions): Call
  filter with the info channel as the third argument.
(org-export-data): Apply signature change
(org-export-filter-parse-tree-functions,
org-export-filter-final-output-functions,
org-export-filter-plain-text-functions,
org-export-filter-center-block-functions,
org-export-filter-drawer-functions,
org-export-filter-dynamic-block-functions,
org-export-filter-headline-functions,
org-export-filter-inlinetask-functions,
org-export-filter-plain-list-functions,
org-export-filter-item-functions, org-export-filter-comment-functions,
org-export-filter-comment-block-functions,
org-export-filter-example-block-functions,
org-export-filter-export-block-functions,
org-export-filter-fixed-width-functions,
org-export-filter-footnote-definition-functions,
org-export-filter-horizontal-rule-functions,
org-export-filter-keyword-functions,
org-export-filter-latex-environment-functions,
org-export-filter-babel-call-functions,
org-export-filter-paragraph-functions,
org-export-filter-property-drawer-functions,
org-export-filter-quote-block-functions,
org-export-filter-quote-section-functions,
org-export-filter-section-functions,
org-export-filter-special-block-functions,
org-export-filter-src-block-functions,
org-export-filter-table-functions,
org-export-filter-verse-block-functions,
org-export-filter-emphasis-functions,
org-export-filter-entity-functions,
org-export-filter-export-snippet-functions,
org-export-filter-footnote-reference-functions,
org-export-filter-inline-babel-call-functions,
org-export-filter-inline-src-block-functions,
org-export-filter-latex-fragment-functions,
org-export-filter-line-break-functions,
org-export-filter-link-functions, org-export-filter-macro-functions,
org-export-filter-radio-target-functions,
org-export-filter-statistics-cookie-functions,
org-export-filter-subscript-functions,
org-export-filter-superscript-functions,
org-export-filter-target-functions,
org-export-filter-time-stamp-functions,
org-export-filter-verbatim-functions): Update docstring.
2012-02-04 12:20:49 +01:00
Nicolas Goaziou 4b201ab66d org-export: Fix error when exporting a buffer with a code block
* contrib/lisp/org-export.el (org-export-as): Set a default value for
  org-current-export-file.
2012-02-03 17:56:51 +01:00
Nicolas Goaziou efc10c9286 org-export: Fix bug preveting low level headlines to close properly in e-latex
* 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.
2012-02-02 20:29:33 +01:00
Nicolas Goaziou d9970d1bd9 Implement limited headine numbering for e-latex and e-ascii back-ends
* contrib/lisp/org-export.el (org-export-with-section-numbers): Modify
  doc-string to document the changes.
* EXPERIMENTAL/org-e-ascii.el (org-e-ascii--build-title): Implement
  limited headline numbering.
* EXPERIMENTAL/org-e-latex.el (org-e-latex-template): Implement
  limited headline numbering.
2012-01-27 14:49:32 +01:00
Nicolas Goaziou 10b06ae53c org-export: Fix bug with false-positive inline tasks
* contrib/lisp/org-export.el (org-export-with-current-buffer-copy):
  Fix bug with false-positive inline tasks.
2012-01-23 22:41:00 +01:00
Nicolas Goaziou a47713717b org-export: Add function to retrieve next element/object in parse tree
* contrib/lisp/org-export.el (org-export-get-next-element): New function.
2012-01-23 22:15:39 +01:00
Nicolas Goaziou d41b9803e2 org-export: Do not export subtree titles as-is
* contrib/lisp/org-export.el (org-export-get-subtree-options):
  Interpret subtree title as a secondary string, not as a simple string.
2012-01-22 14:27:51 +01:00
Nicolas Goaziou f694c3d996 org-export: Fix some errors and corner cases with macros
* 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.
2012-01-22 10:37:28 +01:00
Nicolas Goaziou fc93b6f340 org-export: Ask user for a file name when exporting from temporary buffer
* contrib/lisp/org-export.el (org-export-output-file-name): Ask user
  for a file name when exporting from temporary buffer.
2012-01-21 22:58:23 +01:00
Nicolas Goaziou 58b509c091 ASCII back-end for new export engine
* EXPERIMENTAL/org-e-ascii.el: New file.
* contrib/lisp/org-export.el (org-export-dispatch): Reference E-ASCII
  back-end in dispatcher.
2012-01-21 20:40:15 +01:00
Nicolas Goaziou f86de3d233 org-export: Export standard drawers by default
* contrib/lisp/org-export.el (org-export-with-drawers): Export
  standard drawers by default.
2012-01-21 20:16:33 +01:00
Nicolas Goaziou a5766a98d5 org-export: Fix option item for drawers
* contrib/lisp/org-export.el (org-export-option-alist): Use "d"
  instead of "drawer".
2012-01-21 20:04:51 +01:00
Nicolas Goaziou 76f249b4f3 org-export: Filters can only be list of functions
* contrib/lisp/org-export.el
  (org-export-filter-center-block-functions,
  org-export-filter-drawer-functions,
  org-export-filter-dynamic-block-functions,
  org-export-filter-headline-functions,
  org-export-filter-inlinetask-functions,
  org-export-filter-plain-list-functions,
  org-export-filter-item-functions,
  org-export-filter-comment-functions,
  org-export-filter-comment-block-functions,
  org-export-filter-example-block-functions,
  org-export-filter-export-block-functions,
  org-export-filter-fixed-width-functions,
  org-export-filter-footnote-definition-functions,
  org-export-filter-horizontal-rule-functions,
  org-export-filter-keyword-functions,
  org-export-filter-latex-environment-functions,
  org-export-filter-babel-call-functions,
  org-export-filter-paragraph-functions,
  org-export-filter-property-drawer-functions,
  org-export-filter-quote-block-functions,
  org-export-filter-quote-section-functions,
  org-export-filter-section-functions,
  org-export-filter-special-block-functions,
  org-export-filter-src-block-functions,
  org-export-filter-table-functions,
  org-export-filter-verse-block-functions,
  org-export-filter-emphasis-functions,
  org-export-filter-entity-functions,
  org-export-filter-export-snippet-functions,
  org-export-filter-footnote-reference-functions,
  org-export-filter-inline-babel-call-functions,
  org-export-filter-inline-src-block-functions,
  org-export-filter-latex-fragment-functions,
  org-export-filter-line-break-functions,
  org-export-filter-link-functions, org-export-filter-macro-functions,
  org-export-filter-radio-target-functions,
  org-export-filter-statistics-cookie-functions,
  org-export-filter-subscript-functions,
  org-export-filter-superscript-functions,
  org-export-filter-target-functions,
  org-export-filter-time-stamp-functions,
  org-export-filter-verbatim-functions): Only allow list of functions.
2012-01-21 15:29:25 +01:00
Nicolas Goaziou 5f81b563e0 org-export: Implement access to filters through communication channel
* 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.
2012-01-21 15:23:49 +01:00
Nicolas Goaziou e760c0c1f2 org-export: Fix code typos 2012-01-20 20:27:04 +01:00
Nicolas Goaziou b6610f8609 org-export: Change signature of collect functions
* 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.
2012-01-20 20:12:30 +01:00
Nicolas Goaziou 3dc734eaf2 org-export: Correctly handle predicate in `org-export-get-ordinal'
* 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.
2012-01-20 20:12:30 +01:00
Nicolas Goaziou 6c9c6eff05 org-export: Fix docstrings 2012-01-19 17:14:22 +01:00
Nicolas Goaziou c12246931f org-export: Add a function to resolve id or custom-id links
* contrib/lisp/org-export.el (org-export-resolve-id-link): New function.
2012-01-19 17:07:18 +01:00
Nicolas Goaziou 46ff3b7a56 org-export: Remove :point-max property
* contrib/lisp/org-export.el (org-export-last-sibling-p): Make use
  of :genealogy property instead.
(org-export-get-point-max): Removed function.
(org-export-collect-tree-properties): Remove :point-max property.
2012-01-18 23:45:02 +01:00
Nicolas Goaziou 3c4a0795df Fix some docstrings 2012-01-17 21:06:30 +01:00
Nicolas Goaziou ecfb12de19 New interactive export functions for 'e-latex back-end
* 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.
2012-01-17 20:27:38 +01:00
Nicolas Goaziou 418f63c8b1 org-export: Externalize output file name retrieval
* 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.
2012-01-17 19:14:14 +01:00
Nicolas Goaziou e270792bd8 org-export: Fix regression in headline numbering
* contrib/lisp/org-export.el (org-export-collect-tree-properties):
  Ensure `:headline-offset' is filled before `:headline-numbering'
  since the latter depends on the former.
(org-export-collect-headline-numbering): Use headline elements as keys
  in the returned alist, instead of just beginning numbers.
(org-export-get-headline-number): Apply key change.
2012-01-16 00:36:26 +01:00
Nicolas Goaziou 5e970e407a org-export: Add a new predicate to test if an headline is low level
* contrib/lisp/org-export.el (org-export-low-level-p): New function.
* EXPERIMENTAL/org-e-latex.el (org-e-latex-headline): Make use of new function.
2012-01-15 18:40:40 +01:00
Nicolas Goaziou b03ec00a0e org-export: Change output from org-export-resolve-fuzzy-link
* contrib/lisp/org-export.el (org-export-resolve-fuzzy-link): Now
  return the full object (for a target) or element (for an headline)
  when a match is found.  Also rewrite internals so it doesn't rely
  on :headline-alist.
(org-export-collect-tree-properties): Remove :headline-alist property
  from communication channel, since `org-export-resolve-fuzzy-link'
  doesn't use it anymore. Also store full target objects
  in :target-list property, not only raw names. Fix an argument name
  mismatch, too.

Previous version of org-export-resolve-fuzzy-link returned beginning
position as the identifier for the headline found, which is pretty
weak when files are included in the parsed buffer.
2012-01-14 01:02:07 +01:00
Nicolas Goaziou 5b407eaabf org-export: Add another way to handle source code
* contrib/lisp/org-export.el (org-export-handle-code): Allow to delay
  processing of source code by storing line numbers and references in
  text properties attached it.
2012-01-12 20:29:25 +01:00
Nicolas Goaziou 57f51dce5d org-export: Default title doesn't overwrite a blank #+title keyword
* contrib/lisp/org-export.el (org-export-collect-options): Default
  title is retrieved before in-buffer settings are read.  Also, be
  more careful about indirect buffers.
2012-01-12 17:53:47 +01:00
Nicolas Goaziou 886154898c org-export: Prevent footnotes definitons from being enclosed with a section
* contrib/lisp/org-export.el (org-export-initial-options): Prevent
  footnotes definitons from being enclosed with a section.
2012-01-12 12:43:30 +01:00
Nicolas Goaziou a3e4459bee org-export: Properly reset LOC count when encountering a "-n" switch
* contrib/lisp/org-export.el (org-export-get-loc): Properly reset LOC
  count when encountering a "-n" switch
2012-01-11 18:05:51 +01:00
Nicolas Goaziou 096ffd571c org-element: White space fixing and trivial refactoring 2012-01-11 16:52:08 +01:00
Nicolas Goaziou 6951f9af15 org-export: Remove useless test
* contrib/lisp/org-export.el (org-export-get-previous-element): Remove
  useless test.
2012-01-11 16:52:08 +01:00
Nicolas Goaziou b73a8d6d82 Removal of persistent properties (:total-loc, :code-refs) in export engine
* contrib/lisp/org-element.el (org-element-map): Remove use of
  `org-export-update-info'.
* contrib/lisp/org-export.el (org-export-persistent-properties,
org-export-persistent-properties-list): Remove variables
(org-export-collect-tree-properties): Rename from
  `org-export-initialize-persistent-properties'.
(org-export-data): Get rid of `org-export-update-info' calls.
(org-export-as): Use new `org-export-collect-tree-properties' name.
(org-export-resolve-coderef, org-export-get-loc): New functions.
(org-export-handle-code): Use new functions instead of removed
  properties.  Reformat code.  Change signature.
2012-01-11 16:52:08 +01:00
Nicolas Goaziou acc6fa3a44 org-export: New function to retrieve previous element and object
* contrib/lisp/org-export.el (org-export-first-sibling-p,
  org-export-data): Apply changes.
(org-export-get-previous-element): New function.
2012-01-11 16:52:08 +01:00
Nicolas Goaziou bc22518812 org-export: Remove :previous-element :previous-object properties
* contrib/lisp/org-export.el (org-export-set-property):
2012-01-11 16:52:07 +01:00
Nicolas Goaziou 25ab746fc9 org-export: Add a filter for new section element
* contrib/lisp/org-export.el (org-export-filter-section-functions):
  New variable.
2012-01-08 12:50:29 +01:00
Nicolas Goaziou ced1878fe4 org-export: Remove `:footnote-seen-labels' persistent property altogether
* contrib/lisp/org-export.el (org-export-update-info): No longer need
to keep it updated.
(org-export-collect-footnote-definitions,
org-export-footnote-first-reference-p): Get rid of dependency on the
removed property.
2012-01-08 02:06:34 +01:00
Nicolas Goaziou f4d8a55282 org-export: Code typo
* contrib/lisp/org-export.el (org-export-get-parent-headline): Code typo.
2012-01-08 00:22:37 +01:00
Nicolas Goaziou 5ef692030f org-export: Fix small bug
* contrib/lisp/org-export.el (org-export-table-format-info): Fix
  confusion between "\" which means nothing in special columns, and
  "/".
2012-01-07 18:33:06 +01:00
Nicolas Goaziou a9f9db68c1 org-export: Fix information returned from table analysis
* contrib/lisp/org-export.el (org-export-table-format-info): Now
  `:width' is properly retrieved with cookies where alignement is
  missing (i.e. "<6>").  Also `:row-groups' contains groups of
  standard lines only (colgroups and width lines are skipped).
2012-01-07 18:12:07 +01:00
Nicolas Goaziou 50213d28cb org-export: Improve `:genealogy' property in communication channel
* contrib/lisp/org-export.el (org-export-update-info): `:genealogy' is
  now a full flat list of objects and elements containing current
  object or element.  Thus, `:parent-properties' and
  `:inherited-properties' are now obsolete, and removed.
(org-export-data): Apply change to `:genealogy' property.
(org-export-get-parent-headline): New function to fullfil one common
  need.
(org-export-last-sibling-p, org-export-included-file): Make use of the
  new function.
2012-01-07 14:33:48 +01:00
Nicolas Goaziou aeb1ee1c66 contrib/lisp/org-export: Add a dispatcher for new export engine
* contrib/lisp/org-export.el (org-export-initial-scope,
  org-export-show-temporary-export-buffer,
  org-export-dispatch-use-expert-ui): New variables.
(org-export-dispatch, org-export-dispatch-ui): New functions.
2012-01-06 16:04:13 +01:00
Nicolas Goaziou 427327a94e contrib/lisp/org-export: Possibly add transcoded string to kill ring
* contrib/lisp/org-export.el (org-export-copy-to-kill-ring): New
  variable.
(org-export-as): Make use of new variable.
2012-01-05 22:21:57 +01:00
Nicolas Goaziou 9d47c4f23d contrib/lisp/org-export: Customize coding system for export to file
* contrib/lisp/org-export.el (org-export-coding-system): New variable.
(org-export-to-file): Use new variable.
2012-01-05 20:15:05 +01:00
Nicolas Goaziou a496c3af47 contrib/lisp/org-export: Fix subtree export
* contrib/lisp/org-export.el (org-export-get-subtree-options):
  Correctly get `:title: from headline when no "EXPORT_TITLE" property
  is defined.  Also assume point is at subtree beginning.
(org-export-as): Fix subtree parsing.  The subtree starts at point or
  at first heading above.  Contents do not include the first headline.
2012-01-05 20:15:05 +01:00
Nicolas Goaziou 3ada986ba3 contrib/lisp/org-export: Make export to file compatible with org-publish
* contrib/lisp/org-export.el (org-export-to-file): Automatically
  retrieve output file name.  Also add a PUB-DIR optional argument.
2012-01-05 20:15:05 +01:00