Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML Export #9

Open
mclearc opened this issue Jan 2, 2017 · 3 comments
Open

HTML Export #9

mclearc opened this issue Jan 2, 2017 · 3 comments

Comments

@mclearc
Copy link

mclearc commented Jan 2, 2017

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.

@caiorss
Copy link
Owner

caiorss commented Jan 2, 2017

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.

@mclearc
Copy link
Author

mclearc commented Jan 8, 2017

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.

@mclearc
Copy link
Author

mclearc commented May 10, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants