Public vals
26
wilt
pug
Script
Pug HTML Template Renderer This function is equivalent to pug.render - it takes a Pug template string and renders it to an HTML string. import(npm:pug) doesn't work in Val.Town due to Pug's usage of new Function , which is forbidden for security reasons, so this function uses Val.Town's eval API instead. Example const myEndpoint = async (req: express.Request, res: express.Response) => {
const html = await @wilt.pug("p Hello #{name}!", {name: "Pug"});
res.status(200);
res.send(html);
}
0
wilt
getPodcastAudioUrls
Script
Currently, `parseXML` is a val.town builtin function, which comes from the fast-xml-parser npm
package.
By default, fast-xml-parser does not return tag attributes - you need to instantiate your own
parser object and then call its parse method like so:
`new XMLParser({ ignoreAttributes: false }).parse`
This constructor does not seem to be exposed in val.town currently.
This function returns a list of audio file urls, in the order they appear in the feed.
Usually it is safe to assume that the first url is associated with the first episode (by feed
order), but this is not guaranteed.
0
wilt
adcFeed
Script
For ideological reasons, the publisher of this podcast feed opted to include both ogg and mp3
versions of each episode of the podcast.
Unfortunately, the podcast spec as defined by Apple does not allow for multiple audio files in a
single episode.
This val strips out the ogg file, which my podcast player of choice cannot handle, leaving only
the mp3 file.
0