Add setting to display underscores as spaces in tags

This commit is contained in:
neobooru
2019-05-22 23:08:26 +02:00
parent bbde0ab9a0
commit 7b236b02c9
9 changed files with 29 additions and 3 deletions

View File

@ -2,6 +2,9 @@
const markdown = require('./markdown.js');
const uri = require('./uri.js');
const settings = require('../models/settings.js');
const tagUnderscoresAsSpaces = settings.get().tagUnderscoresAsSpaces;
function decamelize(str, sep) {
sep = sep === undefined ? '-' : sep;
@ -197,6 +200,13 @@ function dataURItoBlob(dataURI) {
return new Blob([data], {type: mimeString});
}
function getPrettyTagName(tag) {
if (tagUnderscoresAsSpaces) {
return tag.replace(/_/g, " ");
}
return tag;
}
module.exports = {
range: range,
formatRelativeTime: formatRelativeTime,
@ -214,4 +224,5 @@ module.exports = {
decamelize: decamelize,
escapeSearchTerm: escapeSearchTerm,
dataURItoBlob: dataURItoBlob,
getPrettyTagName: getPrettyTagName,
};