Commit Graph

515 Commits

Author SHA1 Message Date
Bastien 832b3951e8 Merge branch 'maint' 2021-05-03 19:11:47 +02:00
Mingkai Dong dfdd5cd0cd lisp/ox-html.el: Finish the headline numbering part by a full stop
* lisp/ox-html.el (org-html-headline): Finish the numbering part
with a full stop, to be consistent with the TOC numbers.

TINYCHANGE

Link: https://orgmode.org/list/2F46C11A-B2CD-445C-A811-CB05A043FE46@dong.mk
2021-05-03 19:10:52 +02:00
Bastien Guerry bb24248b82 lisp/ox-html.el: Set `org-html-head-include-scripts' to nil
* lisp/ox-html.el (org-html-scripts): Enhance docstring.
(org-html-head-include-scripts): Default to nil and enhance docstring.

Link: https://orgmode.org/list/498dbe2e-0cd2-c81e-7960-4a26c566a1f7@memebeam.org/
2021-05-01 11:25:51 +02:00
Anthony Carrico dcd7b576b7 lisp/ox-html.el (org-html-scripts): Small refactoring
* lisp/ox-html.el (org-html-scripts): Small refactoring.

This replays the Javascript refactoring of commit 471054136.

Link: https://orgmode.org/list/498dbe2e-0cd2-c81e-7960-4a26c566a1f7@memebeam.org/
2021-05-01 11:12:51 +02:00
Anthony Carrico 7c9bf397b5 lisp/ox-html.el (org-html-scripts): Small refactoring
* lisp/ox-html.el (org-html-scripts): Small refactoring.

This replays the Javascript refactoring of commit 471054136.

Link: https://orgmode.org/list/498dbe2e-0cd2-c81e-7960-4a26c566a1f7@memebeam.org/
2021-05-01 11:10:17 +02:00
Bastien Guerry 0a689bf6c5 lisp/ox-html.el: Add TEC as the maintainer
* lisp/ox-html.el: Add TEC as the maintainer.
2021-05-01 10:26:06 +02:00
Kyle Meyer d63dd37e78 Merge branch 'maint' 2021-05-01 00:40:00 -04:00
Pablo Barraza Cornejo 390063d8df ox-html.el/inline-image export: Fix caption numbering
* lisp/ox-html.el (org-html-standalone-image-p): Remove quote which
causes `org-html-standalone-image-p' to not check if
`org-html-standalone-image-predicate' is fbound and see if it's
initialized.

TINYCHANGE
2021-05-01 00:38:39 -04:00
Bastien Guerry f2bedc8881 lisp/ox-html.el: Remove type="text/javascript"
* lisp/ox-html.el (org-html-scripts, org-html-infojs-template)
(org-html-mathjax-template): Remove type="text/javascript".

Reported-by: TEC <tecosaur@gmail.com>
Link: https://orgmode.org/list/874kkkxqma.fsf@gmail.com/
2021-04-30 10:20:11 +02:00
TEC 2a1b0d8ae0 ox-html.el: add lang label to authinfo src blocks
* lisp/ox-html.el (org-html-style-default): `authinfo-mode' is defined
in Emacs 27. As such, in the CSS add an "Authinfo" lang label to
authinfo src blocks.
2021-04-28 08:27:32 +02:00
Bastien Guerry a51c0f22b8 ox-html.el (org-html-scripts, org-html-style-default): Use defcustom
* ox-html.el (org-html-scripts, org-html-style-default): Turn
into configurable options.
2021-04-28 08:25:28 +02:00
TEC 70c4903c9f lisp/ox-html.el: Enhance `org-html-style-default'
* lisp/ox-html.el (org-html-style-default): Enhance.
2021-04-28 08:21:04 +02:00
TEC 00cd6de31b ox-html.el: Limit maximum content width and center
* lisp/ox-html.el (org-html-style-default): Improve appearance and
legibility on large screens buy centering and limiting the content
width to the upper end of advised line width, ~140 characters.
2021-04-28 08:17:13 +02:00
TEC ce04ec0e55 ox-html.el: remove CDATA strings
* lisp/ox-html.el (org-html-scripts, org-html-style-default)
(org-html-infojs-template): Remove CDATA strings, now obsolete.

See https://developer.mozilla.org/en-US/docs/Web/API/CDATASection#specifications
2021-04-28 08:15:45 +02:00
Bastien Guerry 97a2022382 Merge branch 'maint' 2021-04-26 14:24:03 +02:00
Bastien Guerry 29d21ea628 Revert "ox-html.el: Use classList and put in the public domain"
This reverts commit 4710541365.
2021-04-26 14:23:43 +02:00
Sameer Rahmani 4efab7681e ox-html.el: Add HTML_CONTENT_CLASS to support css classes in content tag
* lisp/ox-html.el (org-html-template): Added the support for a CSS
class name to the content tag which wraps the entire content. The CSS
class name can be set via in buffer HTML_CONTENT_CLASS property or
:html-content-class for org publish.

TINYCHANGE
2021-04-26 10:49:24 +02:00
TEC d96e897579 ox-html: Use <img> tags for svgs, not <object>
* lisp/ox-html.el (org-html--format-image, org-html--svg-image): Remove
special treatment of SVGs with <object>, and just use <img>.  This used
to be poorly supported, but since Firefox 4 / Chrome 28 / Safari 9 this
is no longer a concern (https://caniuse.com/svg-img) and the last
browser release that didn't support SVG images was in 2010 (SVG data
URIs took until 2015 to be fully supported, but this is a lesser
concern).
2021-04-26 09:54:13 +02:00
Kyle Meyer 68db6fc064 Merge branch 'maint' 2021-03-25 00:53:11 -04:00
Kyle Meyer 478929ae61 ox-html: Fix org-html-format-drawer-function's docstring
* lisp/ox-html.el (org-html-format-drawer-function): Drop leftover
text from when an example used to be included.

adcebf38f (Fix errors reported by cus-test.el, 2013-11-14) dropped the
example but left the leading part.

Reported-by: Jean-Baptiste Mazon <jmazon@gmail.com>
Ref: https://orgmode.org/list/0e5569e6-15a7-d4c4-0558-8b0ef96a515c@gmail.com
2021-03-24 22:45:22 -04:00
Stefan Kangas 2e1c984153 Prefer HTTPS to HTTP in most links 2021-03-21 15:21:22 -04:00
Jay Kamat a9f38b1c22 ox-html: Add webp as an inline image format
* lisp/ox-html.el (org-html-inline-image-rules): Add webp as an inline
  image format

Webp is an image format introduced in 2010, which now has widespread
support in browsers. ox-html can inline webp images identically to how
it does already for other image formats.

[km: updated package-version keyword and added NEWS entry]

Signed-off-by: Jay Kamat <jaygkamat@gmail.com>
2021-03-19 01:11:00 -04:00
TEC a8df7670c8 lisp/ox-html.el: make html meta tags customizable
* lisp/ox-html.el (org-html-meta-tags): Introduce this as a new option
which can be modified to set the meta tags added in HTML exports.
(org-html--build-meta-info): Make use of `org-html-meta-tags' instead of
hardcoded meta tags.  This is leveraging the earlier restructuring of
`org-html--build-meta-info' into a much DRYer form, such that this
modification has a negligible impact on complexity and readability.
2021-01-20 22:27:02 -05:00
TEC f4b9f98088 lisp/ox-html.el: make html meta tag builder nicer
* lisp/ox-html.el (org-html--build-meta-info): Multi-line repeated
structure extracted to new function `org-html--build-meta-entry'.
The keyword value formatting is changed from `org-export-data' to
`org-html-encode-plain-text' to avoid potentially nesting HTML tags in
meta tags and the <title> element, which would violate W3C.
2021-01-20 22:02:46 -05:00
Kyle Meyer 99eafe3787 Update copyright year to 2021 2021-01-01 14:59:01 -05:00
Fatih Aydin 5ee39c3524 ox-html: Add margin to fix overflow visibility problem
* lisp/ox-html.el (org-html-style-default): Add the margin-top
property to pre.src:hover:before so that the programming language is
fully visible.

TINYCHANGE
2020-12-16 00:43:39 -05:00
Nicolas Goaziou b79fef1da7 html: Improve consistency on internal anchors naming scheme
* lisp/ox-html.el (org-html-prefer-user-labels): New variable.
(org-html--reference): New function.
(org-html--format-toc-headline):
(org-html-list-of-listings):
(org-html-list-of-tables):
(org-html-example-block):
(org-html-headline):
(org-html-inline-src-block):
(org-html-latex-environment):
(org-html-link):
(org-html-paragraph):
(org-html-quote-block):
(org-html-radio-target):
(org-html-special-block):
(org-html-src-block):
(org-html-table):
(org-html-target): Use new function.
2020-09-09 10:23:28 +02:00
Bastien 9ad3606bf3 Use `org-preview-latex-image-directory' instead of hardcoding
* lisp/ox-odt.el (org-odt--translate-latex-fragments):
* lisp/ox-html.el (org-html--format-image): Use
`org-preview-latex-image-directory' instead of hardcoding the
directory name.

See <https://orgmode.org/list/87a70v9jan.fsf@ucl.ac.uk>

Reported-by: Eric S Fraga <e.fraga@ucl.ac.uk>
2020-09-05 10:41:36 +02:00
Anthony Carrico 4710541365 ox-html.el: Use classList and put in the public domain
* lisp/ox-html.el (org-html-scripts): Fix a potential bug by using
the classList within the Javascript code, and put this new version
of the code in the public domain.

See <https://orgmode.org/list/20200617002335.l4lg3slfxm74vx3h@silver>

TINYCHANGE
2020-09-05 10:02:10 +02:00
Bastien Guerry 399867388e Merge branch 'maint' 2020-09-04 12:42:11 +02:00
Bastien Guerry fd460ea468 ox-html.el: Fix overflow css for pre.src HTML tag
* lisp/ox-html.el (org-html-style-default): Fix overflow css
for pre.src HTML tag.

See <https://orgmode.org/list/CAPRwMaYiWVRLB=oTvQv=1JDNdUPxiYMow8MYdqj1sh_udfhUEw@mail.gmail.com>
2020-09-04 12:41:21 +02:00
Nicolas Goaziou b76ed658f1 ox-html: Remove useless translator
* lisp/ox-html.el (html): Remove `footnote-definition' translator
since 1) it does not exist and 2) footnote definitions are translated
as part of of the inner template.
2020-06-23 15:51:06 +02:00
Pierre Téchoueyres c631afd358 ox-html.el: Fix read-only error when export src block
When the type of src block involve an read-only buffer (ex:
compilation mode) avoid to setup the temp buffer as read-only and
error when processing it.

* lisp/ox-html.el (org-html-fontify-code): Set `inhibit-read-only' to
avoid read-only temp buffer.
2020-06-05 00:31:23 -04:00
Nicolas Goaziou 12275cc9fe ox-html: Fix URI for LaTeX fragments
* lisp/ox-html.el (org-html-latex-environment):
(org-html-latex-fragment): Use `org-export-file-uri' to write proper
URI.

Reported-by: bpanthi <bpanthi977@gmail.com>
<http://lists.gnu.org/r/emacs-orgmode/2020-05/msg00271.html>
2020-05-16 19:28:59 +02:00
Brian Powell bc90264ac6 ox-html: Add customizable format string for equations
* lisp/ox-html.el (org-html-equation-reference-format): New variable.
* doc/org-manual.org update to reference new variable
2020-04-21 19:44:03 +02:00
Kyle Meyer 852af41bd9 ox-html: Update a :package-version value
* lisp/ox-html.el (org-html-infojs-template): Update :package-version
for recent default value change, and drop :version in favor of mapping
via customize-package-emacs-version-alist.
2020-03-15 22:07:52 -04:00
Arne Babenhauserheide 661696036f ox-html: escape & in license magnets
* lisp/ox-html.el (org-html-scripts):
(org-html-infojs-template): & escaped as &amp;

This fixes xhtml validation while still being recognized by LibreJS as
valid license.

Reported-by: Colin Baxter <m43cap@yandex.com>
<87eett7bql.fsf@yandex.com>

TINYCHANGE
2020-03-15 20:06:35 -04:00
Nicolas Goaziou b6e3e8f2b6 ox-html: Add missing :package-version keyword
* lisp/ox-html.el (org-html-validation-link): Default value changed,
so update :package-version keyword.
2020-03-15 17:02:01 +01:00
Augustin Fabre 472a171b94 ox-html: Use HTTPS for link to W3 HTML validator
* lisp/ox-html.el (org-html-validation-link): Use HTTPS link to W3
HTML validator.

TINYCHANGE
2020-03-15 16:58:13 +01:00
Matt Huszagh 860cfe7f13 Add an option to convert LaTeX fragments to HTML
* lisp/org.el (org-latex-to-html-convert-command): New option to
convert a LaTeX fragment directly into HTML.
(org-format-latex): Use the new option.
(org-format-latex-as-html): Do the conversion and return HTML.
* lisp/ox-html.el (org-html-with-latex): Document the 'html symbol.
(org-html-format-latex): This custom HTML conversion, like MathJax,
doesn't require preprocessing.
(org-html-latex-fragment): Use the new option.

This allows you to set a custom command
`org-latex-to-html-convert-command' that will take as input a LaTeX
fragment and use it to generate HTML for export.  This is very
open-ended in the sense that you can use any shell-command you
want.  This has been added in order to use latexml, but you could
use any other tool that generates HTML output text.
2020-02-24 11:16:01 +01:00
Nicolas Goaziou 42ec2462a0 Do not leak "attachment" links
* lisp/ol.el (org-link-open): Remove "attachment" for special cases.
* lisp/org-attach.el (org-attach-expand-links):
(org-attach-follow): New functions.
(org-attach-link-expand): Remove function.
* lisp/org-element.el (org-element-link-parser):
* lisp/ox-ascii.el (org-ascii-link):
* lisp/ox-html.el (org-html-link):
* lisp/ox-latex.el (org-latex--inline-image):
(org-latex-link):
* lisp/ox-man.el (org-man-link):
* lisp/ox-md.el (org-md-link):
* lisp/ox-odt.el (org-odt-inline-image-rules):
(org-odt-link):
* lisp/ox-texinfo.el (org-texinfo-inline-image-rules):
(org-texinfo-link): Remove "attachment" from special cases.
2020-02-22 14:22:49 +01:00
Nicolas Goaziou ab9166ad29 Extend export tooling in link parameters
* lisp/ol.el (org-link-parameters): Allow a fourth "info" argument for
`:export' property.  Expound docstring.
* lisp/ox.el (org-export-custom-protocol-maybe): Accept a fourth
optional argument.
* lisp/ox-ascii.el (org-ascii--describe-links):
(org-ascii-link):
* lisp/ox-beamer.el (org-beamer-link):
* lisp/ox-html.el (org-html-link):
* lisp/ox-latex.el (org-latex-link):
* lisp/ox-man.el (org-man-link):
* lisp/ox-md.el (org-md-link):
* lisp/ox-odt.el (org-odt-link):
* lisp/ox-org.el (org-org-link):
* lisp/ox-texinfo.el (org-texinfo-link):
* contrib/lisp/ox-groff.el (org-groff-link): Provide expected fourth
argument.
* lisp/ox.el (org-export-link-as-file): New function.
* lisp/ol.el (org-link-parameters): Add reference to new function in docstring.
* testing/lisp/test-ox.el (test-org-export/link-as-file): Add tests.
(test-org-export/custom-protocol-maybe): Update tests.
2020-02-19 18:41:37 +01:00
Nicolas Goaziou 427f1a2d03 Merge branch 'maint' 2020-02-16 23:33:48 +01:00
Nicolas Goaziou 8f6ce817d8 ox-html: Fix author meta-data
* lisp/ox-html.el (org-html--build-meta-info): Prevent duplicates in
author meta-data.
2020-02-16 23:33:13 +01:00
Yann Esposito (yogsototh) da62654cb1 ox-html.el: Use CUSTOM_ID for outline-container-* div id
* lisp/ox-html.el (org-html-headline): When CUSTOM_ID is set, use it
to set the outline-container-* <div> id.

TINYCHANGE

When exporting HTML the exporter generate ids for references.
Unfortunately those id are not stable in the sense that exporting
twice generate two different set of ids.

Using CUSTOM_ID one could already use have fixed anchors in the
generated HTML. So for example we could share URL with
...index.html#my-section-id and it will be the same URL even if we
export the HTML again.

Unfortunately, this CUSTOM_ID is not used for the outline ids.  And
thus if we expose the html in a git repository for example.  Each
export will generate a big diff that "pollute" the diff because it
will show changes for all org items while most of them could still be
unchanged.

With this PR, HTML export will use CUSTOM_ID for both the headers id
and the org outline ids. For Items without CUSTOM_ID the behavior will
stay identical as before.
2020-02-12 19:00:42 +01:00
Bastien 8f59e01aa8 Fix code typo in commit 0c72a1c4 2020-02-11 23:52:17 +01:00
Bastien efd754e474 Fix 68fa5e589 2020-02-11 12:03:38 +01:00
Bastien 68fa5e589f ox-html.el: Enhance Javascript scripts display of the license
* lisp/ox-html.el (org-html-scripts)
(org-html-infojs-template): Enhance the display of the
licenses for Javascript scripts.

Thanks to Arne Babenhauserheide for suggesting this.
2020-02-11 09:45:48 +01:00
Bastien 3ce509b855 ox-html.el: Build HTML links correctly
* lisp/ox-html.el (org-html-link): Add the possibility to use
an empty HTML extension, building HTML links to accordingly.
2020-02-11 09:30:57 +01:00
Bastien 0c72a1c413 ox-html.el: No trailing dot when HTML extension is empty
* lisp/ox-html.el (org-html-export-to-html)
(org-html-publish-to-html): Don't add a trailing dot when HTML
extension is empty.
2020-02-11 09:26:20 +01:00