From mboxrd@z Thu Jan 1 00:00:00 1970 From: dmg Subject: bug report: ox-html with coderef links needs a space between attributes in element (with patch) Date: Tue, 24 Jan 2017 02:55:55 -0800 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a114ddaf84133cb0546d4f82c Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59319) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cVymF-0006SH-EP for emacs-orgmode@gnu.org; Tue, 24 Jan 2017 05:56:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cVymE-0006of-5N for emacs-orgmode@gnu.org; Tue, 24 Jan 2017 05:56:39 -0500 Received: from mail-vk0-x231.google.com ([2607:f8b0:400c:c05::231]:33864) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cVymE-0006oF-0F for emacs-orgmode@gnu.org; Tue, 24 Jan 2017 05:56:38 -0500 Received: by mail-vk0-x231.google.com with SMTP id r136so109370993vke.1 for ; Tue, 24 Jan 2017 02:56:36 -0800 (PST) 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" To: emacs-orgmode --001a114ddaf84133cb0546d4f82c Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi everybody, I have the following org-snippet: --------------------------------------------------------------- This is an example #+BEGIN_SRC sml -r -l "(*(ref:%s)*)" -n val x =3D 1 fun f y =3D x + y (*(ref:f)*) val x =3D 2 val y =3D 3 val z =3D f(x+y) (*(ref:callf)*) #+END_SRC - Line [[(f)]] defines a function that, when called, evaluates body *x+y* in environment where *x* maps to *1* and *y* maps to the argument ------------------------------------------------------------------ The HTML that it generates creates invalid HTML (one parser used by my university refuses to accept it :) I have inspected the code and this is where it fails: Note how there is no space between " and class in the element:
  • Line 2 defines a functio= n that, when called, evaluates body x+y in environment where x maps to 1 and y maps to the argument
  • =E2=80=8BI am running version 9.0.3 of org. I believe this patch will solve the issue. It simply adds a space before the class attribute. =E2=80=8B diff --git a/lisp/ox-html.el b/lisp/ox-html.el index a741142..9b40cc9 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -3058,7 +3058,7 @@ INFO is a plist holding contextual information. See (let ((fragment (concat "coderef-" (org-html-encode-plain-text path)))) (format "%s" fragment - (format "class=3D\"coderef\" onmouseover=3D\"CodeHighlightOn(this, \ + (format " class=3D\"coderef\" onmouseover=3D\"CodeHighlightOn(this, \ '%s');\" onmouseout=3D\"CodeHighlightOff(this, '%s');\"" fragment fragment) attributes --=20 --dmg --- Daniel M. German http://turingmachine.org --001a114ddaf84133cb0546d4f82c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
    Hi everybody,
    <= br>
    I have the following org-snippet:

    ---------------------------= ------------------------------------
    This is an example

    #+BEGIN_SRC sml -r -l "(*(ref:%s)*)" -n
    val x =3D 1=C2=A0
    fun f y =3D x + y (*(ref:f)*)
    val x = =3D 2
    val y =3D 3
    val z =3D f(x+y) (*(ref:callf)*)
    #+END_SRC

    - Line [[(f)]] defines a function = that, when called, evaluates body *x+y*
    =C2=A0 in environment whe= re *x* maps to *1* and *y* maps to the argument
    --------------------= ----------------------------------------------
    The HTML that it generates c= reates invalid HTML (one parser used by my university refuses to accept =C2= =A0it :)

    I have inspected the code and this is where it fails: Note ho= w there is no space between " and class in the <a> element:

    =

    <li>Line <a href=3D"#coderef-f"class=3D"= coderef" onmouseover=3D"CodeHighlightOn(this, 'coderef-f'= );" onmouseout=3D"CodeHighlightOff(this, 'coderef-f');&qu= ot;>2</a> defines a function that, when called, evaluates body <= ;b>x+y</b>
    in environment where <b>x</b> map= s to <b>1</b> and <b>y</b> maps to the argument<= /li>


    =E2=80=8BI am running version 9.0.3 of org.
    I believe this patch will solve the issue. It sim= ply adds a space before the class attribute.

    =E2=80=8B
    diff --git a/lisp/ox-html.el b/l= isp/ox-html.el
    index a741142..9b40cc9 100644
    --- a/lisp= /ox-html.el
    +++ b/lisp/ox-html.el
    @@ -3058,7 +3058,7 @@= INFO is a plist holding contextual information.=C2=A0 See
    =C2=A0= =C2=A0 =C2=A0 =C2=A0(let ((fragment (concat "coderef-" (org-html= -encode-plain-text path))))
    =C2=A0 =C2=A0 =C2=A0 =C2=A0 (format &= quot;<a href=3D\"#%s\"%s%s>%s</a>"
    =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 fragment
    - = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (format "class=3D\&qu= ot;coderef\" onmouseover=3D\"CodeHighlightOn(this, \
    + = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (format " class=3D\&q= uot;coderef\" onmouseover=3D\"CodeHighlightOn(this, \
    = =C2=A0'%s');\" onmouseout=3D\"CodeHighlightOff(this, '= ;%s');\""
    =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 fragment fragment)
    =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 attributes
    =

    --
    --dmg

    ---
    Da= niel M. German
    ht= tp://turingmachine.org
    --001a114ddaf84133cb0546d4f82c--