file naming normalisation
This commit is contained in:
parent
99adc9c445
commit
a3056fb72d
4 changed files with 26 additions and 7 deletions
BIN
marvin256x256.png
Normal file
BIN
marvin256x256.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
16
package.json
16
package.json
|
|
@ -33,18 +33,30 @@
|
|||
"prod": "cross-env NODE_ENV=production webpack --mode production --config webpack.build.config.js && electron --noDevServer .",
|
||||
"start": "cross-env NODE_ENV=development webpack serve --hot --host 0.0.0.0 --config=./webpack.dev.config.js --mode development",
|
||||
"build": "cross-env NODE_ENV=production webpack --config webpack.build.config.js --mode production",
|
||||
"installer": "electron-builder",
|
||||
"installer": "electron-builder -lw",
|
||||
"package": "npm run build",
|
||||
"postpackage": "electron-packager ./ --ignore 'resources/files' --out=./builds --asar --overwrite --platform win32,linux --icon marvin.ico --extra-resource 'resources/files'"
|
||||
},
|
||||
"build": {
|
||||
"appId": "marvin",
|
||||
"appId": "org.nasarek.marvin",
|
||||
"extraResources": [{
|
||||
"from": "resources/files",
|
||||
"to": "files"
|
||||
}],
|
||||
"win": {
|
||||
"target": [
|
||||
"nsis"
|
||||
],
|
||||
"icon": "marvin256x256.ico"
|
||||
},
|
||||
"linux": {
|
||||
|
||||
"target": [
|
||||
"deb"
|
||||
],
|
||||
"icon": "marvin256x256.png",
|
||||
"category": "Utility"
|
||||
},
|
||||
"nsis": {
|
||||
"oneClick": false,
|
||||
"installerIcon": "marvin.ico",
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
{
|
||||
"rootDir": "C:\\Users\\Robert\\Desktop\\marvin"
|
||||
"rootDir": "/home/rbrt/Schreibtisch/marvin"
|
||||
}
|
||||
|
|
@ -92,10 +92,17 @@ export async function fillTemplate(log, objectData) {
|
|||
|
||||
// Write document to disk.
|
||||
if (buffer) {
|
||||
const normCharacterObjectId = replaceSpecialCharacters(objectData.inventarnummer)
|
||||
const normCharacterTitle = replaceSpecialCharacters(objectData.titel)
|
||||
const normSpacingTitle = normCharacterTitle.replace(/[^A-Z0-9]+/ig, "_");
|
||||
const filename = objectData.datum + '_' + normCharacterObjectId + '_' + normSpacingTitle + '.docx'
|
||||
// ObjectId normalisation.
|
||||
const normCharacterObjectId = replaceSpecialCharacters(objectData.inventarnummer);
|
||||
const normSpacingObjectId = normCharacterObjectId.replace("__", "_");
|
||||
// Title normalisation
|
||||
const replaceEszettTitle = objectData.titel.replace("ß", "ss");
|
||||
const normCharacterTitle = replaceSpecialCharacters(replaceEszettTitle);
|
||||
const normSingleSpaceTitle = normCharacterTitle.replace("__", "_");
|
||||
const normSpacingTitle = normSingleSpaceTitle.replace(/[^A-Z0-9\-]+/ig, "_");
|
||||
const normLengthTitle = normSpacingTitle.slice(0,50);
|
||||
|
||||
const filename = normSpacingObjectId + '__' + normLengthTitle + '__' + objectData.datum + '__' + objectData.dokumenttyp + '.docx'
|
||||
fs.writeFileSync(path.join(documentPath, filename), buffer)
|
||||
log = {
|
||||
...log,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue