From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id MHzjFQkyvV+cTwAA0tVLHw (envelope-from ) for ; Tue, 24 Nov 2020 16:17:13 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id SC3JEQkyvV/bEwAA1q6Kng (envelope-from ) for ; Tue, 24 Nov 2020 16:17:13 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id A52F794042C for ; Tue, 24 Nov 2020 16:17:12 +0000 (UTC) Received: from localhost ([::1]:34190 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1khb0A-0003hv-OM for larch@yhetil.org; Tue, 24 Nov 2020 11:17:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44726) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1khazE-0003gU-VB for emacs-orgmode@gnu.org; Tue, 24 Nov 2020 11:16:14 -0500 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]:42858) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1khazB-0000yq-2v for emacs-orgmode@gnu.org; Tue, 24 Nov 2020 11:16:12 -0500 Received: by mail-pg1-x52b.google.com with SMTP id w16so5520838pga.9 for ; Tue, 24 Nov 2020 08:16:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=andrew-cmu-edu.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=Dmpkg/T5yduYPOud9mVMZdM+OqtOKca4/e1+Hb8ZPD0=; b=rWyvNWQORva+zETdcH7yl1ubQLekXLAr6y5SnnDEw9I1CfwmElpfBfgKhwqnmzJmkR RjNTRZpe2iJBF87MVYy/2cujo27Zff3up0sDpCnHS5Smcq+OaCVzn8W3Izxf0iarRnTd UgXrVpJqjgIL66oqRA7J7+3V9eXLx2Zg+MRKb6vP58PrcxU8fWzu3tD/U9P/AeBiSodi ONjK/ok/ETUiG0hw746m3CmrgiuG4N0mOwWOjDBxpbc/NqY4BwZkso8apN65mYd9IAm4 GyjitLqyaXOUTDYmn/9U1iDhjC5Ya9/WvAxlrWmoghbn1Oubv9s5ofWJssX3bSQWbJTh lQng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=Dmpkg/T5yduYPOud9mVMZdM+OqtOKca4/e1+Hb8ZPD0=; b=sGvrrrkOlKDjpgDJ5+3lPJ08WrIg/vuqDPRCO1maSwOEGEqHUnYUmntA2QlCI/meqw vwceb/BOSxrVy6ulPcBUNNu+9d9mB5hqC0VSLoFKaeJ/Jx+QblimZpMZjJfEZtcODHiY dfiURvVj7tIk2xnMKkBKi67mlVjZpqobZVJGAOmnfJ7mPy7y0mpS0G5oOM0LXrCGLQ+b kuqAhHVvAiH0zj3nJ4VmQCfLfbgUd65soEOKaVczxL2Vgio7yeVYnl6qUohr4yeXK4PS rI/FoSkLOwAd2tRQogUCxA0n1vtFfK4n52ltwd0FveP4yE62+ybut4K1NCQSWj87viq/ Y01w== X-Gm-Message-State: AOAM533TvZeTjMNCvNGa9M2B3WQMvsFX6AK+ETbTUEMNsqaZ7MUrEi8V UDsstNaVoPd95vPPXkBlwBYpYb3tZiTOWdd6NFXTXJ6Dy62MwQ== X-Google-Smtp-Source: ABdhPJwrcFSEj80jeBJsAbCsLB2hS/leiEOz0biKV4tcZWah/bgBn53/Y//WSesMXJuCiLW2Qd5XFbeEkAPT8UFiK6M= X-Received: by 2002:a17:90a:a608:: with SMTP id c8mr5643968pjq.161.1606234565685; Tue, 24 Nov 2020 08:16:05 -0800 (PST) MIME-Version: 1.0 References: <87a6v7gdej.fsf@fastmail.fm> <87sg8yivr4.fsf@guelker.eu> In-Reply-To: <87sg8yivr4.fsf@guelker.eu> From: John Kitchin Date: Tue, 24 Nov 2020 11:15:54 -0500 Message-ID: Subject: Re: Differentiate source blocks in export? To: org-mode-email Content-Type: multipart/alternative; boundary="000000000000b6b5e505b4dca088" Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=johnrkitchin@gmail.com; helo=mail-pg1-x52b.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=andrew-cmu-edu.20150623.gappssmtp.com header.s=20150623 header.b=rWyvNWQO; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=andrew.cmu.edu (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -0.11 X-TUID: SdbVZhYwJKQa --000000000000b6b5e505b4dca088 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Nice! Here is a little more compact way to do that I think: @@html:
@@ #+BEGIN_SRC python print(5) #+END_SRC @@html:
@@ John ----------------------------------- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu On Tue, Nov 24, 2020 at 11:08 AM Marvin =E2=80=98quintus=E2=80=99 G=C3=BClk= er < post+orgmodeml@guelker.eu> wrote: > Hi! > > Am Dienstag, dem 24. November 2020 schrieb Joost Kremers: > > I was wondering if there's a way to distinguish between different kind > of source > > code blocks when exporting to HTML. > > > > Specifically, I would like a way to mark certain code blocks in my Org > file so > > that those code blocks get a specific class in the HTML export. > > You can use the BEGIN_EXPORT/END_EXPORT pair to include a literal HTML > DIV tag around your target code block. Try this: > > Wrapped code block in a div with a custom class: > > #+BEGIN_EXPORT html >
> #+END_EXPORT > > #+BEGIN_SRC c > #include > int main(int argc, char* argv[]) > { > printf("This is wrapped in the div\n"); > return 0; > } > #+END_SRC > > #+BEGIN_EXPORT html >
> #+END_EXPORT > > Normal codeblock without: > > #+BEGIN_SRC c > #include > int main(int argc, char* argv[]) > { > printf("This is not wrapped in anything unusual\n"); > return 0; > } > #+END_SRC > > Note how one of the EXPORT blocks wraps the opening tag of the DIV and > the other one wraps the closing tag. > > -quintus > > -- > Dipl.-Jur. M. G=C3=BClker | https://mg.guelker.eu | For security: > Passau, Germany | kontakt@guelker.eu | () Avoid HTML e-mail > European Union | PGP: see homepage | /\ http://asciiribbon.org > > --000000000000b6b5e505b4dca088 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Nice! Here is a little more compact way to do that I think= :

@@html:<div class=3D"myclass">@@
#+= BEGIN_SRC python
print(5)
#+END_SRC
@@html:</div>@@


John

-----------------------------------
Professor John = Kitchin=C2=A0
Doherty Hall A207F
Department of Chemical EngineeringCarnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
<= div dir=3D"ltr">@johnkitchin
http://kitchingroup.cheme.cmu.edu



On Tue, Nov 24, 2020 at 11:08 AM Marvin =E2= =80=98quintus=E2=80=99 G=C3=BClker <post+orgmodeml@guelker.eu> wrote:
Hi!

Am Dienstag, dem 24. November 2020 schrieb Joost Kremers:
> I was wondering if there's a way to distinguish between different = kind of source
> code blocks when exporting to HTML.
>
> Specifically, I would like a way to mark certain code blocks in my Org= file so
> that those code blocks get a specific class in the HTML export.

You can use the BEGIN_EXPORT/END_EXPORT pair to include a literal HTML
DIV tag around your target code block. Try this:

=C2=A0 =C2=A0 Wrapped code block in a div with a custom class:

=C2=A0 =C2=A0 #+BEGIN_EXPORT html
=C2=A0 =C2=A0 <div class=3D"myclass">
=C2=A0 =C2=A0 #+END_EXPORT

=C2=A0 =C2=A0 #+BEGIN_SRC c
=C2=A0 =C2=A0 #include <stdio.h>
=C2=A0 =C2=A0 int main(int argc, char* argv[])
=C2=A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 printf("This is wrapped in the div\n"= );
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return 0;
=C2=A0 =C2=A0 }
=C2=A0 =C2=A0 #+END_SRC

=C2=A0 =C2=A0 #+BEGIN_EXPORT html
=C2=A0 =C2=A0 </div>
=C2=A0 =C2=A0 #+END_EXPORT

=C2=A0 =C2=A0 Normal codeblock without:

=C2=A0 =C2=A0 #+BEGIN_SRC c
=C2=A0 =C2=A0 #include <stdio.h>
=C2=A0 =C2=A0 int main(int argc, char* argv[])
=C2=A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 printf("This is not wrapped in anything un= usual\n");
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return 0;
=C2=A0 =C2=A0 }
=C2=A0 =C2=A0 #+END_SRC

Note how one of the EXPORT blocks wraps the opening tag of the DIV and
the other one wraps the closing tag.

=C2=A0 -quintus

--
Dipl.-Jur. M. G=C3=BClker | https://mg.guelker.eu |=C2=A0 =C2=A0 For securi= ty:
Passau, Germany=C2=A0 =C2=A0 =C2=A0 | kontakt@guelker.eu=C2=A0 =C2=A0 | () Avoid HTML e-ma= il
European Union=C2=A0 =C2=A0 =C2=A0 =C2=A0| PGP: see homepage=C2=A0 =C2=A0 = =C2=A0| /\ http://asciiribbon.org

--000000000000b6b5e505b4dca088--