all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to reinject custom function into derived backend which doesn't implement it, ex : footnote in ox-slimhtml backend.
@ 2020-10-02 20:26 rey-coyrehourcq
  2021-04-27 20:42 ` Bastien
  2021-04-27 21:25 ` Nicolas Goaziou
  0 siblings, 2 replies; 3+ messages in thread
From: rey-coyrehourcq @ 2020-10-02 20:26 UTC (permalink / raw)
  To: emacs-orgmode

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


Hi,

I'm trying to develop my own `publish.el` for some research project linked to reproductibility. 
I chose ox-slimhtml [0] as derived backend to limit and simplify the html/css outputs generated by vanilla html
backend/publish. 

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
  :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 
org-html-footnote-reference is never called.

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 ?

If you have some higlight on this, or solution on this problem, i'm interested.

[0] https://github.com/balddotcat/ox-slimhtml
[1] https://orgmode.org/manual/Advanced-Export-Configuration.html

Best 
-- 

Sébastien Rey-Coyrehourcq
Research Engineer UMR IDEES
02.35.14.69.30

{Stronger security for your email, follow EFF tutorial : https://ssd.eff.org/}


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to reinject custom function into derived backend which doesn't implement it, ex : footnote in ox-slimhtml backend.
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Bastien @ 2021-04-27 20:42 UTC (permalink / raw)
  To: rey-coyrehourcq; +Cc: emacs-orgmode

Hi,

rey-coyrehourcq <sebastien.rey-coyrehourcq@univ-rouen.fr> writes:

> I'm trying to develop my own `publish.el` for some research project
> linked to reproductibility.

You didn't receive much feedback - sorry for that.

Did you make progress about your project?


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to reinject custom function into derived backend which doesn't implement it, ex : footnote in ox-slimhtml backend.
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Nicolas Goaziou @ 2021-04-27 21:25 UTC (permalink / raw)
  To: rey-coyrehourcq; +Cc: emacs-orgmode

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-27 21:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.