Commit Graph

346 Commits

Author SHA1 Message Date
Brian Carlson af8e3d84ee ox: Provide offset to [+-]n in SRC/EXAMPLE export
* lisp/org-element.el (org-element-example-block-parser): Use cons cell
  for :number-lines specifying offset in addition to type (new/continue).
  ('continue . offset) for :number-lines will add this offset count to
  the last line number. ('new . offset) for :number-lines will reset the
  line number counting starting at offset
(org-element-src-block-parser): same for SRC block as EXAMPLE block

* lisp/ox-html.el (org-html-format-code):
* lisp/ox-latex.el (org-latex-src-block):
* lisp/ox-odt.el (org-odt-format-code):
* lisp/ox.el (org-export-resolve-coderef):
(org-export-get-loc):
(org-export-format-code-default):
* contrib/lisp/ox-groff.el (org-groff-src-block): Use new cons cell
  for :number-lines.

* testing/lisp/test-ox.el  (ert-deftest test-org-export/get-loc): Tests for
changes
(test-org-gen-loc-list): Helper function for `test-org-export/get-loc'.
2016-05-24 21:40:35 +02:00
Rasmus 9a7bf6d649 Merge branch 'maint' 2016-05-22 15:31:27 +02:00
Rasmus d07fafed4a ox-html: Find preamble-spec case-insensitively
* ox-html.el (org-html--build-pre/postamble): Find the spec based on the
  language case-insensitively.

Note that the default org-html-preamble-format and
org-export-default-language are incompatible.
2016-05-22 15:30:11 +02:00
Feng Shu bf93e166be Use dvisvgm to preview latex formulas
* ox-html.el (org-html-with-latex): Add dvisvgm support.
(org-html-with-latex): Add dvisvgm support.
(org-html-format-latex): "ltxpng" -> "ltximg".
(org-html-latex-environment): Add dvisvgm support.
(org-html-latex-fragment): Add dvisvgm support.

* org.el (org-preview-latex-default-process): New variable.
(org-latex-create-formula-image-program): Rename it to `org-preview-latex-default-process'.
(org-latex-preview-ltximg-directory): Rename it to `org-preview-latex-image-directory'.
(org-preview-latex-image-directory): New variable.
(org--format-latex-make-overlay): Add optional image-type, which used to deal with svg.
(org-toggle-latex-fragment): "org-ltxpng" -> "org-ltximg".
(org-format-latex): Add dvisvgm support.
(org-create-formula-image): Big refactor, merge dvipng and imagemagick
backend's feature.  Add dvisvgm feature.
(org-preview-latex-process-alist): Add new variable, which used to set
latex preview processes.
(org-create-formula-image-with-dvipng):
(org-create-formula-image-with-imagemagick): Useless, removed.

* org.texi (@LaTeX{} fragments):
(Previewing @LaTeX{} fragments):
(Math formatting in HTML export):
(Working with @LaTeX{} math snippets): Add dvisvgm information.
2016-05-21 10:50:38 +02:00
Robert Klein 59237bc028 ox-html: Support more programming languages in CSS
* lisp/ox-html.el (org-html-style-default): Add languages.

The standard CSS for HTML export only supported a couple of
programming languages to have a language name "hover" on src
blocks.  This patch adds all languages supported per Org
manual, those from org.el's org-babel-load-languages-alist,
additional language identifiers in ob-*.el and languages
which have a) an emacs mode and b) are supported by the LaTeX
listings package.  Additional a language "conf" is supported
for generic configuraiton files; an emacs mode exists for
this, but for LaTeX listings a language " " has to be faked.
As this patch is for HTML, this is no impediment.

Thanks for reporting the missing support to Tianxian XIONG.
2016-05-10 22:21:21 +02:00
Nicolas Goaziou f07580066e ox-html: Silence byte-compiler 2016-03-30 17:18:47 +02:00
Nicolas Goaziou 3149a01513 Merge branch 'maint' 2016-03-30 17:17:51 +02:00
Nicolas Goaziou cb683e3a56 ox-html: Fix planning info export
* lisp/ox-html.el (org-html-planning): Properly escape angle brackets in
  time-stamps.

Reported-by: Keith Sutton <kesutt@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/105945>
2016-03-30 17:17:07 +02:00
John Kitchin d5b9c74430 ox-html: Add html attributes to special blocks
* lisp/ox-html.el (org-html-special-block): enables #+attr_html and puts
  an id in when the special block is named.
2016-03-30 17:01:12 +02:00
John Kitchin 8f4f7dfd14 ox-html: Add html attributes to quote-block
* lisp/ox-html.el (org-html-quote-block): Enables #+attr_html: and puts
  a id attribute when the block is named into the html element.
2016-03-30 16:38:53 +02:00
John Kitchin 2ce1fc2c0d ox-html: Add id attribute to example-block on html export
* lisp/ox-html.el (org-html-example-block): Add "id" attribute according
  to name.

This allows you to hyperlink to the block.
2016-03-30 16:16:12 +02:00
Nicolas Goaziou 0f512848ea Merge branch 'maint' 2016-03-28 11:07:27 +02:00
Nicolas Goaziou a94147535a ox-html: Fix Usenet links
* lisp/ox-html.el (org-html-link): Properly export Usenet links.

Reported-by: Michael Welle <mwe012008@gmx.net>
<http://permalink.gmane.org/gmane.emacs.orgmode/105915>
2016-03-28 11:06:56 +02:00
Nicolas Goaziou 1795d505e8 ox-html: Fix code comment
* lisp/ox-html.el (org-html-link): Radio-targets are not meant to be
  resolved through cross-referencing.
2016-03-12 23:18:55 +01:00
Nicolas Goaziou e6984bd74b Merge branch 'maint' 2016-02-19 14:29:06 +01:00
Austin Walker 5a193ed485 ox-html.el: Fix TOC export of TODO headlines
* lisp/ox-html.el (org-html--todo): Don't show nil in format string for
  TODO class

Use empty string if :html-todo-kwd-class-prefix is not present.

TINYCHANGE
2016-02-19 14:22:08 +01:00
Kyle Meyer e44524b3b2 Merge branch 'maint' 2016-02-03 23:37:26 -05:00
Kyle Meyer 2fc29a1796 Fix "it's" typos
* lisp/ob-C.el (org-babel-expand-body:cpp):
(org-babel-expand-body:C++):
(org-babel-expand-body:D):
(org-babel-expand-body:C):
(org-babel-C-expand-C++):
(org-babel-C-expand-C):
(org-babel-C-expand-D):
* lisp/ob-exp.el (org-babel-exp-src-block):
* lisp/ob-fortran.el (org-babel-expand-body:fortran):
* testing/org-test.el (org-test-buffer):
Correct "it's" typo in docstring.

* doc/org.texi:
Correct "it's" typos.
2016-02-03 23:33:28 -05:00
Fabrice Popineau 6af83e0aa7 ox-html: Fix org-html-table-row wrt lexical binding
* lisp/ox-html.el (org-html-table-row-open-tag):
(org-html-table-row-close-tag): New variables.
(org-html-table-row-tags): Remove variable.

(org-html-table-row): Use new variables.
2016-02-03 00:10:24 +01:00
Nicolas Goaziou 7148ae780b Merge branch 'maint' 2016-01-31 23:23:13 +01:00
Nicolas Goaziou 48e046047b ox-html: Properly encode links without a description
* lisp/ox-html.el (org-html-link): Encode URI in default description
  when none is provided.

Reported-by: mail@fritzreichwald.de
<http://permalink.gmane.org/gmane.emacs.orgmode/104645>
2016-01-31 23:21:34 +01:00
Kyle Meyer 23ca3fa100 Merge branch 'maint' 2016-01-29 00:28:48 -05:00
Kyle Meyer a4edee4069 org-compat: Update font-lock-ensure alias
* lisp/org-compat.el (org-font-lock-ensure): Add new alias that accepts
  the same number of arguments as font-lock-ensure does.  Use an org-
  prefix.
* lisp/org-clock.el (org-clock-get-clocktable):
* lisp/org.el (org-fontify-like-in-org-mode):
* lisp/ox-html.el (org-html-fontify-code):
* lisp/ox-odt.el (org-odt-do-format-code):
* lisp/ox-org.el (org-org-publish-to-org): Use org-font-lock-ensure.

See Emacs's bug#22399.
2016-01-29 00:28:37 -05:00
Kyle Meyer 6345de2d05 Merge branch 'maint' 2016-01-09 17:43:27 -05:00
Kyle Meyer 6bc48c5f41 Update copyright years 2016-01-09 17:12:03 -05:00
Nicolas Goaziou 54318add34 Change export block syntax
* lisp/org-element.el (org-element-export-block-parser):
(org-element--current-element): Use new syntax for export blocks.
(org-element-block-name-alist): Remove.

* lisp/ox.el (org-export-register-backend):
(org-export-define-derived-backend): Remove :export-block keyword from
back-end's definition.
(org-export-expand-include-keyword): Use new syntax for include
keywords.

* lisp/ox-ascii.el (ascii):
* lisp/ox-beamer.el (beamer):
* lisp/ox-html.el (html):
* lisp/ox-latex.el (latex):
(org-latex-prefer-user-labels):
* lisp/ox-man.el (man):
* lisp/ox-md.el (md):
* lisp/ox-odt.el (odt):
* lisp/ox-texinfo.el (texinfo): Propagate changes to "ox.el".

* lisp/ob-core.el (org-babel-insert-result):
* lisp/ob-haskell.el (org-babel-haskell-export-to-lhs): Use new syntax.

* lisp/org.el (org-structure-template-alist): Use new syntax.
(org-protecting-blocks): Add "export" to protected blocks.  Remove
  back-ends blocks, which are now special blocks.
(org-fontify-meta-lines-and-blocks-1): Fontify correctly new blocks.

* lisp/org-footnote.el (org-footnote-forbidden-blocks):
* lisp/org-list.el (org-list-forbidden-blocks): Add "export" to
  forbidden blocks.  Remove back-ends blocks, which are now special
  blocks.

* contrib/lisp/ox-extra.el: Update comments.

* testing/lisp/test-org-element.el (test-org-element/export-block-parser):
(test-org-element/export-block-interpreter):
* testing/lisp/test-ob.el (test-ob/org-babel-remove-result--results-html):
(test-ob/org-babel-remove-result--results-latex):
* testing/lisp/test-ox.el (test-org-export/expand-include): Update tests.

Export blocks are explicitly marked as such at the syntax level to
disambiguate their parsing from special blocks.  The new syntax is

  #+BEGIN_EXPORT backend
  ...
  #+END_EXPORT

instead of

  #+BEGIN_backend
  ...
  #+END_backend

As a consequence, =INCLUDE= keywords syntax is modified, e.g.,

  #+INCLUDE: "file.org" HTML

becomes

  #+INCLUDE: "file.org" export html
2015-12-20 21:56:27 +01:00
Nicolas Goaziou d01ed5b89b ox-html: Remove spurious # in some links
* lisp/ox-html.el (org-html-link): Remove spurious # introduced in
  8594aed.

Reported-by: Alan Schmitt <alan.schmitt@polytechnique.org>
<http://permalink.gmane.org/gmane.emacs.orgmode/103599>
2015-12-14 23:52:11 +01:00
Nicolas Goaziou 8594aed1d6 ox-html: Always resolve external custom-id links
* lisp/ox-html.el (org-html-link): Always resolve external custom-id links.

Suggested-by: Alan Schmitt <alan.schmitt@polytechnique.org>
<http://permalink.gmane.org/gmane.emacs.orgmode/103552>
2015-12-12 09:57:51 +01:00
Ruben Maher 6b2c38bb71 ox-html.el: Add lang attribute to html tag
* lisp/ox-html.el (org-html-template): Add lang attribute to exported
  html tag.  Some features of the CSS Text Module (Level 3) require this
  attribute to be present (for example, so that the browser knows how to
  hyphenate the text). For more info, please take a look here:
  https://drafts.csswg.org/css-text-3/#languages

TINYCHANGE
2015-12-01 23:34:27 +01:00
Ruben Maher eeee60da70 ox-html.el: Remove superflous whitespace
* lisp/ox-html.el: Remove superfluous whitespace from meta tags, put
  there by `org-html--buld-meta-info' and `org-html--build-head'.
  `org-html-close-tag' already inserts a space, so it is not necessary
  to add another.  Previously these affected tags would look like
  <meta  name="generator" content="Org-mode" />.

TINYCHANGE
2015-12-01 23:34:23 +01:00
Aaron Ecay e4cd3dd22b Remove some home-grown copies of cl-lib functions.
* lisp/org.el (org-count, org-remove-if, org-remove-if-not):
(org-reduce, org-every, org-some): Obsolete, use cl-lib versions
everywhere.
(org-sublist): Reimplement in terms of `cl-subseq'; make obsolete.
2015-11-06 12:50:40 +00:00
Nicolas Goaziou 0198e3955d ox-html: Use lexical binding
* lisp/ox-html.el (org-html-infojs-install-script):
(org-html-format-drawer-function):
(org-html--has-caption-p):
(org-html--make-string):
(org-html-footnote-section):
(org-html--build-mathjax-config):
(org-html--build-pre/postamble):
(org-html--priority):
(org-html--toc-text):
(org-html-bold):
(org-html-center-block):
(org-html-clock):
(org-html-code):
(org-html-dynamic-block):
(org-html-entity):
(org-html-example-block):
(org-html-export-snippet):
(org-html-export-block):
(org-html-fixed-width):
(org-html-footnote-reference):
(org-html-headline):
(org-html-format-headline-default-function):
(org-html-horizontal-rule):
(org-html-inline-src-block):
(org-html-italic):
(org-html-keyword):
(org-html-latex-environment):
(org-html-latex-fragment):
(org-html-line-break):
(org-html-node-property):
(org-html-plain-list):
(org-html-convert-special-strings):
(org-html-planning):
(org-html-property-drawer):
(org-html-quote-block):
(org-html-src-block):
(org-html-statistics-cookie):
(org-html-strike-through):
(org-html-subscript):
(org-html-superscript):
(org-html-table-row):
(org-html-table--table.el-table):
(org-html-target):
(org-html-timestamp):
(org-html-underline):
(org-html-verbatim):
(org-html-verse-block):
(org-html-final-function): Silence byte-compiler.  Refactor `mapc' +
`lambda' into `dolist'.
2015-10-29 18:35:20 +01:00
Kyle Meyer 00dacdcc50 Clean up spacing to pass Emacs's pre-commit check
This is in preparation for syncing with the Emacs repo.
2015-10-04 02:31:29 -04:00
Paul Eggert c86a10b0bc Backport commit 284c470 from Emacs master branch
Backslash cleanup in Elisp source files
284c470ef752967fcd8bae6a450dc138462b1e49
Paul Eggert
Thu Sep 17 16:09:39 2015 -0700
2015-09-21 18:38:39 -04:00
Kyle Meyer 0839dc4322 Protect remaining apostrophes in docstrings
Protect apostrophes not covered by the last backport.  Convert
expressions like '(...)  to \\='(...)  and symbols written as 'name to
`name'.  (In addition to ensuring the correct display, the latter also
improves consistency with many Org docstrings.)

If these aren't protected, Emacs 25 may display them as curved quotes in
the help buffer, depending on the value of text-quoting-style.
2015-09-21 18:38:39 -04:00
Kyle Meyer d77a52a502 Backport quote-related commits from Emacs
These changes are the combination of the commits below (in order
applied).  Unlike other backports, these are applied in one commit
because they are closely related and because some of the later commits
reverse changes in earlier commits.  Changes to message and help quote
display for Emacs 25 seem to be here to stay.  The quote protections are
required to ensure grave accents and apostrophes are displayed as
intended in Emacs 25, and they should not affect earlier versions.

  Quoting fixes in lisp/org
  6cd2629bd1b3ce77d29ac28e29237c94a4197116
  Paul Eggert
  Mon Aug 31 00:29:40 2015 -0700

  More-conservative ‘format’ quote restyling
  fbb5531fa11d13854b274d28ccd329c9b6652cfc
  Paul Eggert
  Sun Aug 23 22:39:06 2015 -0700

  Prefer directed to neutral quotes
  875a5d0ead827d3da32ecbd30e739a29f07bbc87
  Paul Eggert
  Mon Aug 24 23:57:25 2015 -0700

  Escape ` and ' in doc
  19532d147b431a4fe34f088d6de07891c48e2c5c
  Paul Eggert
  Tue Sep 1 18:23:21 2015 -0700

  Fix some more docstring etc. quoting problems
  26bd978d87dfbf9baa115cd961a67d42b416c4bf
  Paul Eggert
  Thu Sep 3 15:32:54 2015 -0700

  Go back to grave quoting in source-code docstrings etc.
  6afef3f6ca2f3009c722b84e249903b7f807b044
  Paul Eggert
  Mon Sep 7 16:09:27 2015 -0700
2015-09-21 18:38:18 -04:00
Nicolas Goaziou 980aef2dfb ox-html: Fix links with ampersands
* lisp/ox-html.el (org-html-link): Escape ampersands and other special
  characters in anchor once and only once.

Reported-by: "Greedwolf DSS" <passchaos@163.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/100797>
2015-09-02 21:30:59 +02:00
Rasmus 6ddde6132b ox-html: Fix center block class
* ox-html.el (org-html-center-block): Correct class.

Reported-by: j_l_domenech@yahoo.com
<http://permalink.gmane.org/gmane.emacs.bugs/105805>
2015-08-26 01:16:46 +02:00
Nicolas Goaziou cf31ea1660 ox-html: Rename `org-html-html5-fancy-p' to `org-html--html5-fancy-p'
* lisp/ox-html.el (org-html--html5-fancy-p): Renamed from
  `org-html-html5-fancy-p'.  Add docstring.
(org-html--wrap-image):
(org-html-template):
(org-html-toc):
(org-html-special-block): Apply renaming.

As an internal function, it should follow the convention of double
hyphens in its name.
2015-08-19 11:07:06 +02:00
Eric Abrahamsen f149060678 Add function to better guard html5 exports
* lisp/ox-html.el (org-html-html5-fancy-p): New function to check
  that we are exporting to HTML5 and that the user has requested
  fancy elements.
  (org-html--wrap-image, org-html-template, org-html-toc)
  (org-html-special-block): Use the new function.
2015-08-18 17:59:01 +02:00
Bastien 55544780e2 ox-html.el (org-html-use-unicode-chars): Delete.
* ox-html.el (org-html-use-unicode-chars): Delete.
(html, org-html-final-function): Update.

* org.texi (Publishing options): Don't mention
`org-html-use-unicode-chars'.

Thanks to Vladimir Alexiev for raising this.
2015-08-16 16:01:57 +02:00
Bastien 0d0d0ad56e Merge branch 'backport-master'
Conflicts:
	lisp/org-table.el
2015-08-05 01:01:46 +02:00
Rasmus af35955781 Fix typo in 6db0b0cd43 2015-08-04 19:19:52 +02:00
Rasmus 6db0b0cd43 ox-html: Respect local values when formatting code
* ox-html.el (org-html-fontify-code): Use local value of
  org-html-htmlize-output-type parent and org-html-htmlize-font-prefix
  parent.

Reported-by: Eric S Fraga <e.fraga@ucl.ac.uk>
<http://permalink.gmane.org/gmane.emacs.orgmode/99450>
2015-08-04 17:55:37 +02:00
Kyle Meyer 6f9184a294 Merge branch 'maint' into backport-master 2015-07-26 23:56:50 -04:00
Paul Eggert 9dcbe163cc Backport commit 9d35bb8 from Emacs master branch
* lisp/org-compat.el (org-number-sequence):
* lisp/org.el (org-remove-highlights-with-change)
(org-structure-template-alist):
* lisp/ox-html.el (org-html-link-org-files-as-html):
Fix minor quoting problems in doc strings, e.g., missing quote,
``x'' where `x' was meant, etc.

Fix minor quoting problems in doc strings
9d35bb8d6518bb913ab08bace2af08963c003177
Paul Eggert
Tue May 19 15:01:16 2015 -0700
2015-07-26 23:29:31 -04:00
Kyle Meyer c115c7b4e8 org-compat: Use different font-lock-ensure alias
* lisp/org-compat.el (org-font-lock-ensure): Remove in favor of
  font-lock-ensure alias from dcbaebc.

Instead of org-font-lock-ensure alias introduced in dcbaebc ("Backport
commit 6711a21 from Emacs master branch", 2014-05-28), use
font-lock-ensure alias added in e6883dd ("org-compat: Provide
compatibility definition for font-lock-ensure", 2014-06-01).
2015-07-26 23:29:14 -04:00
Stefan Monnier d81e6b52b7 Backport commit 6711a21 from Emacs master branch
* lisp/org-compat.el (org-font-lock-ensure): New function.
* lisp/ox-odt.el (org-odt-do-format-code):
* lisp/ox-html.el (org-html-fontify-code):
* lisp/org.el (org-fontify-like-in-org-mode):
* lisp/org-src.el (org-src-font-lock-fontify-block):
* lisp/org-clock.el (org-clock-get-clocktable): Use it.
* lisp/ox-org.el (org-org-publish-to-org):
Use it. Avoid using find-file from Elisp.

6711a21f1125c0047c56eb266eb374c1ec90a967
Stefan Monnier
Wed May 28 23:45:29 2014 -0400
2015-07-26 23:28:25 -04:00
Paul Eggert 72416b82ac Backport commit 7aa506e from Emacs master branch
Spelling fixes
7aa506eed8881788485a9774165454404bac2623
Paul Eggert
Thu Dec 25 18:08:47 2014 -0800
2015-07-26 23:28:25 -04:00
Paul Eggert 217ad4aafb Backport commit 123ddec from Emacs master branch
* doc/org.texi (Dynamic blocks):
* lisp/org-archive.el (org-archive-subtree)
(org-archive-to-archive-sibling):
* lisp/org-clock.el (org-resolve-clocks, org-clock-get-sum-start)
(org-clock-special-range):
* lisp/org-timer.el (org-timer-seconds):
* lisp/org.el (org-read-date-analyze, org-get-cursor-date):
* lisp/ox-html.el (org-html-format-spec):
* lisp/ox-icalendar.el (org-icalendar--vtodo):
Omit unnecessary call to current-time.
* lisp/org.el (org-get-cursor-date):
Don't call current-time twice to get the current time stamp,
as this can lead to inconsistent results.
* lisp/org-compat.el (org-float-time):
Simplify to an alias because time-to-seconds now behaves like float-time
with respect to nil arg.
* lisp/org-clock.el (org-clock-get-table-data): Omit unnecessary, lossy
conversion from floating point to Emacs time and back.
(org-resolve-clocks): Prefer two-argument floor.

Simplify use of current-time and friends.
123ddec7f807f4bd7400bbbe08219afb02269c00
Paul Eggert
Tue Oct 28 18:42:51 2014 -0700
2015-07-26 23:25:11 -04:00