From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aaron Miller Subject: Re: Bug: HTML export fails to set source IDs correctly [8.3.4 (8.3.4-elpa @ /Users/aaron/.emacs.d/elpa/org-20160222/)] Date: Thu, 25 Feb 2016 16:38:58 -0500 Message-ID: <3E78538B-202B-4EC5-9E4C-B674279187C6@aaron-miller.me> References: <56CE5C4D.5090100@aaron-miller.me> <8760xc1r12.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 (1.0) Content-Type: multipart/alternative; boundary=Apple-Mail-A5738259-577C-4DCE-A48F-A300846DE764 Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48618) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZ3cs-0006Qj-20 for emacs-orgmode@gnu.org; Thu, 25 Feb 2016 16:39:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aZ3cp-00058Y-4x for emacs-orgmode@gnu.org; Thu, 25 Feb 2016 16:39:09 -0500 Received: from acephalo.us ([70.85.31.34]:59774 helo=mail.acephalo.us) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZ3co-000581-Ur for emacs-orgmode@gnu.org; Thu, 25 Feb 2016 16:39:07 -0500 In-Reply-To: <8760xc1r12.fsf@nicolasgoaziou.fr> 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: Nicolas Goaziou Cc: "emacs-orgmode@gnu.org" --Apple-Mail-A5738259-577C-4DCE-A48F-A300846DE764 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable The difficulty here is that ID attribute values are not easily predictable, a= nd dependent on the source block's position in the document. This complicate= s tasks like styling a specific source block -- with the previous ID generat= ion method, this could be reliably done with an ID selector; with the curren= t behavior, that's no longer true.=20 Can you provide some insight on why the behavior was changed? I'd be happy t= o expand the scope of my bug report to cover whatever code relies on the cha= nge. Thanks! -- Aaron Miller Mobile: (443) 902-4702 me@aaron-miller.me http://aaron-miller.me > On Feb 25, 2016, at 15:19, Nicolas Goaziou wrote:= >=20 > Hello, >=20 > Aaron Miller writes: >=20 >> Expected: When exporting an Org document with named source blocks to=20 >> HTML, each
 generated to contain a source block has an ID attribute=20=

>> matching the source block's name.
>>=20
>> Actual: Instead, ID attributes come out with values like "orgsrcblock1".
>>=20
>> Test case:
>> --- >8 cut here ---
>> #+TITLE: bug test case
>>=20
>> #+NAME: a-source-block
>> #+BEGIN_SRC emacs-lisp :eval never
>> ;; hi
>> #+END_SRC
>> --- 8< cut here ---
>>=20
>> Expected result (its salient subset):
>> --- >8 cut here ---
>> 
>> ;; hi
>> 
>> --- 8< cut here --- >>=20 >> Actual result (its likewise): >> --- >8 cut here --- >>
>> ;; hi
>> 
>> --- 8< cut here --- >>=20 >> Note the erroneous ID attribute value. >=20 > The attribute is intended. >=20 >> The issue here is that, in `org-html-src-block' and=20 >> `org-html-inline-src-block', the fallback behavior for ID attribute=20 >> value is implemented in terms of `and', rather than `or'. Since `and'=20 >> short-circuits only when it encounters a null argument, the desired=20 >> behavior is effectively inverted. >=20 > Actually this is the desired behaviour: when a label is specified, make > sure to replace it with our internal unique and safe label. Hence the > `and'. >=20 >=20 > Regards, >=20 > --=20 > Nicolas Goaziou --Apple-Mail-A5738259-577C-4DCE-A48F-A300846DE764 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
The difficulty here is that ID attribu= te values are not easily predictable, and dependent on the source block's po= sition in the document. This complicates tasks like styling a specific sourc= e block -- with the previous ID generation method, this could be reliably do= ne with an ID selector; with the current behavior, that's no longer true.&nb= sp;

Can you provide some insight on why the behavio= r was changed? I'd be happy to expand the scope of my bug report to cover wh= atever code relies on the change. Thanks!

--
Aaron Miller
Mobile: (443)= 902-4702

On Feb 25, 2016, at 15:19,= Nicolas Goaziou <mail@nicolasg= oaziou.fr> wrote:

H= ello,

Aaron Miller <me@aaron-miller.me> writes:
=
Expected: When exporting an Org document= with named source blocks to
HTML, each <pre> generated to contain a source block has an I= D attribute
matching= the source block's name.
<= span>
Actual: Instead= , ID attributes come out with values like "orgsrcblock1".

Test case:
--- >8 cut here ---
#+TITLE: bug test case

#+NAME: a= -source-block
#+BEGIN= _SRC emacs-lisp :eval never
;; hi
#+END_SR= C
--- 8< cut here -= --

Expected result (its salient subset):<= /span>
--- >8 cut here --= -
<pre class=3D"sr= c src-emacs-lisp" id=3D"a-source-block">
;; hi
</pre>
= --- 8< cut here ---

Actual result (its= likewise):
--- >8= cut here ---
<pre= class=3D"src src-emacs-lisp" id=3D"orgsrcblock1">
;; hi
</pre>
--- 8< cut here ---

Note the= erroneous ID attribute value.

The attribute is intended.

The issue here is that, in `org-html-src-block' and
`org-html-inline-src-block', the f= allback behavior for ID attribute
value is implemented in terms of `and', rather than `or'. Since= `and'
short-circuit= s only when it encounters a null argument, the desired
behavior is effectively inverted.<= br>

Actually this is the desired behaviou= r: when a label is specified, make
sure to replace it with o= ur internal unique and safe label. Hence the
`and'.

Regards,
--
Nicolas Goaziou
= --Apple-Mail-A5738259-577C-4DCE-A48F-A300846DE764--