mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig.space.git
synced 2025-12-13 16:26:50 +00:00
Format feed
This commit is contained in:
39
package-lock.json
generated
39
package-lock.json
generated
@@ -33,7 +33,8 @@
|
|||||||
"postcss-media-variables": "2.0.1",
|
"postcss-media-variables": "2.0.1",
|
||||||
"postcss-nesting": "8.0.1",
|
"postcss-nesting": "8.0.1",
|
||||||
"pug": "3.0.2",
|
"pug": "3.0.2",
|
||||||
"sync-request": "6.1.0"
|
"sync-request": "6.1.0",
|
||||||
|
"xml-formatter": "2.4.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16.0.0"
|
"node": ">=16.0.0"
|
||||||
@@ -4934,6 +4935,27 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/xml-formatter": {
|
||||||
|
"version": "2.4.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/xml-formatter/-/xml-formatter-2.4.1.tgz",
|
||||||
|
"integrity": "sha512-UFnFRNum4BxicU9U4DPhIlHAQqHtT/vTdCvC6fiD78xlpug8YLgawW3MHmT1+eCAM7YomvMGZziiMz9AnExZgQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"xml-parser-xo": "^3.1.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/xml-parser-xo": {
|
||||||
|
"version": "3.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/xml-parser-xo/-/xml-parser-xo-3.1.2.tgz",
|
||||||
|
"integrity": "sha512-Qyttmiy305unyg1ONpArT4FPDL3J+ohXWpMI1ecopClGMw53lCRHJ4FV/fVYHFU6qfEzMV0frqSlNaLo2dw15Q==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/xmlhttprequest-ssl": {
|
"node_modules/xmlhttprequest-ssl": {
|
||||||
"version": "1.6.2",
|
"version": "1.6.2",
|
||||||
"resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.6.2.tgz",
|
"resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.6.2.tgz",
|
||||||
@@ -9027,6 +9049,21 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {}
|
"requires": {}
|
||||||
},
|
},
|
||||||
|
"xml-formatter": {
|
||||||
|
"version": "2.4.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/xml-formatter/-/xml-formatter-2.4.1.tgz",
|
||||||
|
"integrity": "sha512-UFnFRNum4BxicU9U4DPhIlHAQqHtT/vTdCvC6fiD78xlpug8YLgawW3MHmT1+eCAM7YomvMGZziiMz9AnExZgQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"xml-parser-xo": "^3.1.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"xml-parser-xo": {
|
||||||
|
"version": "3.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/xml-parser-xo/-/xml-parser-xo-3.1.2.tgz",
|
||||||
|
"integrity": "sha512-Qyttmiy305unyg1ONpArT4FPDL3J+ohXWpMI1ecopClGMw53lCRHJ4FV/fVYHFU6qfEzMV0frqSlNaLo2dw15Q==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"xmlhttprequest-ssl": {
|
"xmlhttprequest-ssl": {
|
||||||
"version": "1.6.2",
|
"version": "1.6.2",
|
||||||
"resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.6.2.tgz",
|
"resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.6.2.tgz",
|
||||||
|
|||||||
@@ -53,6 +53,7 @@
|
|||||||
"postcss-media-variables": "2.0.1",
|
"postcss-media-variables": "2.0.1",
|
||||||
"postcss-nesting": "8.0.1",
|
"postcss-nesting": "8.0.1",
|
||||||
"pug": "3.0.2",
|
"pug": "3.0.2",
|
||||||
"sync-request": "6.1.0"
|
"sync-request": "6.1.0",
|
||||||
|
"xml-formatter": "2.4.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ const { masterFeedUrl, publicFeedUrl } = require('../content/meta.json')
|
|||||||
const nodes = require('../content/nodes.json')
|
const nodes = require('../content/nodes.json')
|
||||||
const request = require('sync-request')
|
const request = require('sync-request')
|
||||||
const parser = require('fast-xml-parser')
|
const parser = require('fast-xml-parser')
|
||||||
const JSON2XMLParser = require("fast-xml-parser").j2xParser;
|
const JSON2XMLParser = require('fast-xml-parser').j2xParser
|
||||||
|
const xmlFormat = require('xml-formatter')
|
||||||
const he = require('he')
|
const he = require('he')
|
||||||
|
|
||||||
const debug = process.env.CI
|
const debug = process.env.CI
|
||||||
@@ -14,12 +15,12 @@ const write = (name, data) => writeFileSync(join(dir, name), data)
|
|||||||
const writeJSON = (name, data) => write(`generated/${name}.json`, JSON.stringify(data, null, 2))
|
const writeJSON = (name, data) => write(`generated/${name}.json`, JSON.stringify(data, null, 2))
|
||||||
|
|
||||||
const commonOpts = {
|
const commonOpts = {
|
||||||
attributeNamePrefix: "",
|
attributeNamePrefix: '',
|
||||||
attrNodeName: "__attr",
|
attrNodeName: '__attr',
|
||||||
textNodeName: "#text",
|
textNodeName: '#text',
|
||||||
ignoreAttributes: false,
|
ignoreAttributes: false,
|
||||||
cdataTagName: "__cdata",
|
cdataTagName: '__cdata',
|
||||||
cdataPositionChar: "\\c"
|
cdataPositionChar: '\\c'
|
||||||
}
|
}
|
||||||
|
|
||||||
const xml2jsonOpts = {
|
const xml2jsonOpts = {
|
||||||
@@ -41,7 +42,7 @@ const xml2jsonOpts = {
|
|||||||
var json2xmlOpts = {
|
var json2xmlOpts = {
|
||||||
...commonOpts,
|
...commonOpts,
|
||||||
format: false,
|
format: false,
|
||||||
indentBy: " ",
|
indentBy: ' ',
|
||||||
supressEmptyNode: false,
|
supressEmptyNode: false,
|
||||||
tagValueProcessor: a => a,
|
tagValueProcessor: a => a,
|
||||||
attrValueProcessor: a => he.encode(a, { isAttributeValue: true, useNamedReferences: true })
|
attrValueProcessor: a => he.encode(a, { isAttributeValue: true, useNamedReferences: true })
|
||||||
@@ -139,8 +140,7 @@ const parseEpisode = e => {
|
|||||||
const outputXML = JSON2XML.parse(feed)
|
const outputXML = JSON2XML.parse(feed)
|
||||||
|
|
||||||
writeJSON('episodes', episodes)
|
writeJSON('episodes', episodes)
|
||||||
write('dist/feed.xml', outputXML)
|
write('dist/feed.xml', xmlFormat(outputXML, { indentation: ' ', collapseContent: true }))
|
||||||
write('dist/anchor.xml', anchorXML)
|
|
||||||
|
|
||||||
if (_noParticipants.length) {
|
if (_noParticipants.length) {
|
||||||
console.log('Keine Teilnehmerliste')
|
console.log('Keine Teilnehmerliste')
|
||||||
|
|||||||
Reference in New Issue
Block a user