[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] extra paragraph in image export?

From: Nicolas Goaziou
Subject: Re: [O] extra paragraph in image export?
Date: Tue, 24 Jan 2017 22:27:39 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)


Rasmus <address@hidden> writes:

> I'm not an expert of HTML either.  However, the "p" tag inside the
> "figure" is uncommon looking a bit on the example usages online.  Thus, I
> agree with Matt that it should probably not be there.


> AFAIK, the CSS selector still differs so on the output side they are not
> alike.  I.e. the former is "figure>img" the other is a "p>img".  Aside: If
> anything, removing the "p" tag inside the figure would make it easier to
> handle images.

So would the following patch fix the issue?


Nicolas Goaziou
>From 49ebd5a8406bdee0c0a94b83f7135d94e35bb6ba Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <address@hidden>
Date: Tue, 24 Jan 2017 22:22:47 +0100
Subject: [PATCH] ox-html: Remove <p> tag around block images when using HTML5

* lisp/ox-html.el (org-html--wrap-image): Do not add a spurious <p>
  tag when using <figure> to mark images.
 lisp/ox-html.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index d3c1b2eb1..fa8476a05 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1607,7 +1607,7 @@ arguments CAPTION and LABEL are given, use them for 
caption and
            ;; ID.
            (if (org-string-nw-p label) (format " id=\"%s\"" label) "")
            ;; Contents.
-           (format "\n<p>%s</p>" contents)
+           (if html5-fancy contents (format "\n<p>%s</p>" contents))
            ;; Caption.
            (if (not (org-string-nw-p caption)) ""
              (format (if html5-fancy "\n<figcaption>%s</figcaption>"

reply via email to

[Prev in Thread] Current Thread [Next in Thread]