Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/allnulled/file-splitter-syntax
Syntax that allows to group parts of a file by labels.
https://github.com/allnulled/file-splitter-syntax
Last synced: 1 day ago
JSON representation
Syntax that allows to group parts of a file by labels.
- Host: GitHub
- URL: https://github.com/allnulled/file-splitter-syntax
- Owner: allnulled
- Created: 2023-11-25T18:38:11.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2023-11-25T21:04:18.000Z (12 months ago)
- Last Synced: 2024-11-09T01:08:46.360Z (9 days ago)
- Language: PEG.js
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# file-splitter-syntax
Syntax that allows to group parts of a file by labels.
## Installation
```sh
npm i -s file-splitter-syntax
```## Usage
```js
const FileSplitter = require("file-splitter-syntax");
const ast = FileSplitter.parse("<## Division here ##>\nContinue the contents<## Division there ##>\nMore contents in another group.");
```## Syntax
The syntax to create a new group, which in the output tree you will find as *file* and not *group* because it is thought to represent multiple files in 1 file, you have to follow the next syntax:
```
<## name of a file.txt ##>
Contents of the file.<## name of another file.txt ##>
More contents. And so on.
```No complexity, you will receive the file splitted by objects each of them containing 2 fields:
- `file`, which is the content of the tag that you chose.
- `contents`, which is the text of the group itself.With this output, you can play freely.
## Tests
To run the tests, just do:
```sh
npm test
```