balddotcat / ox-slimhtml

a minimalist HTML org-export backend
68 stars 9 forks source link

Support footnotes ? #7

Open reyman opened 3 years ago

reyman commented 3 years ago

Hi @balddotcat ,

I'm using your light html export for a project, so first thank you for this work !

As i see, i don't found footnote support (:with-footnotes), very common in academic website. Same with option org-html-footnotes-section

I also try this :

(org-export-define-derived-backend 'ox-slimhtml-publish-to-html 'slimhtml
  :translate-alist '((bold . ox-slimhtml-bold)
                     (footnote-definition . org-html-footnote-definition)
                     (footnote-reference . org-html-footnote-reference)
                     (special-block . org-html-special-block)))

Could you please add some paragraph of documentation to explain how users could expand ox-slimhtml to reinject ox-html missing part, like footnotes ?

Thanks,

coldacid commented 3 years ago

Similar for me, but with images.

reyman commented 3 years ago

I take some times to extend slim with footnotes, i try to share the content here during the next week, using pull request or directly here.

balddotcat commented 3 years ago

Thanks for your input, I am truly glad to see this bit of code getting good use! My deepest apologies for being AWOL; I've no excuses, just life, work and all.

regarding extending the exporter;

@reyman, I think your pretty much on target, except you're probably confusing the exporter by utilizing the publishing function's name (ox-slimhtml-publish-to-html) as the name of your derived exporter. The first argument is just a string you define yourself.

Otherwise, expanding a derived exporter's functionality is as you've defined with 'special-block'; if you look at slimhtml's backend definition alist, (starting at line 472), you'll notice that for things like the 'item' element, I've just linked to the original exporter, ie org-html-item.

Also, note that there's really no difference between an org-export-define-derived-backend, and org-export-define-backend definition - the former just gives you the opportunity to override a base implementation with specialized functionality.

regarding images and footnote references;

Thank you very much for looking into the footnotes - I'm certain many people will benefit from it!

Both of these items do seem to be a little hairier to implement cleanly, but all of the functionality is available in 'ox-html'; the trick is finding only what's most relevant to this minimalistic exporter. I have not utilized these, but they both seem to start from within 'org-html-paragraph'.

Again - many thanks - please let me know if this makes thing clearer, or if there's anything else I can help with.