From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Price Subject: Re: superfluous tags in html src block output Date: Sat, 14 Sep 2019 15:56:25 -0400 Message-ID: References: <13D2DFAB-7BCE-4235-9F64-5EDA60982232@ucsd.edu> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000bab106059288c4d3" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:34004) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i9E9w-0005LL-BE for emacs-orgmode@gnu.org; Sat, 14 Sep 2019 15:56:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i9E9u-0001wK-U8 for emacs-orgmode@gnu.org; Sat, 14 Sep 2019 15:56:40 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:35673) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i9E9u-0001wE-KP for emacs-orgmode@gnu.org; Sat, 14 Sep 2019 15:56:38 -0400 Received: by mail-pf1-x443.google.com with SMTP id 205so20077109pfw.2 for ; Sat, 14 Sep 2019 12:56:38 -0700 (PDT) In-Reply-To: <13D2DFAB-7BCE-4235-9F64-5EDA60982232@ucsd.edu> 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: "Berry, Charles" , Org Mode --000000000000bab106059288c4d3 Content-Type: text/plain; charset="UTF-8" On Sat, Sep 14, 2019 at 1:53 PM Berry, Charles wrote: > This is newer: > > === > commit ded3d27b1468b878197e5fe55a70c5e13350ea27 > Author: Nik Clayton > Date: Tue Jun 4 11:57:40 2019 +0200 > > ox-html: Wrap each line of a source block in a code element > > * lisp/ox-html.el (org-html-do-format-code): Wrap each line of a > source block > in a code element. > > This makes it straightforward to add custom decorations to each line > using CSS :before and :after properties. > > === > > ah, man, thank you, that's very helpful. Clearly this is the issue. I'll have to figure out the best way to make this work with the `highlight.js` library that reveal.js depends on for code highlighting. > > > HTH, > > Chuck > > > > On Sep 14, 2019, at 8:52 AM, Matt Price wrote: > > > > I'm seeing something I hadn't noticed before in src block html exports. > Instead of producing structures like: > > > >
> > 
> > ...
> > ...
> > ...
> > 
> > 
> > > > each individual like is wrapped in its own tag. In regular HTML > exports this doesn't really affect display, but in exports to reveal using > the highlight.js plugin, code display gets messed up. > > > > From what I can tell these code tags are generated in > org-html-do-format-code, in this section which starts on line 22459 of my > pretty recent org: > > > > (org-export-format-code > > code > > (lambda (loc line-num ref) > > (setq loc > > (concat > > ;; Add line number, if needed. > > (when num-start > > (format "%s" > > (format num-fmt line-num))) > > ;; Transcoded src line. > > (format "%s" > > (if num-start > > (format " data-ox-html-linenr=\"%s\"" line-num) > > "") > > loc) > > ;; Add label, if needed. > > (when (and ref retain-labels) (format " (%s)" ref)))) > > ;; Mark transcoded line as an anchor, if needed. > > (if (not ref) loc > > (format "%s" > > ref loc))) > > num-start refs) > > > > This code seems to have been around for a while so I don't know whether > this is new behaviour, but I don't think I've seen line-level tags > before. Can anyone confirm? > > > > See also a MWE in this bug report, which is probably erroneously filed > in the org-re-reveal repo: > > > > https://gitlab.com/oer/org-re-reveal/issues/27 > > > > I'd love to know whether this is expected behaviour, or if I've gone > wrong somewhere! > > THanks, > > Matt > > > > > --000000000000bab106059288c4d3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Sat, Sep 14, 2019 at 1:53 PM Berry= , Charles <ccberry= @ucsd.edu> wrote:
This is newer:

=3D=3D=3D
commit ded3d27b1468b878197e5fe55a70c5e13350ea27
Author: Nik Clayton <nik@ngo.org.uk>
Date:=C2=A0 =C2=A0Tue Jun 4 11:57:40 2019 +0200

=C2=A0 =C2=A0 ox-html: Wrap each line of a source block in a code element
=C2=A0 =C2=A0 * lisp/ox-html.el (org-html-do-format-code): Wrap each line o= f a source block
=C2=A0 =C2=A0 in a code element.

=C2=A0 =C2=A0 This makes it straightforward to add custom decorations to ea= ch line
=C2=A0 =C2=A0 using CSS :before and :after properties.

=3D=3D=3D

ah, man, thank you, that's very helpful. =C2=A0 C= learly this is the issue. I'll have to figure out the best way to make = this work with the `highlight.js` library that reveal.js depends on for cod= e highlighting. =C2=A0


HTH,

Chuck


> On Sep 14, 2019, at 8:52 AM, Matt Price <moptop99@gmail.com> wrote:
>
> I'm seeing something I hadn't noticed before in src block html= exports. Instead of producing structures like:
>
> <pre>
> <code>
> <span>...</span>
> <span>...</span>
> <span>...</span>
> </code>
> </pre>
>
> each individual like is wrapped in its own <code> tag.=C2=A0 In = regular HTML exports this doesn't really affect display, but in exports= to reveal using the highlight.js plugin, code display gets messed up.
>
> From what I can tell these code tags are generated in org-html-do-form= at-code, in this section which starts on line 22459 of my pretty recent org= :
>
> (org-export-format-code
>=C2=A0 =C2=A0 =C2=A0 code
>=C2=A0 =C2=A0 =C2=A0 (lambda (loc line-num ref)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 (setq loc
>=C2=A0 =C2=A0 =C2=A0(concat
>=C2=A0 =C2=A0 =C2=A0 ;; Add line number, if needed.
>=C2=A0 =C2=A0 =C2=A0 (when num-start
> (format "<span class=3D\"linenr\">%s</span>= "
> (format num-fmt line-num)))
>=C2=A0 =C2=A0 =C2=A0 ;; Transcoded src line.
>=C2=A0 =C2=A0 =C2=A0 (format "<code%s>%s</code>"<= br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0(if num-start
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0(format " data-ox-html-linenr=3D\"%s\&= quot;" line-num)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0"")
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0loc)
>=C2=A0 =C2=A0 =C2=A0 ;; Add label, if needed.
>=C2=A0 =C2=A0 =C2=A0 (when (and ref retain-labels) (format " (%s)&= quot; ref))))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; Mark transcoded line as an anchor, if ne= eded.
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 (if (not ref) loc
> (format "<span id=3D\"coderef-%s\" class=3D\"co= deref-off\">%s</span>"
> ref loc)))
>=C2=A0 =C2=A0 =C2=A0 num-start refs)
>
> This code seems to have been around for a while so I don't know wh= ether this is new behaviour, but I don't think I've seen line-level= <code> tags before.=C2=A0 Can anyone confirm?
>
> See also a MWE in this bug report, which is probably erroneously filed= in the org-re-reveal repo:
>
> https://gitlab.com/oer/org-re-reveal/issues/27
>
> I'd love to know whether this is expected behaviour, or if I'v= e gone wrong somewhere!
> THanks,
> Matt
>


--000000000000bab106059288c4d3--