mirror of
https://github.com/tenrok/BBob.git
synced 2026-06-11 18:02:26 +03:00
* fix: TagNode.create with null content by default * Create five-meals-sing.md * fix: tests * fix(preset): types inference * fix: preset types * fix: preset types * fix: lock file, parser and utils * refactor: move types to separate package * fix(preset): add @bbob/core to dev deps * fix(preset): lock file * test(preset-vue): create tags * test(preset-vue): tests * chore(nx): fix nx cover deps * chore: changesets
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import type { NodeContent, TagNodeTree, LexerTokenizer, ParseOptions } from "@bbob/types";
|
||||
|
||||
import {
|
||||
CLOSE_BRAKET,
|
||||
OPEN_BRAKET,
|
||||
@@ -7,26 +9,8 @@ import {
|
||||
|
||||
import { createLexer } from "./lexer";
|
||||
|
||||
import type { NodeContent, TagNodeTree } from "@bbob/plugin-helper";
|
||||
import type { LexerTokenizer, LexerOptions } from "./types";
|
||||
import type { Token } from "./Token";
|
||||
|
||||
type ParseError = {
|
||||
tagName: string;
|
||||
lineNumber: number;
|
||||
columnNumber: number;
|
||||
};
|
||||
|
||||
export interface ParseOptions {
|
||||
createTokenizer?: (input: string, options?: LexerOptions) => LexerTokenizer;
|
||||
openTag?: string;
|
||||
closeTag?: string;
|
||||
onlyAllowTags?: string[];
|
||||
contextFreeTags?: string[];
|
||||
enableEscapeTags?: boolean;
|
||||
onError?: (error: ParseError) => void;
|
||||
}
|
||||
|
||||
class NodeList<Value> {
|
||||
private n: Value[];
|
||||
|
||||
@@ -201,7 +185,7 @@ function parse(input: string, opts: ParseOptions = {}) {
|
||||
function handleTagStart(token: Token) {
|
||||
flushTagNodes();
|
||||
|
||||
const tagNode = TagNode.create(token.getValue());
|
||||
const tagNode = TagNode.create(token.getValue(), {}, []);
|
||||
const isNested = isTokenNested(token);
|
||||
|
||||
tagNodes.push(tagNode);
|
||||
|
||||
Reference in New Issue
Block a user