Skip to content

kriskowal/zp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZP

Zero-prefixed markup language

This is a markup language originally intended for annotating color hints for Narwhal's option parser. The language avoids overlap and escaping issues by using a strange and perilous hack that can only be used once: the null character, "\0".

The language looks thusly:

The \0quick(\0brown(fox\0)\0) leaped over the \0lazy(dog\0).

The zp function accepts a string of markup and a delegate that drives the production of output based on push, pop, write, and end methods.

var zp = require('zp');
var HtmlDelegate = require('zp/html');

var delegate = new HtmlDelegate();
var result = zp('The \0quick(\0brown(fox\0)\0) leaped over the \0lazy(dog\0).', delegate);
if (result.err) throw result.err;

console.log(result.value);
// The <quick><brown>fox</brown></quick> leaped over the <lazy>dog</lazy>.

About

Zero-prefixed function calls in strings

Resources

Stars

Watchers

Forks

Packages

No packages published