Colourizing

So, it’s hack day, and we’re hacking, and I want to extend what the termerized html colorizer understands.

This is James’ syntax for his vue integration

todo_list -->
    vue_html([vue_list(todo in items,
                       li(class(todo),
                           [$(todo.desc),
                            input([type(submit), name(delete), value($(todo.id))])
                           ])
                      )]).

todo in items and $(todo.id) need extended.

It’s not obvious to me how we should be extending the colourization to make this happen. I’m under the impression I extend what is valid with
html_write:expand//1
but remain baffled how to do so. Making an expansion, it never gets called.

Oh great Jan, hear our plea - enlighten us.

The colouring code is in html_write.pl. Using the expand//1 hook is in my current perspective a mistake, at least to support user extensions. It is also used to process the output of the HTML parser. That is fine. Users should use \callable to create modular pages. All the coloring for that should work just fine.

Well, then how DO we support user extensions? Is this one more case of probe the system and it has to grow?

If you’ve got time today, might be really valuable to make this work with James Cash. Now early evening here.

anniepoo https://swi-prolog.discourse.group/u/anniepoo
February 17

Well, then how DO we support user extensions? Is this one more case of
probe the system and it has to grow?

Write a module, export DCG rules to do the things you want abstracted.
For usage, import the module and use \Callable.

The extension hooks is not modular and, as said, intended for other
purposes.

If you’ve got time today, might be really valuable to make this work
with James Cash. Now early evening here.

I guess James can figure it out using the above. I’m mostly offline today.

Cheers --- Jan

Well, admittedly things like vue, and even more so React JSX, are best handled with their own quasiquoters. But that’s not a composable solution.