🐛 Adds encoding entities
All checks were successful
Update RSS / update-rss (push) Successful in 5m13s
All checks were successful
Update RSS / update-rss (push) Successful in 5m13s
This commit is contained in:
15
cli.mjs
15
cli.mjs
@ -87,11 +87,11 @@ async function toRSS({ json, changed }){
|
||||
return [
|
||||
"<item>",
|
||||
...[
|
||||
`<title>${title}</title>`,
|
||||
`<title>${encodeToXml(title)}</title>`,
|
||||
`<link>${host+loc}</link>`,
|
||||
`<guid>${host+loc}</guid>`,
|
||||
`<description>${perex}</description>`,
|
||||
`<dc:creator>${author}</dc:creator>`,
|
||||
`<description>${encodeToXml(perex)}</description>`,
|
||||
`<dc:creator>${encodeToXml(author)}</dc:creator>`,
|
||||
`<pubDate>${pubDate(json.drops.find(d=> d.drop === drop).date)}</pubDate>`,
|
||||
`<category>${drop}</category>`,
|
||||
].map(l=> "\t"+l),
|
||||
@ -154,6 +154,15 @@ async function sitemap(){
|
||||
s.echo(JSON.stringify(json, null, "\t")).to(path);
|
||||
return { json, changed: [ path ] };
|
||||
}
|
||||
function encodeToXml(str){
|
||||
if(!str) return str;
|
||||
return str
|
||||
.replace(/&/g, "&")
|
||||
.replace(/"/g, """)
|
||||
.replace(/'/g, "'")
|
||||
.replace(/</g, "<")
|
||||
.replace(/>/g, ">");
|
||||
}
|
||||
function knownSitemap(){
|
||||
const path= "sitemap.json";
|
||||
/** @type {Sitemap} */
|
||||
|
Reference in New Issue
Block a user