serialising txexprs?
#117
Closed
opened 3 years ago by aalexei
·
2 comments
Loading…
Reference in New Issue
There is no content yet.
Delete Branch '%!s(<nil>)'
Deleting a branch is permanent. It CANNOT be undone. Continue?
Hi, I'm trying to create pages that contain a list of other pages. Like a subject outline and description followed by a list of pages containing material.
In my html template I save metadata to an sqlite database, and in the subject outline I can pick up that data for every page. The problem is that some of the data I want to store, like the title and abstract, can contain arbitrarily nested txexprs. Two possible approaches I've tried but not managed to get working are
->html
and store that. Then I include those strings in the outline page.For the first, I just get the html tags in the text as strings not as html code, which I guess makes sense. The second approach seems more general but I don't know how to serialize some nested txexprs to a string that sqlite accepts. Anyone have some pointers I could try?
If you
write
the txexpr to a string, you will be able toread
it back in again!Read those docs carefully and experiment a bit in a REPL. They operate on ports, not strings, so you will need to convert your strings to ports with, e.g.,
open-input-string
andopen-output-string
.Ahh, thank you for that! Got it working nicely. My bouncing around the docs and experimenting in a REPL just wasn't finding how to connect strings and ports together.