Re: emitting custom html5 elements from ionic
Anne Ogborn <[email protected]> Mon, 21 Apr 2014 22:44:57 -0700 (PDT)
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
I think I'd attack this by making a 'fix this' predicate
that takes termerized html and looks for tag names with double underscore in them
and emits the fixed version
(forgive bugs, have not actually tried this)
:- html_meta ix_html(html, ?, ?).
ix_html(In) -->
{
ix(In, Out)
},
html(Out).
%% ix(html, -) is det
ix(In, Out) :-
... bunch of messy code that looks for atoms that have double underscores in their names and replaces them with ones with minus signs.
then replace all html//1 calls with ix_html//1 calls and use data__role for the code that dare not speak it's name.
(or, if you're really desperate, do term expansion, in which case just fixing all atoms with middle position double underscores anywhere in code should do it).
Alternatively, if you have many data-role type elements and use a-b=c infrequently, you could fix a-b to 'a-b' and not use the format-args notation.
I haven't run into it enough to do this admittedly pretty heavy fix, but have found a few places where I was dinking with the browser specific version of properties where it would have been handy. Don't forget that things will have been module resolved by then, you need to handle module decorations properly.
If there's one thing that keeps me a fan of Prolog it's the infinite malleability of the system. You can make it do what you need to, but generally you don't have to jump immediately to some macro world thingum, a la clojure.
Whats needed here is a version of termerized html that is friendlier to custom properties with - in them. OK, we can make that.
8cD