Wondering what’s next for npm?Check out our public roadmap! »

    This package has been deprecated

    Author message:

    jade-lexer will be unpublished soon, please use pug-lexer

    jade-lexer

    0.0.9 • Public • Published

    jade-lexer

    The jade lexer. This module is responsible for taking a string and converting it into an array of tokens.

    Build Status Dependency Status NPM version

    Installation

    npm install jade-lexer
    

    Usage

    var lex = require('jade-lexer');

    lex(str, filename)

    Convert Jade string to an array of tokens. filename, if provided, is used in error handling.

    console.log(JSON.stringify(lex('div(data-foo="bar")', 'my-file.jade'), null, '  '))
    [
      {
        "type": "tag",
        "line": 1,
        "val": "div",
        "selfClosing": false
      },
      {
        "type": "attrs",
        "line": 1,
        "attrs": [
          {
            "name": "data-foo",
            "val": "\"bar\"",
            "escaped": true
          }
        ]
      },
      {
        "type": "eos",
        "line": 1
      }
    ]

    new lex.Lexer(str, filename, 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:

    • 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.

    License

    MIT

    Keywords

    Install

    npm i jade-lexer

    DownloadsWeekly Downloads

    183

    Version

    0.0.9

    License

    MIT

    Last publish

    Collaborators

    • avatar
    • avatar
    • avatar
    • avatar
    • avatar