JSPM

slab-markup

0.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q32864F
  • License ISC

A package for parsing SLAB markup files.

Package Exports

  • slab-markup

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (slab-markup) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

stupid custom data format - contains js code to parse, and sublime text 3 syntax highlighting file

here's an example of a file:

description: a simple key-value pair
example: bar

description: string-wrapping support
example: so many bars all the bars in the 
    universe and some bars from even some 
    other universes really a lot of bars.

description: array of strings
example:
    one string
    another string

description: array of structures
example:
    foo:bar
    ding:bat

    foo:bar
    ding:bat

to parse it, just do

var slab = require("./js/slab")
var db = slab.loadFile('myfile.slab');

and it will look like this:

[
  {
    "description": "a simple key value pair",
    "example": "bar"
  },
  {
    "description": "string-wrapping support",
    "example": "so many bars all the bars in the universe and some bars from even some other universes really a lot of bars."
  },
  {
    "description": "array of strings",
    "example": [
      "one string",
      "another string"
    ]
  },
  {
    "description": "array of structures",
    "example": [
      {
        "foo": "bar",
        "ding": "bat"
      },
      {
        "foo": "bar",
        "ding": "bat"
      }
    ]
  }
]

The equivalent YAML is

---
- description: a simple key value pair
  example: bar
- description: string-wrapping support
  example: so many bars all the bars in the universe and some bars from even some
    other universes really a lot of bars.
- description: array of strings
  example:
  - one string
  - another string
- description: array of structures
  example:
  - foo: bar
    ding: bat
  - foo: bar
    ding: bat

Which is basically the same as the SLAB version, and has far more robust code.

(Warning, it doesn't support depths of >2 right now...)

To get the syntax highlighter to work, copy the .sublime-syntax file to your Packages/User directory in sublime text.

Alt screenshot