emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: sebastien.miquel@posteo.eu
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: [POLL] Naming of "export features"
Date: Mon, 27 Feb 2023 19:32:10 +0000	[thread overview]
Message-ID: <87sfeqyked.fsf@localhost> (raw)
In-Reply-To: <4cf06875-2494-9a17-8c6a-b4bd9449b28b@posteo.eu>

Sébastien Miquel <sebastien.miquel@posteo.eu> writes:

>> The proposed template system will provide more flexibility to modify the
>> default export transcoders.
> Reading your original proposal, I see nothing that provides more
> flexibility. I can guess at how it would allow one to prepend/append
> stuff to the output of the default transcoder. Anything more flexible
> than that would require breaking these default transcoders into parts,
> which you did not originally mention.

Here is my refined proposal, which we converged to upon further
discussion with TEC. Basically, we will extend the notion of export
transcoder to be a list instead of a function:

  (table :snippets ((table-begin :when caption :snippet "\\begin{table}[htbp]")
                    (caption :snippet (format "\\caption{%s}" (<get caption>)))
                    (centering :snippet "\\centering")
                    (tabular-begin :snippet (format "\\begin{tabular}%s" <get-align>))
                    (contents :snippet <get-contents>)
                    (tabular-end :snippet "\\end{tabular}")
                    (table-end :when caption :snippet "\\end{table}")
          :conditions ((t . table-begin centering table-end tabular-begin contents tabular-end)
                       ((lambda (el info) (org-element-property :caption el)) . caption)))

>>> Here's a couple interesting examples that currently cannot, I think.
>>>    + a `multicol` heading property, that wraps the content of the
>>>      heading in a multicol environment.
>> Could you please illustrate with examples?
> Exported content would be:
> #+BEGIN_SRC latex
> \section{ABC}
> \begin{multicols}{3}
>    Section content
> \end{multicols}

With new template system, it will be very easy. You just need to add new
elements to the section template:

By default:

(section :snippets ((contents :snippet (lambda (_ _ contents) contents))))

You can just add

(wrap-multicol-begin :before contents :snippet "\\begin{multicols}{3}")
(wrap-multicol-end :after contents :snippet "\\end{multicols}")

:conditions (t . wrap-multicol-begin wrap-multicol-end)

>>>    + a `nocontent` property that do not export the content of the
>>>      heading
>> This can be done with :filter-parse-tree or :filter-headline
> I guess. This isn't "couple of lines"-easy though.

Sure. With new system, it will be just

:snippets (section)
(prevent-contents :prevents contents)
(t . prevent-contents)

> See higher. More flexibility requires breaking up some transcoders
> into pieces. AFAIU it, the proposal you originally described does not
> bring any more flexibility beyond what can be done through short
> advices, or indeed the `:filter-` functions. I'm not sure this
> dedicated syntax is preferable to advices.

I hope that the above examples clarified things.
As you can see, it is possible to manipulate the order of elements in
the original templates and disable some existing parts quite easily.

Of course, we will first need to rewrite built-in transcoders into
templates. Most of them can be rewritten rather trivially, fortunately.

Ihor Radchenko // yantar92,
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:[~2023-02-27 19:32 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-10 17:20 [PATCH] Introduce "export features" Timothy
2023-02-11 11:37 ` Ihor Radchenko
2023-02-20 17:41 ` Timothy
2023-02-24 12:51   ` Sébastien Miquel
2023-02-24 12:59     ` Ihor Radchenko
2023-02-24 21:47       ` Sébastien Miquel
2023-02-26 12:19         ` Ihor Radchenko
2023-02-26 13:04           ` Sébastien Miquel
2023-02-27 19:05             ` Ihor Radchenko
2023-02-25  3:15     ` Timothy
2023-02-21 14:22 ` [POLL] Naming of " Timothy
2023-02-22  1:46   ` Dr. Arne Babenhauserheide
2023-02-22  2:40     ` Timothy
2023-02-23 15:55       ` No Wayman
2023-02-23 16:17         ` No Wayman
2023-02-22 12:23   ` Ihor Radchenko
2023-02-23 15:31     ` No Wayman
2023-02-23 16:04     ` Bruce D'Arcus
2023-02-23 19:04       ` Ihor Radchenko
2023-02-23 19:55     ` Sébastien Miquel
2023-02-24 10:27       ` Ihor Radchenko
2023-02-24 12:46         ` Sébastien Miquel
2023-02-24 13:03           ` Ihor Radchenko
2023-02-24 21:38             ` Sébastien Miquel
2023-02-26 12:28               ` Ihor Radchenko
2023-02-26 14:06                 ` Sébastien Miquel
2023-02-27 19:32                   ` Ihor Radchenko [this message]
     [not found] <mailman.336.1676990100.5072.emacs-orgmode@gnu.org>
2023-02-23 15:06 ` No Wayman
2023-03-01  8:26 Pedro Andres Aranda Gutierrez
2023-03-01  9:41 ` Ihor Radchenko
2023-03-01 11:38   ` Pedro Andres Aranda Gutierrez
2023-03-02 11:30     ` Ihor Radchenko

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:

  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=87sfeqyked.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=sebastien.miquel@posteo.eu \


* 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


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).