feat: updated plant based tag
This commit is contained in:
parent
c5fe64e460
commit
94d29d20c2
62 changed files with 64 additions and 64 deletions
|
|
@ -6,10 +6,10 @@ const { DateTime } = require("luxon");
|
|||
const extractDietTags = (filePath) => {
|
||||
try {
|
||||
const content = fs.readFileSync(filePath, 'utf-8');
|
||||
const dietTagRegex = /#diet\/(omnivore|vegetarian|plant-based)(?:\/optional)?/g;
|
||||
const dietTagRegex = /#diet\/(omnivore|vegetarian|plant_based)(?:\/optional)?/g;
|
||||
const matches = content.match(dietTagRegex) || [];
|
||||
return matches.map(tag => {
|
||||
const match = tag.match(/#diet\/(omnivore|vegetarian|plant-based)/);
|
||||
const match = tag.match(/#diet\/(omnivore|vegetarian|plant_based)/);
|
||||
return match ? match[1] : null;
|
||||
}).filter(Boolean);
|
||||
} catch (e) {
|
||||
|
|
@ -26,7 +26,7 @@ const getPlantBased = (filePath) => {
|
|||
|
||||
const hasOmnivore = dietTags.includes('omnivore');
|
||||
const hasVegetarian = dietTags.includes('vegetarian');
|
||||
const hasPlantBased = dietTags.includes('plant-based');
|
||||
const hasPlantBased = dietTags.includes('plant_based');
|
||||
|
||||
if (hasPlantBased) {
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue