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
convert the fields to html in the template with ->html and store that. Then I include those strings in the outline page.
serialize the txexprs and store, then deserialize them and insert into the page tags to be interpreted in the usual way.
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 to read 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 and open-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.
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?