From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: rey-coyrehourcq <sebastien.rey-coyrehourcq@univ-rouen.fr>
Cc: emacs-orgmode@gnu.org
Subject: Re: How to reinject custom function into derived backend which doesn't implement it, ex : footnote in ox-slimhtml backend.
Date: Tue, 27 Apr 2021 23:25:09 +0200 [thread overview]
Message-ID: <87sg3bifnu.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <2d0b1df3720133e089e4e45af09f5faf1c21f4ac.camel@univ-rouen.fr> (rey-coyrehourcq's message of "Fri, 02 Oct 2020 22:26:43 +0200")
Hello,
rey-coyrehourcq <sebastien.rey-coyrehourcq@univ-rouen.fr> writes:
> Actually footnotes are not defined in ox-slimhtml, so as i read in the org documentation [1] ),
> i try to add this capacity by simply calling vanilla ox-html function org-html-footnote-reference into translate-alist :
>
> (org-export-define-derived-backend 'ox-slimhtml-publish-to-html 'slimhtml
The first argument of `org-export-define-derived-backend' should be the
name of the new back-end, as a symbol, not the function used to publish.
E.g,
(org-export-define-derived-backend 'slimhtml-improved 'slimhtml
....)
> :translate-alist '((bold . ox-slimhtml-bold)
>
> (footnote-reference . org-html-footnote-reference)
> (verse-block . org-html-
> verse-block)
> (special-block . org-html-special-block)))
>
> Using the vanilla ox-html export function, everything is awesome and footnote appear in my html, normal.
>
> :publishing-function org-blog-publish-to-html
>
> But if i switch to ":publishing-function ox-slimhtml-publish-to-html"
> the function
You need to define your own publishing function with the help of
`org-publish-org-to' and make it use `slimhtml-improved. Here you're
re-using plain slimhtml, without your additions. E.g.,
(defun ox-slimhtml-improved-publish-to-html (plist filename pub-dir)
"Publish an org file to html.
PLIST is the property list for the given project. FILENAME
is the filename of the Org file to be published. PUB-DIR is
the publishing directory.
Return output file name."
(let ((html-extension (or (plist-get plist :html-extension) org-html-extension)))
(org-publish-org-to 'slimhtml-improved
filename
(if (and html-extension (not (string= "" html-extension)))
(concat "." html-extension) "")
plist
pub-dir)))
Then you can set :publishing-function to `org-slimhtml-publish-to-html'.
> There is something i don't understand in the processing of "translate-alist", so perhaps if the derived backend doesn't
> implement a footnote-reference function, i cannot extend it ?
You should be able to extend it.
Regards,
--
Nicolas Goaziou
prev parent reply other threads:[~2021-04-27 21:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-02 20:26 How to reinject custom function into derived backend which doesn't implement it, ex : footnote in ox-slimhtml backend rey-coyrehourcq
2021-04-27 20:42 ` Bastien
2021-04-27 21:25 ` Nicolas Goaziou [this message]
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=87sg3bifnu.fsf@nicolasgoaziou.fr \
--to=mail@nicolasgoaziou.fr \
--cc=emacs-orgmode@gnu.org \
--cc=sebastien.rey-coyrehourcq@univ-rouen.fr \
/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).