package
The pug lexer (takes a string and converts it to an array of tokens)
npm install pug-lexerGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Latest published Feb 28, 2021
latest
canary
The pug lexer. This module is responsible for taking a string and converting it into an array of tokens.
npm install pug-lexervar lex = require('pug-lexer');lex(str, options)Convert Pug string to an array of tokens.
options can contain the following properties:
filename (string): The name of the Pug file; it is used in error handling if provided.plugins (array): An array of plugins, in the order they should be applied.console.log(JSON.stringify(lex('div(data-foo="bar")', {filename: 'my-file.pug'}), null, ' '))[
{
"type": "tag",
"line": 1,
"val": "div",
"selfClosing": false
},
{
"type": "attrs",
"line": 1,
"attrs": [
{
"name": "data-foo",
"val": "\"bar\"",
"escaped": true
}
]
},
{
"type": "eos",
"line"
new lex.Lexer(str, options)Constructor for a Lexer class. This is not meant to be used directly unless you know what you are doing.
options may contain the following properties:
filename (string): The name of the Pug file; it is used in error handling if provided.interpolated (boolean): if the Lexer is created as a child lexer for inline tag interpolation (e.g. #[p Hello]). Defaults to false.startingLine (integer): the real line number of the first line in the input. It is also used for inline tag interpolation. Defaults to 1.plugins (array): An array of plugins, in the order they should be applied.MIT
Estimated unpacked size across 6 packages.
674.5 kB
Includes dependencies.
pug-bot
pug-bot@rollingversions.com
^4.0.0
4.0.0
^2.2.0
4.0.0