Commit Graph

29 Commits

Author SHA1 Message Date
Bastien Guerry bafd9a42f8 Move EXPERIMENTAL/* into contrib/lisp/ and change org-export.el accordingly. 2012-04-21 16:22:31 +02:00
Nicolas Goaziou 763991fbda org-element: Store keywords in upper cases
* EXPERIMENTAL/org-e-ascii.el (org-e-ascii-keyword): Apply keywords
  case change.
* EXPERIMENTAL/org-e-html.el (org-e-html-keyword): Apply keywords case
  change.
* EXPERIMENTAL/org-e-latex.el (org-e-latex-keyword): Apply keywords
  case change.
* EXPERIMENTAL/org-e-odt.el (org-e-odt-keyword): Apply keywords case change.
* contrib/lisp/org-element.el (org-element-export-block-parser):
  Internally store type in upper cases.
(org-element-keyword-parser): Internally store keyword `:key' property
in upper cases.
(org-element-non-recursive-block-alist,
org-element-affiliated-keywords,
org-element-keyword-translation-alist, org-element-multiple-keywords,
org-element-parsed-keywords, org-element-dual-keywords):
Use uppercased keywords.
(org-element-current-element): Use uppercase for keywords.
(org-element-collect-affiliated-keywords): Store affiliated keywords
in upper cases.
* contrib/lisp/org-export.el (org-export-get-inbuffer-options,
  org-export-collect-tree-properties, org-export-resolve-fuzzy-link):
  Use upper cased keywords.
* testing/lisp/test-org-export.el: Update tests.
2012-03-28 14:27:15 +02: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 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 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 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 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
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 8736d92d0e org-element: org-element-map also checks secondary strings
* 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.
2012-02-20 20:18:29 +01:00
Nicolas Goaziou abaeb42a3a org-e-ascii: Get item number right
* 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.
2012-02-20 17:17:39 +01:00
Nicolas Goaziou f07929f5f1 org-e-ascii: Fix column width with cells containing an object not exported
* EXPERIMENTAL/org-e-ascii.el (org-e-ascii-table):  width may be
  wrong when some object is removed from a cell during export
2012-02-20 16:37:25 +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
Nicolas Goaziou 4d77e6adf6 org-e-ascii: Correctly expand syntax in table cells
* EXPERIMENTAL/org-e-ascii.el (org-e-ascii-table): Translate cells
  into ASCII/Latin1/UTF-8 before building back the table.
2012-02-17 18:54:23 +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 34313edab9 org-e-ascii: Fix tables export with a special column
* EXPERIMENTAL/org-e-ascii.el (org-e-ascii-table--column-width): Do
  not return width of special column, if any.
(org-e-ascii-table--build-hline): Add comments to code.
2012-02-17 14:54:20 +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 dfd7fb23d2 org-e-ascii: Less blank lines in document's title when no author is provided
* EXPERIMENTAL/org-e-ascii.el (org-e-ascii-template--document-title):
  Less blank lines in document's title when no author is provided.
2012-02-12 22:08:44 +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 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 ff19cf5728 org-e-ascii: Enforce a final new line in output
* EXPERIMENTAL/org-e-ascii.el (org-e-ascii-template): Enforce a final
  new line in output.
2012-01-28 14:51:59 +01:00
Nicolas Goaziou bb61ae64a3 org-e-ascii: Make margin for quoted text configurable
* EXPERIMENTAL/org-e-ascii.el (org-e-ascii-quote-margin): New
  variable.
(org-e-ascii--current-text-width, org-e-ascii-quote-block,
org-e-ascii-quote-section, org-e-ascii-verse-block): Use new variable.
2012-01-28 14:51:59 +01:00
Nicolas Goaziou 4d72201b30 org-e-ascii: Insert a title for footnote section
* EXPERIMENTAL/org-e-ascii.el (org-e-ascii-dictionary): Add footnotes
  entry.
(org-e-ascii-template): Insert a title for footnote section.
2012-01-28 14:51:59 +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 711d2ef0e0 org-element: Syntax change for caption
* 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
2012-01-22 21:34:00 +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