How to use @bbob/plugin-helper - 10 common examples

To help you get started, we’ve selected a few @bbob/plugin-helper examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github JiLiZART / bbob / packages / bbob-parser / lib / Tokenizer.js View on Github external
flushTag() {
    if (this.inTag()) {
      // [] and [=] tag case
      if (this.tagToken[Token.VALUE_ID] === '') {
        const value = this.inAttrValue() ? getChar(EQ) : '';
        const word = getChar(OPEN_BRAKET) + value + getChar(CLOSE_BRAKET);

        this.createWord('', 0, 0);
        this.wordToken[Token.VALUE_ID] += word;

        this.tagToken = this.dummyToken;

        if (this.inAttrValue()) {
          this.attrValueToken = this.dummyToken;
        }

        return;
      }

      if (this.inAttrName() && !this.inAttrValue()) {
        this.tagToken[Token.VALUE_ID] += PLACEHOLDER_SPACE + this.attrNameToken[Token.VALUE_ID];
        this.attrNameToken = this.dummyToken;
github JiLiZART / bbob / packages / bbob-parser / lib / Tokenizer.js View on Github external
flushTag() {
    if (this.inTag()) {
      // [] and [=] tag case
      if (this.tagToken[Token.VALUE_ID] === '') {
        const value = this.inAttrValue() ? getChar(EQ) : '';
        const word = getChar(OPEN_BRAKET) + value + getChar(CLOSE_BRAKET);

        this.createWord('', 0, 0);
        this.wordToken[Token.VALUE_ID] += word;

        this.tagToken = this.dummyToken;

        if (this.inAttrValue()) {
          this.attrValueToken = this.dummyToken;
        }

        return;
      }

      if (this.inAttrName() && !this.inAttrValue()) {
        this.tagToken[Token.VALUE_ID] += PLACEHOLDER_SPACE + this.attrNameToken[Token.VALUE_ID];
github JiLiZART / bbob / packages / bbob-html / src / index.js View on Github external
const renderNode = (node, { stripTags = false }) => {
  if (!node) return '';
  const type = typeof node;

  if (type === 'string' || type === 'number') {
    return node;
  }

  if (type === 'object') {
    if (stripTags === true) {
      // eslint-disable-next-line no-use-before-define
      return renderNodes(node.content, { stripTags });
    }

    if (node.content === null) {
      return [START_TAG, node.tag, attrsToString(node.attrs), SELFCLOSE_END_TAG].join('');
    }

    // eslint-disable-next-line no-use-before-define
    return [START_TAG, node.tag, attrsToString(node.attrs), END_TAG, renderNodes(node.content), CLOSE_START_TAG, node.tag, END_TAG].join('');
  }

  if (Array.isArray(node)) {
    // eslint-disable-next-line no-use-before-define
    return renderNodes(node, { stripTags });
  }

  return '';
};
github JiLiZART / bbob / packages / bbob-parser / lib / Tokenizer.js View on Github external
charWORD(charCode) {
    if (this.inTag()) {
      if (this.inAttrValue()) {
        this.attrValueToken[Token.VALUE_ID] += getChar(charCode);
      } else if (this.inAttrName()) {
        this.attrNameToken[Token.VALUE_ID] += getChar(charCode);
      } else {
        this.tagToken[Token.VALUE_ID] += getChar(charCode);
      }
    } else {
      this.createWord();

      this.wordToken[Token.VALUE_ID] += getChar(charCode);
    }

    this.nextCol();
  }
github JiLiZART / bbob / packages / bbob-parser / lib / Tokenizer.js View on Github external
flushUnclosedTag() {
    if (this.inTag()) {
      const value = this.tagToken[Token.VALUE_ID] + (this.attrValueToken && this.attrValueToken[Token.VALUE_ID] ? getChar(EQ) : '');

      this.tagToken[Token.TYPE_ID] = Token.TYPE_WORD;
      this.tagToken[Token.VALUE_ID] = getChar(OPEN_BRAKET) + value;

      this.appendToken(this.tagToken);

      this.tagToken = this.dummyToken;

      if (this.inAttrValue()) {
        this.attrValueToken = this.dummyToken;
      }
    }
  }
github JiLiZART / bbob / packages / bbob-parser / lib / Tokenizer.js View on Github external
charEQ(charCode) {
    const nextCharCode = this.seekChar(1);
    const isNextQuotemark = nextCharCode === QUOTEMARK;

    if (this.inTag()) {
      this.attrValueToken = this.createAttrValueToken('');

      if (isNextQuotemark) {
        this.attrValueToken.quoted = true;
        this.skipChar(1);
      }
    } else {
      this.wordToken[Token.VALUE_ID] += getChar(charCode);
    }

    this.nextCol();
  }
github JiLiZART / bbob / packages / bbob-parser / lib / Tokenizer.js View on Github external
charN(charCode) {
    this.flushWord();
    this.appendToken(this.createNewLineToken(getChar(charCode)));

    this.nextLine();
    this.colPos = 0;
  }
github JiLiZART / bbob / packages / bbob-parser / lib / Tokenizer.js View on Github external
charCLOSEBRAKET(charCode) {
    const prevCharCode = this.seekChar(-1);
    const isPrevSpace = prevCharCode === SPACE || prevCharCode === TAB;

    if (isPrevSpace) {
      this.wordToken[Token.VALUE_ID] += getChar(charCode);
    }

    this.nextCol();
    this.flushTag();
    this.flushAttrNames();
    this.flushAttrs();
  }
github JiLiZART / bbob / packages / bbob-preset-html5 / src / defaultTags.js View on Github external
content.forEach((el) => {
    if (isStringNode(el) && isStartsWith(el, '*')) {
      if (listItems[listIdx]) {
        listIdx++;
      }
      ensureListItem(createItemNode());
      addItem(el.substr(1));
    } else if (isTagNode(el) && TagNode.isOf(el, '*')) {
      if (listItems[listIdx]) {
        listIdx++;
      }
      ensureListItem(createItemNode());
    } else if (!isTagNode(listItems[listIdx])) {
      listIdx++;
      ensureListItem(el);
    } else if (listItems[listIdx]) {
      addItem(el);
    } else {
      ensureListItem(el);
    }
  });
github JiLiZART / bbob / packages / bbob-preset / src / index.js View on Github external
  tree.walk(node => (isTagNode(node) && tags[node.tag]
      ? tags[node.tag](node, core)
      : node));
}