UNPKG

@alexanderson1993/cooklang-ts

Version:

Cooklang-TS is a TypeScript library for parsing and manipulating Cooklang recipes.

16 lines 862 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.tokens = exports.shoppingList = exports.blockComment = exports.comment = void 0; const metadata = /^>>\s*(.+?):\s*(.+)/; const multiwordIngredient = /@([^@#~[]+?)\{([^]*?)(?:%([^}]+?))?\}(?:\(([^]*?)\))?(?:\[([^]*?)\])?/; const singleWordIngredient = /@([^\s\t\p{Zs}\p{P}]+)/; const multiwordCookware = /#([^@#~[]+?)\{(.*?)\}/; const singleWordCookware = /#([^\s\t\p{Zs}\p{P}]+)/; const timer = /~(.*?)(?:\{(.*?)(?:%(.*?))?\})/; exports.comment = /--.*/g; exports.blockComment = /\s*\[\-[\s\S]*?\-\]\s*/g; exports.shoppingList = /\n\s*\[(.+)\]\n([^]*?)(?:\n\n|$)/g; exports.tokens = new RegExp([metadata, multiwordIngredient, singleWordIngredient, multiwordCookware, singleWordCookware, timer] .map((r) => r.source) .join("|"), "gu"); //# sourceMappingURL=tokens.js.map