4 ms·
I made BML for that purpose. I posted about it before: https://news.ycombinator.com/item?id=8645591 https://news.ycombinator.com/item?id=8645591 To copy-paste
by byuu 10y ago
I made BML for that purpose. I posted about it before: https://news.ycombinator.com/item?id=8645591 https://news.ycombinator.com/item?id=8645591
To copy-paste the example:
server
path: /core/www/
host: example.com
port: 80
service: true
proxy
host: proxy.example.com
port: 8080
authentication: plain
description
:Primary web-facing server
:Provides commerce-related functionality
server
...
proxy host="proxy.example.com" port=8080
authentication: plain
There's no character escaping, brackets, distinction between attributes and elements, data types (up to the one parsing the document how to decode values), etc. BOM-free UTF-8 is mandatory.
It's the bare minimum for an extensible tree-based data structure, but I threw in three ways to assign values to nodes to help craft smaller documents. Turns out it's hugely important to be able to assign multiple child nodes on the same line as the parent for certain classes of documents.
My implementation of BML uses my string library, so I can't offer a portable parser. But it shouldn't take more than an hour or two to write a BML parser.
Still, my reference example is here: https://gitlab.com/higan/higan/tree/master/nall/string/markup https://gitlab.com/higan/higan/tree/master/nall/string/marku... -- 177 lines for the base parser, which can also save back modified BML documents.
Downside is that I have no clue how to market it, and I hate writing documentation, so there's only a few people using it.
- amyjess 10y ago> Downside is that I have no clue how to market it, and I hate writing documentation, so there's only a few people using it. You could always write up a quick demo program (something anyone can just clone, compile, and execute), throw in a few example files, and submit your repository as a Show HN. That might get some attention at least.