From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/25463 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Umut Acar Newsgroups: gmane.text.pandoc Subject: Re: code block translation from latex to html Date: Sat, 13 Jun 2020 18:19:03 -0700 (PDT) Message-ID: References: <49108dd7-3ee5-41b5-9b8c-92c558ff46b5@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_912_1338299703.1592097543301" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="73183"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDAL3NWYRQARBCXWSX3QKGQEHZLZS2Q-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sun Jun 14 03:19:10 2020 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-ot1-f58.google.com ([209.85.210.58]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jkHIj-000Iwi-P3 for gtp-pandoc-discuss@m.gmane-mx.org; Sun, 14 Jun 2020 03:19:09 +0200 Original-Received: by mail-ot1-f58.google.com with SMTP id w21sf6062097oti.16 for ; Sat, 13 Jun 2020 18:19:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:date:from:to:message-id:in-reply-to:references:subject :mime-version:x-original-sender:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:list-subscribe :list-unsubscribe; bh=E437cDwDYpHWqJZVSEuyNkgnM8+KYukkyncl9qHDOzY=; b=ohJOZ1NIHNj9W84bPUWW7XLLy47HPjs8mtIe2AOMwJ3pgTCUvZgNAtbQw1gH7/ubdR XO1Gt+anKnLLf0INY/Ga+fJNwoMr6h/G+grdTWSdnywWd4oiNlLdxFdiJUh19bNjAL2d 3AT4WbWOEIJHuQ58UDuOl3WcGYOxU+3zoH9b1cFND+tT4klNdlnPveKXfpfSz4HeHBV+ uuBDwrlP7k66NryzXcyRpeConePFP3UmroJlzAKKbLm6/AxRXQeltSg8+Ap6LPPV+D1N v61WD/B7v/tPuqpfSTeKfEdnJM4/Aakw+AlR6ZkHNWsOoMuNr9D46wbN1XZrUFWyD/ZC H/zw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=E437cDwDYpHWqJZVSEuyNkgnM8+KYukkyncl9qHDOzY=; b=LOUwBNAKF+X7lS4L31mfZV/83UV+IJJOlreHBUQmqcgsM6j8DFDFhAvh21I3FcT33o 1GaoANwqv3WRjn1TMkVmXc0HNCHNGWuwXlaLYfPyTdtgJEFvMirURVa95vyeufvso2Yb IlLk/aHGI60t1QrIio/kIqK6uNFfl/bATNyPbblLJp8mmT0hdZyaMgxx0M/UZlBKx5Ti SkdS/cFQeiNO5dQolskVwWCtxeVkCk8wi4VJNifZjdVjkrXmPrZFP87YB9jS/seGFvfK lEN3Qv97uirjon3RWdorJ+0u+2IP/16QbBXpHORFgfey9ZVRH7J/UeThS1aNUP8pprxR 3vpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:date:from:to:message-id:in-reply-to :references:subject:mime-version:x-original-sender:reply-to :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=E437cDwDYpHWqJZVSEuyNkgnM8+KYukkyncl9qHDOzY=; b=XpHgUBM2Cg9JuPY7SEta8iR9QnS2U0Y9fouTXKU+A1V7GyRd8jM9QIL/qcOXw0mzfC CJXCjQHHtggxS2cX3qYvjjT/0+RXmxwD6+rTzDKfwuwu9dUNbVJBbjRJYg7d5S9rNnjA xHo3BhpLZeTfRoghwbZxd0SOVOGvG1y6PkxRs7EnvCfdkZchYUTg/U5pdMyYj7GXVLwE BF9E0Pcy7LOLLnNmu7wsXxVK+WiXomwwqBrpnM3surU0JP8MvFg+6i/aZVyMlnYNfR0V V8BqPaVmesSexy+k2xKuqhVdeAdFqe61uXP1UGuF9Dx3/1SwEbjOXK3jM0MjpMJ6/ePk ncwA== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM531mVaF1Tz+wGpKhBRdTXDdB3wgkpbXnjfSTJ9Eox2XGddzfuqcG EnwRwBzUFpHLSexdbTrWkNg= X-Google-Smtp-Source: ABdhPJyPIj85sVRpuMs9IjfYBED3f8f5j4J+1luWccjqiU46uuCJlOX/yOprI6Di4bP/Uu+NWeUP+g== X-Received: by 2002:a9d:333:: with SMTP id 48mr17189278otv.160.1592097548834; Sat, 13 Jun 2020 18:19:08 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a9d:2c46:: with SMTP id f64ls2247671otb.2.gmail; Sat, 13 Jun 2020 18:19:04 -0700 (PDT) X-Received: by 2002:a9d:2012:: with SMTP id n18mr16268282ota.205.1592097543893; Sat, 13 Jun 2020 18:19:03 -0700 (PDT) In-Reply-To: X-Original-Sender: umutacar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.io gmane.text.pandoc:25463 Archived-At: ------=_Part_912_1338299703.1592097543301 Content-Type: multipart/alternative; boundary="----=_Part_913_647849120.1592097543301" ------=_Part_913_647849120.1592097543301 Content-Type: text/plain; charset="UTF-8" Hi John, Update on this: this turn out to be a html/browser issue. Basically, browsers do not seem to like self-closing anchor tags and don't render them properly (all three browsers I have tried consistently failed). Unfortunately, various html processing libraries that I use translate ("standardize") empty anchors into self-closing anchors. I got around the problem by preventing this from happening by forcing the anchors tags to have "empty" text bodies, which the translation tools treat as something different that "Null" or "None". Bottomline, as far as I can tell, there is nothing interesting here as far as pandoc is concerned.... On Friday, May 8, 2020 at 12:45:30 AM UTC-4, John MacFarlane wrote: > > > You need to provide us with more to go on. > By itself this input wouldn't produce highlighted code at all > (no language is specified). > > Try this markdown sample: > > ~~~~~~ > One: > > ``` {.haskell .numberLines} > let x = tail y in > x <> y > ``` > > Two: > > ``` {.haskell .numberLines} > x >>= y >>= z > ``` > ~~~~~~ > > This works fine. Line numbers are generated. The line numbers are > links to the line (very useful!). The two snippets generate separate > ids with links to separat elines. > > Without the 'numberLines' class you don't get the line numbers, > and the lines are NOT links to themselves. > > When converting from LaTeX/listings, you'll need to add the > numbers=left option to get numbering. > > In your output > > 2 ( class="dt">int) > > the line is not a link to itself (tested on browser just to make > sure); there is an element but its content is empty since > you don't have a line number. > > > > > > > Umut Acar > writes: > > > At some point after pandoc version 2.7.2, pandoc started translating > code > > blocks to html from LaTeX sources somewhat differently. > > > > For example, the code block > > > > ``` > > \begin{lstlisting} > > ... > > 2 (int) > > \end{lstlisting} > > ``` > > used to produce the following html > > ``` > > 2 > ( > class="dt">int) > > ``` > > It now produces the following > > ``` > > 2 ( > class="dt">int) > > ``` > > > > On a browser, the latter renders the code "int" as a html link to > itself; > > the code line is rendered as a link (to itself). > > > > Also, because the code anchor id's such as `cb2-4` are not unique > (multiple > > code blocks generate the same id's), clicking on a code line sends the > > browser to the first instance of that id, usually somewhere up the page. > > > > The new translation is also dropping the code line numbers. > > > > Any thoughts about what might be going on and suggestions about how this > > could be fixed? I would be happy with the prior behavior code lines > were > > not assigned anchor tags and were numbered serially. > > > > > > > > > > -- > > You received this message because you are subscribed to the Google > Groups "pandoc-discuss" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org . > > To view this discussion on the web visit > https://groups.google.com/d/msgid/pandoc-discuss/49108dd7-3ee5-41b5-9b8c-92c558ff46b5%40googlegroups.com. > > -- You received this message because you are subscribed to the Google Groups "pandoc-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/f34f1376-c7cb-46f2-94c7-771c144dd239o%40googlegroups.com. ------=_Part_913_647849120.1592097543301 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi John,

Update on this: this turn out = to be a html/browser issue.=C2=A0 Basically, browsers do not seem to like s= elf-closing anchor tags and=C2=A0 don't render them properly (all three= browsers I have tried consistently failed).=C2=A0 Unfortunately, various h= tml processing libraries that I use translate ("standardize") emp= ty anchors into self-closing anchors.=C2=A0 I got around the problem by pre= venting this from happening by forcing the anchors tags to have "empty= " text bodies, which the translation tools treat as something differen= t that "Null" or "None".=C2=A0 Bottomline, as far as I = can tell, there is nothing interesting here as far as pandoc is concerned..= ..


On Friday, May 8, 2020 at 12:45:30 AM UTC-4= , John MacFarlane wrote:

You need to provide us with more to go on.
By itself this input wouldn't produce highlighted code at all
(no language is specified).

Try this markdown sample:

~~~~~~
One:

``` {.haskell .numberLines}
let x =3D tail y in
=C2=A0 =C2=A0 x <> y
```

Two:

``` {.haskell .numberLines}
x >>=3D y >>=3D z
```
~~~~~~

This works fine. Line numbers are generated. The line numbers are
links to the line (very useful!). =C2=A0The two snippets generate separ= ate
ids with links to separat elines.

Without the 'numberLines' class you don't get the line numb= ers,
and the lines are NOT links to themselves.

When converting from LaTeX/listings, you'll need to add the
numbers=3Dleft option to get numbering.

In your output

<span id=3D"cb2-4"><a href=3D"#cb2-4">&= lt;/a><span class=3D"dv">2</span> (<span=20
class=3D"dt">int</span>) =C2=A0</span>

the line is not a link to itself (tested on browser just to make
sure); there is an <a> element but its content is empty since
you don't have a line number.






Umut Acar <umut...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> At some point after pandoc version 2.7.2, pandoc started translati= ng code=20
> blocks to html from LaTeX sources somewhat differently. =C2=A0
>
> For example, =C2=A0the code block
>
> ```
> \begin{lstlisting}=20
> ...
> 2 (int)=20
> \end{lstlisting}
> ```
> used to produce the following html=20
> ```
> <a class=3D"sourceLine" id=3D"cb2-4" title= =3D"4"><span class=3D"dv">2</span> (<= span=20
> class=3D"dt">int</span>) =C2=A0
> ```
> It now produces the following
> ```
> <span id=3D"cb2-4"><a href=3D"#cb2-4"= ></a><span class=3D"dv">2</span> (<span= =20
> class=3D"dt">int</span>) =C2=A0</span>
> ```
>
> On a browser, =C2=A0the latter renders the code "int" as= a html link to itself;=20
> the code line is rendered as a link (to itself).
>
> Also, because the code anchor id's such as `cb2-4` are not uni= que (multiple=20
> code blocks generate the same id's), clicking on a code line s= ends the=20
> browser to the first instance of that id, usually somewhere up the= page.
>
> The new translation is also dropping the code line numbers.
>
> Any thoughts about what might be going on and suggestions about ho= w this=20
> could be fixed? =C2=A0 I would be happy with the prior behavior co= de lines were=20
> not assigned anchor tags and were numbered serially. =C2=A0
>
>
>
>
> --=20
> You received this message because you are subscribed to the Google= Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, = send an email to pandoc-...@googlegroups.com.
> To view this discussion on the web visit https://groups.= google.com/d/msgid/pandoc-discuss/49108dd7-3ee5-41b5-9b8c-92c558f= f46b5%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d= /msgid/pandoc-discuss/f34f1376-c7cb-46f2-94c7-771c144dd239o%40googlegroups.= com.
------=_Part_913_647849120.1592097543301-- ------=_Part_912_1338299703.1592097543301--