Org-mode mailing list
 help / color / mirror / Atom feed
* Format babel code block for export?
@ 2021-06-02  2:03 Galaxy Being
  2021-06-02  9:42 ` Juan Manuel Macías
  0 siblings, 1 reply; 2+ messages in thread
From: Galaxy Being @ 2021-06-02  2:03 UTC (permalink / raw)
  To: emacs-orgmode Mailinglist

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

I have this

#+begin_src haskell :results silent :exports code
:{
maximum'' :: (Ord a) => [a] -> a
maximum'' = foldl1 (\x acc -> if x > acc then x else acc)
:}
#+end_src

but on export to HTML (or LaTex) I'd like to suppress the :{ and :} to just
show the code

maximum'' :: (Ord a) => [a] -> a
maximum'' = foldl1 (\x acc -> if x > acc then x else acc)

Also, this

#+begin_src haskell :results verbatim :exports both
maximum'' [1,3,5,2,4]
#+end_src

I'd like to export the code part with a > REPL prompt included, e.g.,

> maximum'' [1,3,5,2,4]

I once saw some similar tricks, but I've searched and searched and can't
find them again. There's probably other html export formatting I'd like
too, but if anyone can point me to that mystery doc I'd appreciate it.

⨽
Lawrence Bottorff
Grand Marais, MN, USA
borgauf@gmail.com

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Format babel code block for export?
  2021-06-02  2:03 Format babel code block for export? Galaxy Being
@ 2021-06-02  9:42 ` Juan Manuel Macías
  0 siblings, 0 replies; 2+ messages in thread
From: Juan Manuel Macías @ 2021-06-02  9:42 UTC (permalink / raw)
  To: Galaxy Being; +Cc: orgmode

Hi Lawrence,

You can use multiple blocks and noweb reference syntax
(https://orgmode.org/manual/Noweb-Reference-Syntax.html):

#+NAME:block1
#+begin_src haskell :results silent :exports none
:{
#+end_src

#+NAME:block2
#+begin_src haskell :results silent :exports none
maximum'' :: (Ord a) => [a] -> a
maximum'' = foldl1 (\x acc -> if x > acc then x else acc)
#+end_src

#+NAME:block3
#+begin_src haskell :results silent :exports none
:}
#+end_src

# for export

#+begin_src haskell :noweb yes :exports code
<<block2>>
#+end_src

# for evaluation

#+begin_src haskell :noweb yes :results silent :exports none
<<block1>>
<<block2>>
<<block3>>
#+end_src

Best regards,

Juan Manuel

Galaxy Being <borgauf@gmail.com> writes:

> I have this
>
> #+begin_src haskell :results silent :exports code
> :{
> maximum'' :: (Ord a) => [a] -> a
> maximum'' = foldl1 (\x acc -> if x > acc then x else acc)
> :}
> #+end_src
>
> but on export to HTML (or LaTex) I'd like to suppress the :{ and :} to
> just show the code
>
> maximum'' :: (Ord a) => [a] -> a
> maximum'' = foldl1 (\x acc -> if x > acc then x else acc)
>
> Also, this
>
> #+begin_src haskell :results verbatim :exports both
> maximum'' [1,3,5,2,4]
> #+end_src
>
> I'd like to export the code part with a > REPL prompt included, e.g.,
>
>> maximum'' [1,3,5,2,4]
>
> I once saw some similar tricks, but I've searched and searched and
> can't find them again. There's probably other html export formatting
> I'd like too, but if anyone can point me to that mystery doc I'd
> appreciate it.
>
> ⨽
> Lawrence Bottorff
> Grand Marais, MN, USA
> borgauf@gmail.com
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-02  9:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-02  2:03 Format babel code block for export? Galaxy Being
2021-06-02  9:42 ` Juan Manuel Macías

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