emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: "Juan Manuel Macías" <maciaschain@posteo.net>
Cc: orgmode <emacs-orgmode@gnu.org>
Subject: Re: [Patch] Pre-/postpend arbitrary LaTeX code to a section
Date: Mon, 26 Sep 2022 11:56:49 +0800	[thread overview]
Message-ID: <87czbi7pq6.fsf@localhost> (raw)
In-Reply-To: <87a66nmzfb.fsf@posteo.net>

Juan Manuel Macías <maciaschain@posteo.net> writes:

> Going back to the earlier :ATTR_BACKEND: issue as a property for
> headings, I've been doing some testing and scribbled down a possible
> function[1] whose code is almost entirely stolen from
> org-export-read-attribute, with some modifications. Evaluated at the
> headline, it returns the value of the ATTR_BACKEND property as a plist.
> And then that plist could be easily manipulated on each backend to
> format export_template conveniently. For example:
>
> * headline
> :PROPERTIES:
> :ATTR_LaTeX: :export_template \begin{myenv}\n%s\n\end{myenv}
> :ATTR_LaTeX+: blah blah blah
> :END:
>
> ==> (:export_template "\\begin{myenv}\\n%s\\n\\end{myenv} blah blah blah")
>
> I don't know if that would be the way to go...

What I have in mind is to modify `org-export-read-attribute' directly.
Then, we can call `org-export-read-attribute' in `org-export-data';
resolve the refs in the template (re-use code from
`org-babel-ref-resolve' and `org-babel-parse-multiple-vars'); do normal
export and pass it to the template. Before running the normal export, we
strip :export_template from the INFO to avoid issues with ox-html which
puts every single attr into the generated html.

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92


  reply	other threads:[~2022-09-26  3:56 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-18 12:27 [Patch] Pre-/postpend arbitrary LaTeX code to a section Juan Manuel Macías
2022-09-18 16:14 ` Max Nikulin
2022-09-19 10:04 ` Fraga, Eric
2022-09-20 13:26 ` Ihor Radchenko
2022-09-20 17:18   ` Juan Manuel Macías
2022-09-21  8:55     ` Ihor Radchenko
2022-09-21  9:32       ` Fraga, Eric
2022-09-21  9:49         ` Timothy
2022-09-22 13:50         ` Ihor Radchenko
2022-09-21 13:55       ` Daniel Fleischer
2022-09-21 14:51         ` Juan Manuel Macías
2022-09-21 15:21         ` Fraga, Eric
2022-09-22 13:51         ` Ihor Radchenko
2022-09-21 14:42       ` Max Nikulin
2022-09-21 14:43       ` Juan Manuel Macías
2022-09-22 14:08         ` Ihor Radchenko
2022-09-24 14:50           ` Juan Manuel Macías
2022-09-25  3:33             ` Ihor Radchenko
2022-09-25 12:06               ` Juan Manuel Macías
2022-09-26  3:56                 ` Ihor Radchenko [this message]
2022-09-26  7:47                   ` Juan Manuel Macías

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=87czbi7pq6.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=maciaschain@posteo.net \
    /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).