Zap non-alphanumeric characters in slugs
This commit is contained in:
parent
a39efc3a5f
commit
fa597a9339
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "publikator",
|
"name": "publikator",
|
||||||
"version": "0.17.1",
|
"version": "0.17.2",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"repository": "https://github.com/aengl/publikator.git",
|
"repository": "https://github.com/aengl/publikator.git",
|
||||||
"author": "Lynn Smeria <ae@cephea.de>",
|
"author": "Lynn Smeria <ae@cephea.de>",
|
||||||
|
|
|
@ -9,15 +9,16 @@ const tags = require('./tags');
|
||||||
/**
|
/**
|
||||||
* Given a track file, return the album name.
|
* Given a track file, return the album name.
|
||||||
*/
|
*/
|
||||||
const getAlbumName = file => file.common.album.replace(/ /g, '-').toLowerCase();
|
const getAlbumName = file =>
|
||||||
|
file.common.album.replace(/[\W_]+/g, '-').toLowerCase();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a track file, return the new file name.
|
* Given a track file, return the new file name.
|
||||||
*/
|
*/
|
||||||
const getFileName = file =>
|
const getFileName = file =>
|
||||||
`${file.common.track.no}-${file.common.title}${path.extname(file.path)}`
|
`${file.common.track.no}-${file.common.title
|
||||||
.replace(/ /g, '-')
|
.replace(/[\W_]+/g, '-')
|
||||||
.toLowerCase();
|
.toLowerCase()}${path.extname(file.path)}`;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Strips the extension from a file name;
|
* Strips the extension from a file name;
|
||||||
|
|
Loading…
Reference in a new issue