Giter VIP home page Giter VIP logo

boxup.compiler's Introduction

[boxup]

Simple, structured markup.

About

Note: this is a rework of the original Boxup, a project that quickly got out of scope and became far too complex. This refactor aims to keep things simpler.

Boxup is a markup language, designed for situations where Markdown doesn't provide enough structure but where something like XML would be too cumbersome. In addition, it has schemas built in to its compiler.

[/ Comments look like this! /]

[/ Boxup has a few special keywords -- `use` is one of them. 
 / It can be used to tell the compiler which schema to use (although
 / this is an implementation detail)
 /]
[use my.example]

[article]
  title = Hello world!
  slug = hello_world

[section one]
  css = "
    width: 100%;
    background: blue;
  "

  [header]
    Hey World!

  Boxup is a very simple markup language based 
  around square brackets and indentation.

  It has *bold text*, _italic text_ and you 
  can <tag stuff>[example content="This is a tag!"] too.
[/ A possible schema for the above: /]

[/ The `schema` keyword optionally names the schema. /]
[schema my.example]
  [/ You can import other schemas into this one via the `use` block. 
   / Note that `[use]` blocks in schemas must be children of the 
   / `[schema]` block.
   /]
  [use my.paragraph]

[root]
  [child article required = true]
  [child section]
  [child paragraph]

[block article]
  [property title required=true]
  [property slug]

[block section]
  [/ In addition to properties, you can define
   / "parameters" on your blocks. In Boxup, parameters
   / are *positional* rather than *named* properties,
   / which can be handy in some situations.
   /
   / Parameters *must* come before properties in a block header and 
   / they are space-delimited. 
   /
   / Also note that parameters are ALWAYS required (at least for now).
   /]
  [parameter type=String]
  [property css]
  [child header]
  [child paragraph]

[block header]
  [child paragraph required = true]
[schema my.paragraph]

[/ The `[root]` declaration is ignored when being imported. /]
[root]
  [child paragraph]

[/ When used by another schema, all the block definitions here will become
 / available in the parent file. 
 /]
[block paragraph]
  [/ Properties do not need to be defined in the block header: /]
  type = Paragraph
  [child example]

[block example type=Tag]
  [property content]
    required = true

boxup.compiler's People

Contributors

wartman avatar

Stargazers

Shahar Marcus avatar

Watchers

James Cloos avatar  avatar  avatar

boxup.compiler's Issues

Add Haxe Schema

It would be super handy to have schemas that are entirely written in Haxe (or to have Haxe classes that are entirely derived from Boxup schemas).

For example:

import boxup.haxe.*;

@:boxup.schema('foo')
class Foo implements HaxeSchema {
  @:parameter public final title:String;
  @:property(required = true) public final bar:String;
  @:child public final content:Array<Paragraph>;
}

// ...which can then be used like:
var foo = Foo.parse('
[foo "This is the title" bar="bar"]
  This is the content
')

Alternatively, something like this:

type Foo = boxup.schema.SchemaObject<'
[root]
  [child foo]

[block foo]
  [parameter title]
  [property bar required=true]
  [child paragraph]
'>

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.