luavreis / org-mode-hs

Libraries and tool for parsing Org Mode documents with customizable exporters. 🦄
GNU General Public License v3.0
22 stars 5 forks source link

Basic export to anything without ondim? #20

Closed schoettl closed 2 months ago

schoettl commented 2 months ago

Just a questions, is there a simple way to export the org AST or even just OrgObject to any human readable format (like org, markdown, html) without org-exporters and ondim?

Because the project I'm using your library relies on GHC 9.6 and ondim doesn't seem to compile there.

ondim> /tmp/stack-432982cf9e5df8dc/ondim-0.1.0.0/src/Ondim/Loading.hs:87:27: error: [GHC-83865]
ondim>     • Couldn't match type: (FilePath, Maybe FilePath)
ondim>                      with: [Char]
ondim>       Expected: [GHC.IsList.Item (Set ((Int, FilePath), FilePath))]
ondim>         Actual: [((Int, FilePath), (FilePath, Maybe FilePath))]
ondim>     • In the first argument of ‘fromList’, namely
ondim>         ‘(zip (zip [1 .. ] (fst <$> places)) places)’
ondim>       In the expression:
ondim>         fromList (zip (zip [1 .. ] (fst <$> places)) places)
ondim>       In an equation for ‘sources’:
ondim>           sources = fromList (zip (zip [1 .. ] (fst <$> places)) places)
ondim>    |
ondim> 87 |   let sources = fromList (zip (zip [1 ..] (fst <$> places)) places)
luavreis commented 2 months ago

Just a questions, is there a simple way to export the org AST or even just OrgObject to any human readable format (like org, markdown, html) without org-exporters and ondim?

No there isn't and this is on purpose, because the project relies entirely on the templates for this. I'm not willing to write or maintain other Haskell files implementing "hardcoded" export options. Only JSON (or yaml) is available without the templates but I think this is not what you want.

Because the project I'm using your library relies on GHC 9.6 and ondim doesn't seem to compile there.

This is strange, I'm not familiar with Stack but this should not happen with Cabal. You should make sure that it is using Ondim at the specific commit https://github.com/lucasvreis/ondim/tree/6bbb553d1e75f1a2f45db915804292e80ce0139 as declared in cabal.project file (also make sure the other package versions listed there are respected as well). This file that is erroing does not even exist at this commit.

luavreis commented 2 months ago

Note that if you want to build a binary bundled with the required template files this is entirely possible, in fact org-cli does exactly that.

schoettl commented 2 months ago

Thanks @lucasvreis! I now used the commit from your link above and it compiles. I first just used the latest commit from branch main which was f44b0149d.

Now I can hopefully figure out how to export using ondim :)

I also got horg running but I rather like to integrate it into a Yesod app.

luavreis commented 2 months ago

Now I can hopefully figure out how to export using ondim :)

Hopefully this file can give you some idea: https://github.com/lucasvreis/org-mode-hs/blob/main/org-cli/app/org-cli.hs

Unfortunately that older version of Ondim is missing docstrings and its user interface is a bit messy, but feel free to open issues if you need help.