Code Monkey home page Code Monkey logo

platos's Introduction

platos

build status

A really simple PLAin Text Object Serialization library.

Getting started

Strings

By default, the whole platos document is loaded as a single string.

platosjson
hello, world!
more lines.
"hello, world!\nmore lines."

Lists

Now add *** to the head or the document:

platosjson
***
hello, world!
more lines.
["hello, world!", "more lines."]

List can hold sublists:

platosjson
***
hello, world!
more lines.
* sublist item 1
  sublist item 2
  * subsublist item 1
    subsublist item 2
  *
  sublist item 5
[
  "hello, world!",
  "more lines.",
  [
    "sublist item 1",
    "sublist item 2",
    ["subsublist item 1", "subsublist item 2"],
    [],
    "sublist item 5"
  ]
]

Note the empty list there.

List items can be multiline text:

platosjson
***
$ * hello, world!
$ more
  lines.
* $ another multiline
    text as the first item
    of a sublist.
  second sublist item.
[
  "* hello, world!",
  "more\nlines.",
  [
    "another multiline\ntext as the first item\nof a sublist.",
    "second sublist item"
  ]
]

Incase you need, here is a string starts with ***

platosjson
$$$
***
blablabla...
more blablabla...
"***\nblablabla...\nmore blablabla..."

And a string starts with $$$:

platosjson
$$$
$$$
blablabla...
more blablabla...
"$$$\nblablabla...\nmore blablabla..."

Dictionarys

Use %%% to turn on dict mode:

platosjson
%%%
name = jack
age = 17
favorite food
= fish, tomatos
  and milk.
{"name": "jack", "age": 17, "favorite food": "fish, tomatos\nand milk."}

Dict as list items:

platosjson
% name = jack
  age = 17
% name = lucy
  age = 19
[{"name": "jack", "age": 17}, {"name": "lucy", "age": 19}]

More extensions

comments

like strings, but use #, and be dropped by parser.

tags

To prevent some indentions.

$$ EOF
some text
EOF

same on list with **, and dict with %%.

platos's People

Contributors

2x-1 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.