Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/danini-the-panini/kdl-dart
Dart implementation of the KDL Document Language
https://github.com/danini-the-panini/kdl-dart
Last synced: 15 days ago
JSON representation
Dart implementation of the KDL Document Language
- Host: GitHub
- URL: https://github.com/danini-the-panini/kdl-dart
- Owner: danini-the-panini
- License: mit
- Created: 2021-01-01T23:39:52.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-04-08T08:14:21.000Z (9 months ago)
- Last Synced: 2024-04-08T09:37:13.132Z (9 months ago)
- Language: Dart
- Size: 5.91 MB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# KDL
[![Actions Status](https://github.com/danini-the-panini/kdl-dart/workflows/Dart/badge.svg)](https://github.com/jellymann/kdl-dart/actions)
This is a Dart implementation of the [KDL Document Language](https://kdl.dev)
## Usage
```dart
import 'package:kdl/kdl.dart';main() {
var document = Kdl.parseDocument(someString);
}
```You can optionally provide your own type annotation handlers:
```dart
KDL.parseDocument(someString, typeParsers: {
'foo': (value, type) {
return Foo(value.value, type: type)
},
});
```The foo function will be called with instances of KdlValue or KdlNode with the type annotation (foo).
Parsers are expected to take the KdlValue or KdlNode, and the type annotation itself, as arguments, and is expected to return either an instance of KdlValue or KdlNode (depending on the input type) or null to return the original value as is. Take a look at the [built in parsers](lib/src/types) as a reference.
## Run the tests
To run the full test suite:
```
dart test
```To run a single test file:
```
dart test test/parser_test.dart
```## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/danini-the-panini/kdl-dart.
## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).