emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [POLL] Naming of "export features"


From: Ihor Radchenko
Subject: Re: [POLL] Naming of "export features"
Date: Mon, 27 Feb 2023 19:32:10 +0000

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:

:translate-alist
'(...
  (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}
> #+END_SRC

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

:snippets
(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)
:conditions
(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 via email to

[Prev in Thread] Current Thread [Next in Thread]