0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 14:12:40 +00:00

add 'lang' as a brew metadata property

This commit is contained in:
Gazook89
2022-09-21 12:21:32 -05:00
parent 8c6fd3086c
commit bce7cf41af
4 changed files with 6 additions and 2 deletions

View File

@@ -21,7 +21,7 @@ const splitTextStyleAndMetadata = (brew)=>{
const index = brew.text.indexOf('```\n\n');
const metadataSection = brew.text.slice(12, index - 1);
const metadata = yaml.load(metadataSection);
Object.assign(brew, _.pick(metadata, ['title', 'description', 'tags', 'systems', 'renderer', 'theme']));
Object.assign(brew, _.pick(metadata, ['title', 'description', 'tags', 'systems', 'renderer', 'theme', 'lang']));
brew.text = brew.text.slice(index + 5);
}
if(brew.text.startsWith('```css')) {
@@ -173,6 +173,7 @@ app.get('/user/:username', async (req, res, next)=>{
'pageCount',
'description',
'authors',
'lang',
'published',
'views',
'shareId',

View File

@@ -126,6 +126,7 @@ const GoogleActions = {
views : parseInt(file.properties.views),
published : file.properties.published ? file.properties.published == 'true' : false,
systems : [],
lang : file.properties.lang,
thumbnail : file.properties.thumbnail
};
});
@@ -255,6 +256,7 @@ const GoogleActions = {
tags : obj.data.properties.tags ? obj.data.properties.tags : '',
systems : obj.data.properties.systems ? obj.data.properties.systems.split(',') : [],
authors : [],
lang : obj.data.properties.lang,
published : obj.data.properties.published ? obj.data.properties.published == 'true' : false,
trashed : obj.data.trashed,

View File

@@ -80,7 +80,7 @@ const mergeBrewText = (brew)=>{
`\`\`\`\n\n` +
`${text}`;
}
const metadata = _.pick(brew, ['title', 'description', 'tags', 'systems', 'renderer', 'theme']);
const metadata = _.pick(brew, ['title', 'description', 'tags', 'systems', 'renderer', 'theme', 'lang']);
text = `\`\`\`metadata\n` +
`${yaml.dump(metadata)}\n` +
`\`\`\`\n\n` +

View File

@@ -15,6 +15,7 @@ const HomebrewSchema = mongoose.Schema({
description : { type: String, default: '' },
tags : [String],
systems : [String],
lang : { type: String, default: 'en' },
renderer : { type: String, default: '' },
authors : [String],
published : { type: Boolean, default: false },