diff --git a/lib/measurements/matcher.js b/lib/measurements/matcher.js index bfabb30..6b99975 100644 --- a/lib/measurements/matcher.js +++ b/lib/measurements/matcher.js @@ -16,10 +16,8 @@ const NUM = '\\d+(?:\\.\\d+)?'; const FRAC = '\\d+\\s*/\\s*\\d+'; const MIXED = '\\d+\\s+\\d+\\s*/\\s*\\d+'; -const UNICODE_FRAC = '[\u00BC-\u00BE\u2150-\u215E]'; -const MIXED_UNI = `\\d+\\s*${UNICODE_FRAC}`; const APPROX_PREFIX = '~\\s*'; -const SINGLE_AMOUNT = `(?:${APPROX_PREFIX})?(?:${MIXED}|${FRAC}|${MIXED_UNI}|${UNICODE_FRAC}|${NUM})`; +const SINGLE_AMOUNT = `(?:${APPROX_PREFIX})?(?:${MIXED}|${FRAC}|${NUM})`; const RANGE_SEP = '\\s*(?:-|to)\\s*'; const AMOUNT = `(?:${SINGLE_AMOUNT}${RANGE_SEP}${SINGLE_AMOUNT}|${SINGLE_AMOUNT})`; @@ -41,27 +39,6 @@ const DIM_UNIT = '(?:inch(?:es)?|in\\.?|cm|mm)'; * @param {string} str — e.g. "200", "1.5", "1/2", "1 1/2", "~250" * @returns {{ value: number, approximate: boolean }} */ -const UNICODE_FRAC_MAP = { - '\u00BC': 0.25, // ¼ - '\u00BD': 0.5, // ½ - '\u00BE': 0.75, // ¾ - '\u2150': 1/7, // ⅐ - '\u2151': 1/9, // ⅑ - '\u2152': 1/10, // ⅒ - '\u2153': 1/3, // ⅓ - '\u2154': 2/3, // ⅔ - '\u2155': 0.2, // ⅕ - '\u2156': 0.4, // ⅖ - '\u2157': 0.6, // ⅗ - '\u2158': 0.8, // ⅘ - '\u2159': 1/6, // ⅙ - '\u215A': 5/6, // ⅚ - '\u215B': 0.125, // ⅛ - '\u215C': 0.375, // ⅜ - '\u215D': 0.625, // ⅝ - '\u215E': 0.875, // ⅞ -}; - function parseSingleAmount(str) { str = str.trim(); const approximate = str.startsWith('~'); @@ -69,20 +46,6 @@ function parseSingleAmount(str) { str = str.replace(/^~\s*/, ''); } - // Unicode mixed number: "1½", "1 ½" - const uniMixedMatch = str.match(/^(\d+)\s*([\u00BC-\u00BE\u2150-\u215E])$/); - if (uniMixedMatch) { - const whole = parseInt(uniMixedMatch[1], 10); - const frac = UNICODE_FRAC_MAP[uniMixedMatch[2]] || 0; - return { value: whole + frac, approximate }; - } - - // Standalone Unicode fraction: "½", "¾" - const uniFracMatch = str.match(/^([\u00BC-\u00BE\u2150-\u215E])$/); - if (uniFracMatch) { - return { value: UNICODE_FRAC_MAP[uniFracMatch[1]] || 0, approximate }; - } - // Mixed number: "1 1/2" const mixedMatch = str.match(/^(\d+)\s+(\d+)\s*\/\s*(\d+)$/); if (mixedMatch) { @@ -336,33 +299,6 @@ function findDimensions(text) { }); } - // Standalone AMOUNT + dimension unit (e.g. "1 inch", "0.5-1cm") - const standaloneDimRe = new RegExp( - `(${AMOUNT})\\s*(${DIM_UNIT})\\b`, - 'gi' - ); - - while ((m = standaloneDimRe.exec(text)) !== null) { - // Skip if overlapping with an NxN match already found - const alreadyMatched = results.some( - r => m.index >= r.index && m.index < r.index + r.match.length - ); - if (alreadyMatched) continue; - - const amount = parseAmount(m[1]); - const unit = normalizeUnit(m[2]); - - results.push({ - match: m[0], - index: m.index, - type: 'dimension', - amount, - unit, - approximate: typeof amount.approximate === 'boolean' ? amount.approximate : false, - alt: null, - }); - } - return results; } diff --git a/recipes/Boxcar.md b/recipes/Boxcar.md index dc0d9be..73274b9 100644 --- a/recipes/Boxcar.md +++ b/recipes/Boxcar.md @@ -12,7 +12,7 @@ makes: 1 martini glass - [ ] ice ## Tools - shaker -- martini glass 1 +- martini glass ## Steps - pour all ingredients in the shaker - shake well[^1] diff --git a/recipes/Cranberry Martini (rough draft).md b/recipes/Cranberry Martini (rough draft).md index 6533d76..2a03a8f 100644 --- a/recipes/Cranberry Martini (rough draft).md +++ b/recipes/Cranberry Martini (rough draft).md @@ -14,7 +14,7 @@ makes: 1 martini glass - Bar spoon - Strainer - Jigger -- Martini glass 1 +- Martini glass ## Steps - Chill martini glass (with ice water or in freezer) - Add vodka, triple sec, dry vermouth, cranberry juice, and cranberry bitters to mixing glass diff --git a/recipes/Cream Soda (alcoholic).md b/recipes/Cream Soda (alcoholic).md index 2a1fc83..ddd07b3 100644 --- a/recipes/Cream Soda (alcoholic).md +++ b/recipes/Cream Soda (alcoholic).md @@ -8,7 +8,7 @@ makes: 1 highball glass - [ ] ginger beer 120 g - [ ] ice ## Tools -- highball 1 +- highball ## Steps - add rum, ginger beer, and ice to glass - serve diff --git a/recipes/Golden Dawn.md b/recipes/Golden Dawn.md index 6fcd010..8750f75 100644 --- a/recipes/Golden Dawn.md +++ b/recipes/Golden Dawn.md @@ -11,7 +11,7 @@ makes: 1 martini glass - [ ] ice ## Tools - shaker -- martini glass 1 +- martini glass ## Steps - put all ingredients in shaker - shake well diff --git a/recipes/Imperial Cocktail.md b/recipes/Imperial Cocktail.md index 56d598b..3933cc6 100644 --- a/recipes/Imperial Cocktail.md +++ b/recipes/Imperial Cocktail.md @@ -10,7 +10,7 @@ makes: 1 martini glass - [ ] ice ## Tools - shaker -- martini glass 1 +- martini glass ## Steps - pour all ingredients into the shaker - shake well[^1] diff --git a/recipes/Long Island Tea.md b/recipes/Long Island Tea.md index 4861b0e..70e6154 100644 --- a/recipes/Long Island Tea.md +++ b/recipes/Long Island Tea.md @@ -13,9 +13,6 @@ makes: 1 highball glass - [ ] simple syrup 20g - [ ] coca-cola 90g - [ ] ice -## Tools -- highball 1 -- stir stick ## Steps - pour all ingredients over ice - stir[^1] diff --git a/recipes/Moscow Mule.md b/recipes/Moscow Mule.md index f6d91ac..52b5aee 100644 --- a/recipes/Moscow Mule.md +++ b/recipes/Moscow Mule.md @@ -9,7 +9,7 @@ makes: 1 copper mug - [ ] ginger beer 220g - [ ] ice ## Tools -- mule glass 1 +- mule glasses - stir stick ## Steps - add all ingredients to glass and stir before serving diff --git a/recipes/Rhubarb Cosmopolitan.md b/recipes/Rhubarb Cosmopolitan.md index 2159e07..515eee2 100644 --- a/recipes/Rhubarb Cosmopolitan.md +++ b/recipes/Rhubarb Cosmopolitan.md @@ -12,7 +12,7 @@ makes: 1 martini glass - [ ] ice ## Tools - cocktail shaker -- martini glass 1 +- martini glass ## Steps - add all ingredients to shaker - shake well diff --git a/recipes/Tater Tot Hotdish.md b/recipes/Tater Tot Hotdish.md index 61205a0..519f0c5 100644 --- a/recipes/Tater Tot Hotdish.md +++ b/recipes/Tater Tot Hotdish.md @@ -38,7 +38,7 @@ makes: 1 9x13 pan or 4 large rectangular pyrex containers ## Tools - pan - mixing bowl -- 9 x 13 inch glass baking dish 1 / 8x6x2 inch pyrex dishes 4 +- 9 x 13 inch glass baking dish/4 8x6x2 inch pyrex dishes ## Steps - preheat oven to 350 °F - dice onion diff --git a/recipes/Tequila Sunrise.md b/recipes/Tequila Sunrise.md index 95d32a5..dbd1b82 100644 --- a/recipes/Tequila Sunrise.md +++ b/recipes/Tequila Sunrise.md @@ -8,7 +8,7 @@ makes: 1 highball glass - [ ] grenadine 15 g - [ ] ice ## Tools -- lowball 1 +- lowball - stir stick ## Steps - pour tequila and orange juice into the glass diff --git a/recipes/Tom and Jerry's.md b/recipes/Tom and Jerry's.md index c53e3fc..8ff1d6d 100644 --- a/recipes/Tom and Jerry's.md +++ b/recipes/Tom and Jerry's.md @@ -9,7 +9,7 @@ makes: 1 mug - [ ] spiced rum 25g - [ ] milk 240g ## Tools -- mug 1 +- mug ## Steps - warm up cup of milk - mix in tom and jerry mix