This commit is contained in:
Ulf Gebhardt 2023-04-10 21:27:01 +02:00
parent 9e83db444a
commit 26443e0604
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9
2 changed files with 17 additions and 14 deletions

View File

@ -1,24 +1,31 @@
# wow-toc
[![Build Status](http://img.shields.io/travis/zekesonxx/wow-toc.svg)](https://travis-ci.org/zekesonxx/wow-toc)
# wow-toc-parser
World Of Warcraft addon `.toc` file parser. Written in typescript.
World Of Warcraft addon `.toc` file parser. Written in Node.js.
## Ressources
This implementation is based on based on [wow-toc](https://github.com/zekesonxx/wow-toc) by [Zoey Mertes](https://github.com/zekesonxx).
Built on the documentation at [Wowpedia](http://wowpedia.org/TOC_format).
Furthermore the following documentation was used to create this tool:
- http://wowpedia.org/TOC_format
- https://wowwiki-archive.fandom.com/wiki/TOC_format
- https://wowpedia.fandom.com/wiki/TOC_format
## Usage
// TODO publish
`$ npm install wow-toc`
````js
var wowtoc = require('wow-toc');
````ts
import { open } from 'fs/promises';
import { parse } from 'wow-toc-parser'
var k = wowtoc.parse(fs.readFileSync('somefile.toc'));
wowtoc.stringify(k);
const file = await open(__dirname + '/../test/empty.toc', 'r');
const toc = await parse(file)
console.log(toc)
````
## Notes / Caveats
* Does not acknowledge `#@no-lib-strip@`/`#@end-no-lib-strip@`
* `Dependencies`/`OptionalDeps`/etc remain strings (easy to convert to arrays anyways)
* Doesn't validate tag names (`## Bacon: Strip` is valid to it but not to WoW)
## License
// TODO Apache
MIT. See `LICENSE`

View File

@ -1,7 +1,3 @@
/*
https://wowwiki-archive.fandom.com/wiki/TOC_format
https://wowpedia.fandom.com/wiki/TOC_format
*/
import { FileHandle } from 'fs/promises';
export const TOC_PREFIX_TAG = '## '