Org-mode mailing list
 help / color / mirror / Atom feed
From: Diego Zamboni <diego@zzamboni.org>
To: John Kitchin <jkitchin@andrew.cmu.edu>
Cc: org-mode-email <emacs-orgmode@gnu.org>
Subject: Re: Differentiate source blocks in export?
Date: Tue, 24 Nov 2020 17:22:53 +0100
Message-ID: <CAGY83EdyU=st1LNwPwf0yd=ma+n1qojJ1dpqxBrJb_wkzvj82A@mail.gmail.com> (raw)
In-Reply-To: <CAJ51ETouKkUKSALPS3XOCnKn88Fgdm2GK=1YWCqkiT+TWeb8-Q@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2312 bytes --]

And even (a bit) shorter:

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

--Diego

On Tue, Nov 24, 2020 at 5:16 PM John Kitchin <jkitchin@andrew.cmu.edu>
wrote:

> Nice! Here is a little more compact way to do that I think:
>
> @@html:<div class="myclass">@@
> #+BEGIN_SRC python
> print(5)
> #+END_SRC
> @@html:</div>@@
>
>
> 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 ‘quintus’ Gülker <
> 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
>>     <div class="myclass">
>>     #+END_EXPORT
>>
>>     #+BEGIN_SRC c
>>     #include <stdio.h>
>>     int main(int argc, char* argv[])
>>     {
>>         printf("This is wrapped in the div\n");
>>         return 0;
>>     }
>>     #+END_SRC
>>
>>     #+BEGIN_EXPORT html
>>     </div>
>>     #+END_EXPORT
>>
>>     Normal codeblock without:
>>
>>     #+BEGIN_SRC c
>>     #include <stdio.h>
>>     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ülker | https://mg.guelker.eu |    For security:
>> Passau, Germany      | kontakt@guelker.eu    | () Avoid HTML e-mail
>> European Union       | PGP: see homepage     | /\ http://asciiribbon.org
>>
>>

[-- Attachment #2: Type: text/html, Size: 3597 bytes --]

  reply	other threads:[~2020-11-24 16:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-24 12:14 Joost Kremers
2020-11-24 16:00 ` John Kitchin
2020-11-24 16:07 ` Marvin ‘quintus’ Gülker
2020-11-24 16:15   ` John Kitchin
2020-11-24 16:22     ` Diego Zamboni [this message]
2020-11-24 17:41       ` Eric S Fraga
2020-11-24 22:02         ` Joost Kremers
2020-11-25  8:02           ` Eric S Fraga
2020-11-25  8:37             ` Joost Kremers
2020-11-25  9:20               ` Eric S Fraga
2020-11-25 13:24                 ` Font lock in inner blocks [was: Re: Differentiate source blocks in export?] Joost Kremers
2020-11-24 21:55       ` Differentiate source blocks in export? Joost Kremers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://orgmode.org

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGY83EdyU=st1LNwPwf0yd=ma+n1qojJ1dpqxBrJb_wkzvj82A@mail.gmail.com' \
    --to=diego@zzamboni.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=jkitchin@andrew.cmu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Org-mode mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://orgmode.org/list/0 list/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 list list/ https://orgmode.org/list \
		emacs-orgmode@gnu.org
	public-inbox-index list

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.orgmode
	nntp://news.gmane.io/gmane.emacs.orgmode


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git