bbob_dart 0.1.0 copy "bbob_dart: ^0.1.0" to clipboard
bbob_dart: ^0.1.0 copied to clipboard

outdated

A port of the bbcode parser and trasnformer [bbob](https://github.com/JiLiZART/bbob) in dart.

example/example.dart

import 'package:bbob_dart/bbob_dart.dart';

main() {
  const validTags = {'url'};

  var ast = parse(
    '''print [b]a[/b] [url=https://github.com]hello world![/url]
  Yes this\'s an exampe''',
    onError: (msg) {
      print(msg);
    },
    openTag: '[',
    closeTag: ']',
    enableEscapeTags: false,
    validTags: validTags,
  );

  /// Parsed ast. Note that `b` is parsed as text because
  /// it's not in [validTags].
  ///
  ///[Text{text: 'print'}, Text{text: ' '}, Text{text: '[b]'}, Text{text: 'a'},
  ///Text{text: '[/b]'}, Text{text: ' '},
  ///Element{tag: 'url', attributes: '{https://github.com: https://github.com}',
  ///children: [Text{text: 'hello'}, Text{text: ' '}, Text{text: 'world!'}]},
  ///Text{text: '
  //'}, Text{text: '  '}, Text{text: 'Yes'}, Text{text: ' '},
  // Text{text: 'this's'}, Text{text: ' '}, Text{text: 'an'}, Text{text: ' '},
  // Text{text: 'exampe'}]

  /// Each [Node] has a [Node.textContent] which can be used to access its
  /// content in raw text format.
  ast.forEach((node) => print(node.textContent));
}
3
likes
0
pub points
64%
popularity

Publisher

unverified uploader

A port of the bbcode parser and trasnformer [bbob](https://github.com/JiLiZART/bbob) in dart.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

meta

More

Packages that depend on bbob_dart