Giter VIP home page Giter VIP logo

bbob_dart's People

Contributors

edwardez avatar martenm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

bbob_dart's Issues

Null Safety?

Any chance to upgrade this with Null Safety? looks like a great repository and want to try it

Render attributes when a tag is not part of `validTags`

Currently when an invalid tag is emitted from the lexer, the parser renders the tag as a text node but strips all attributes.

Example:

parse('[h1 name=value]Foo [Bar=Quz]Quux[/Bar] [/h1]', validTags: {'h1'});

results in the following AST:

[
  Element(
    'h1',
    {'name': 'value'},
    [
      Text('Foo'),
      Text(' '),
      Text('[Bar]'),
      Text('Quux'),
      Text('[/Bar]'),
      Text(' '),
    ],
  )
]

Expected result:

[
  Element(
    'h1',
    {'name': 'value'},
    [
      Text('Foo'),
      Text(' '),
      Text('[Bar=Quz]'),
      Text('Quux'),
      Text('[/Bar]'),
      Text(' '),
    ],
  )
]

Question about ast output

First big thank you to @MartenM and @edwardez for getting this to Null Safety!

I just want to make sure I'm using this correctly before I dive in
Using the sample text: [u][b][i]Sample Text[/i][/b][/u] and then running it in bbob as follows:

  const validTags = {'url', 'b', 'i', 'u'};

  var ast = parse(
    theString,
     onError: (msg) {
       print(msg);
     },
    openTag: '[',
    closeTag: ']',
    enableEscapeTags: false,
    validTags: validTags,
  );
  for (var node in ast) {
        debugPrint(node.textContent);
      }

I get:

flutter: [U]
flutter: [B]
flutter: [I]
flutter: Sample Text
flutter: [/I]
flutter: [/B]
flutter: [/U]

I can use this and walk through it and parse it, but it would not consider attributes and nesting might be difficult, so I think I'm going about it incorrectly. From your example documentation you write:

  /// 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'}]

Is there supposed to be a way to retrieve these attributes and actually walk through this to properly deal with nesting?

And if I use var theString2='[url="https://www.google.com"]Test[/url]'; then the output is Test, none of the URL attribute seem accessible.

I guess the main question is, how do you walk this tree, the var ast appears to be a plain text string?

Thanks for any guidance..!

Support for attributes without values

Hi, first of all, thank you so much for this wonderful library.

I'm having a small issue where is i try to parse the following bbcode: [img thumbnail]https://imageurl.com[/img]

I doesn't detect the attributes correctly, it believes it's a completely new tag. My current workaround for this is replacing the thumbnail to thumbnail=true before parsing the bbcode. That isn't ideal when having to deal with a lot of tags with many attributes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.