caiorss / org-wiki

Wiki for Emacs org-mode built on top of Emacs org-mode.

Home Page:https://caiorss.github.io/org-wiki/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HTML Export

mclearc opened this issue · comments

Is it possible to use other export backends for org-wiki for html? I was hoping to use ox-twbs if possible. One thing I've noticed though is that the links don't export well. A file named 'file.org' will export to 'file.html' but the link will only be to 'file' without the 'html' suffix.

Is it possible to use other export backends for org-wiki for html?

I guess that it is possible. I tried with ox-twbs and I haven't been successful yet.

When the user exports a page to html by using M-x org-wiki-export-html or M-x org-wiki-export-html-sync the function below is invoked and transforms the hyperlink wiki:page to <a href='page.html>page</a> .

(defun org-wiki--org-link (path desc backend)
  "Creates an html org-wiki pages when  exporting to html.
Example: The hyperlink [[wiki:Linux][Dealing with Linux]]
will be exported to <a href='Linux.html'>Dealing with Linux</a>"
   (cl-case backend
     (html (format
            "<a href='%s.html'>%s</a>"
            path
            (or desc path)))))

Add the protocols:

;;; Custom Protocols
(add-hook 'org-mode-hook
          (lambda ()
            (org-add-link-type  "wiki"
                                #'org-wiki--open-page
                                #'org-wiki--org-link )
            (org-add-link-type  "wiki-asset-sys"
                                #'org-wiki--protocol-open-assets-with-sys
                                #'org-wiki--asset-link)))

I tried to modify this function to the code below. But it didn't work. A wiki link wiki:page that corresponds to file page.org should be exported to<a href='page.html>page</a>, but is exported to <a href='page>page</a> . By running the commands M-x org-twbs-publish-to-html or M-x org-twbs-export-to-html the protocol handler org-wiki--org-link is not called.

It will require more time to implement. I will work on this.

(defun org-wiki--org-link (path desc backend)
  "Creates an html org-wiki pages when  exporting to html.
Example: The hyperlink [[wiki:Linux][Dealing with Linux]]
will be exported to <a href='Linux.html'>Dealing with Linux</a>"
   (cl-case backend
     (html (format
            "<a href='%s.html'>%s</a>"
            path
            (or desc path))))

     (twbs (format
            "<a href='%s.html'>%s</a>"
            path
            (or desc path))))

This code was inspired by Embedding Youtube videos with org-mode links

Best regards.

A wiki link wiki:page that corresponds to file page.org should be exported to<a href='page.html>page, but is exported to <a href='page>page . By running the commands M-x org-twbs-publish-to-html or M-x org-twbs-export-to-html the protocol handler org-wiki--org-link is not called

Yep - I was having this same problem.

It will require more time to implement. I will work on this.

Thanks! I wish my elisp skills were better so that I could help. Should I come up with a solution, I'll post it here.

Have you by any chance made any progress on this? I can get org-wiki to reliably export using ox-pandoc as a backend, but continue to have a problem with it not translating the links. They remain saying wiki:page in the html output, even though the org-link-parameters alist says that wiki export is set to org-wiki--org-link. So I'm not sure what's wrong.