How Do I do meta_attributes?
Anne Ogborn <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
There are actually two different DSL's associated with html//1
I ran into this situation - because I don't want the 304 bug I reported to appear during the workshop,
I decided I'd use the old 'add a random parameter' trick to my images, so
/f/someimage.png?r=239323
to defeat caching.
I s/img/\img_fix/
html(\img_fix([src('/f/'+File), class(illustration), alt(Alt)], [])),
and write img_fix
:- html_meta img_fix(+, html, ?, ?).
img_fix(Attribs, Contents) -->
{
member(src(Src), Attribs),
random(N),
format(atom(UniqSrc), '~w?r=~w', [Src, N]),
select(src(Src), Attribs, src(UniqSrc), NewAttribs)
},
html(img(NewAttribs, Contents)).
img_fix(Attribs, Contents) -->
html(img(Attribs, Contents)).
Oops! Generated HTML is suddenly
<img src="/f/ + organization.png?r=0.7694838936298265" class="illustration" alt="Overall Server Organization">
I can't change first param of html_meta to html because the attributes aren't recognized as html.
Do we need an additional type for html_meta, 'attributes' ?
Or to somehow expose html_write:attributes/2 ?
Or perhaps I'm misunderstanding html_quoted_attribute?
8cS Small bit of unniftiness invades Annie's mostly nifty swipl world.