From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Bug: New HTML exporter incorrect attributes Date: Sat, 23 Feb 2013 11:16:13 +0100 Message-ID: <87fw0nibde.fsf@gmail.com> References: <87621j9xgh.fsf@lapcat.tftorrey.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:37263) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9C9i-0000q3-0W for emacs-orgmode@gnu.org; Sat, 23 Feb 2013 05:16:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U9C9b-00043k-Dq for emacs-orgmode@gnu.org; Sat, 23 Feb 2013 05:16:33 -0500 Received: from mail-wi0-f171.google.com ([209.85.212.171]:49488) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9C9b-00043b-7V for emacs-orgmode@gnu.org; Sat, 23 Feb 2013 05:16:27 -0500 Received: by mail-wi0-f171.google.com with SMTP id hn17so1799272wib.10 for ; Sat, 23 Feb 2013 02:16:26 -0800 (PST) In-Reply-To: <87621j9xgh.fsf@lapcat.tftorrey.com> (T. F. Torrey's message of "Sat, 23 Feb 2013 02:43:58 -0700") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "T.F. Torrey" Cc: emacs-orgmode@gnu.org tftorrey@tftorrey.com (T.F. Torrey) writes: >> You don't assign attributes to an image in a paragraph, you assign >> attributes to the paragraph itself. > > It would be nice if there actually was a way to assign an attribute to a > paragraph, so that the ATTR_HTML: class="XXX" syntax would export as

class="XXX">, but that is a different issue. It would be ATTR_HTML: :class "XXX". I try to unify syntax for attributes with syntax for Babel and AFAICT, `html' is the last back-end to have key="value" syntax. >> For the time being, Org syntax >> doesn't allow to specify attributes per link object. > > I think what you are saying is that the current intended behavior is for > whatever is specified by ATTR_HTML to apply to every image or link in > the paragraph. No. I am saying that ATTR_HTML behaviour in _undefined_ when a paragraph contains more than one link, as it has always been. If you carefully look at Org manual (in application with previous exporter framework), in "Images in HTML export", you will notice that HTML attributes only apply to a single link pointing to an image, not to a paragraph containing many links. >> As a consequence, attributes will be assigned to every link within the >> paragraph. > > Is this behavior helpful to anyone in any practical circumstances? I never said it was. It's not even a feature. I'm just explaining what is happening. > Moreover, this means that, not only does the new exporter fail where the > old one succeeded, I worked hard to make the new export framework compatible with defined behaviour of previous exporter, not with handy undocumented side-effects it may have. > It seems to me that, whether the user is happy with the output or not, > the HTML exporter ought to produce valid HTML. I agree. But, in this case, you're using undefined Org syntax (which, admittedly, used to "work" for you). If there's a simple patch that mimics this for html back-end, I don't mind applying it. But it still won't make up for a real solution. Unless, that is, it is decided that this behaviour is an official feature supported by Org, in which case, it should be added to the manual. > A more general workaround that would help everyone affected would be to > temporarily modify ox-html.el so that attributes from ATTR_HTML only > apply to the *first* item in the paragraph. This would have the > advantage of mimicking the behavior of the old exporter (thus not > breaking existing content) and of keeping images for other export > formats. Of course, anyone relying on the ATTR_HTML to set attributes > for every image and/or link in a paragraph would have to adopt a > different workaround, but ... does anyone really do this? It would solve your problem. But what if someone starts a paragraph with a regular link and thereafter, add an image? ATTR_HTML attributes would never reach it. Again, there's no proper solution besides modifying link syntax. Regards, -- Nicolas Goaziou