emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Kitchin <jkitchin@andrew.cmu.edu>
To: Matt Price <moptop99@gmail.com>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: handling as special special block in derived export
Date: Wed, 19 Jan 2022 12:18:12 -0500	[thread overview]
Message-ID: <CAJ51ETopN11gBhn1gx7DeCbC+7yM+iOyENZ18SG7jvX2qOSNyw@mail.gmail.com> (raw)
In-Reply-To: <CAN_Dec_w-TzQCwct+LtNLO_Wj11OsGAcOA31Yy5ogB9ZpAzrXg@mail.gmail.com>

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

I am not sure this is quite what you are looking for. You could use a macro
like this.



{{{r-stack(((src1 . fade-out) (src2 . fade-in) (src3 . fade-out)))}}}

* code :noexport:

#+macro: r-stack (eval (r-stack $1))

#+BEGIN_SRC emacs-lisp
(defun r-stack (src-alist)
  "SRC-alist will be a string containing a list of (src . data-fragment)
src is a url or filename
data-fragment

Returns a string for export."
  (let ((src (read src-alist)))
    (format "#+BEGIN_EXPORT html
<div class=\"r-stack\">
%s
</div>
,#+END_EXPORT"
   (string-join
    (cl-loop for (src . data-fragment) in src
     collect
     (format "  <img data-fragment=\"%s\" src=\"%s\"/>"
     data-fragment src))
    "\n"))))


(r-stack "((src1 . fade-out) (src2 . fade-in) (src3 . fade-out))")
#+END_SRC

#+RESULTS:
: #+BEGIN_EXPORT html
: <div class="r-stack">
:   <img data-fragment="fade-out" src="src1"/>
:   <img data-fragment="fade-in" src="src2"/>
:   <img data-fragment="fade-out" src="src3"/>
: </div>
: #+END_EXPORT

You could also make a link do that.

John

-----------------------------------
Professor John Kitchin (he/him/his)
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



On Wed, Jan 19, 2022 at 9:42 AM Matt Price <moptop99@gmail.com> wrote:

> I am trying ot figure out if I can create a simplified syntax for a
> particular special block in a derived HTML exporter.
>
> I'm trying to produce HTML like this:
>
> <div class="r-stack>  <img data-fragment="fade-out" src="...."/>  <img data-fragment="fade-in" src="..."/></div>
>
> The derived backend (org-re-reveal) already has an
>
> #+ATTR_REVEAL that an make the data-fragment attributes, so it's not hard to produce
>  the desired outpu:
>
> #+begin_r-stack
> #+ATTR_REVEAL: :frag appear[[imglink1]]
> #+ATTR_REVEAL: :frag appear[[imglink2]]#+end_r-stack
>
> However, I'd really like to add a less verbose syntax, like this:
>
> #+begin_r-stack :frag (appear appear)[[imglink1]][[imglink2]]#+end_r-stack
>
> My question is: will the exporter preserve information from these header-like arguments, and is
> there a mechanism I can use in a custom ~special-block-function~ to make use of htem?
>
> Thanks for your help as always!
>
> Matt
>
>

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

  reply	other threads:[~2022-01-19 17:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-19 13:52 handling as special special block in derived export Matt Price
2022-01-19 17:18 ` John Kitchin [this message]
2022-01-20 15:21   ` Matt Price
2022-01-20 16:12     ` John Kitchin
2022-01-21  2:46       ` Matt Price
2022-01-19 20:56 ` Berry, Charles
2022-01-20 14:42   ` Matt Price

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://www.orgmode.org/

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

  git send-email \
    --in-reply-to=CAJ51ETopN11gBhn1gx7DeCbC+7yM+iOyENZ18SG7jvX2qOSNyw@mail.gmail.com \
    --to=jkitchin@andrew.cmu.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=moptop99@gmail.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).