![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
hyperfast and minimalistic json2html template engine for node/coffeescript/browser, a mashup between emmet/mustache/json-dsl/smarty
JSON 2 html/xml template engine on steroids. It borrows from JADE, but is jsonfriendly and has syntactical testosterone.
$ npm install brown
or in the browser:
<script type='text/javascript' src='brown.min.js'></script>
then
brown = require('brown').parse
json =
ul:
li:
'a[href="{{url}}"]': "click me"
data = { url: "http://turtlesarecool.com" }
console.log brown json,data
<ul><li><a href="http://turtlesarecool.com"></li></ul>
json =
'div#foo.flop>fieldset>div>span':
ul: 'items->li>a[href="{{url}}"]>{ {{.label}} }'
div:
'span>b.foo': '{{foo}}'
'span>b.bar': '{{func()}}'
'span>b.pip': '{{foo|upper|important}}'
data =
items: [{label:'one', url:"/"},{label:'two',url:'/two'}]
foo: "hello world"
func: () -> @.foo + " foobar"
upper: (str) -> str.toUpperCase()
important: (str) -> "!! "+str
NOTE: instead of coffeescript, see the javascript example here
<div id="foo" class="flop">
<fieldset>
<div>
<span>
<ul>
<li>
<a href="/"> one </a>
</li>
<li>
<a href="/two"> two </a>
</li>
</ul>
</span>
</div>
</fieldset>
</div>
<div>
<span>
<b class="foo">hello world</b>
</span>
<span>
<b class="bar">hello world foobar</b>
</span>
<span>
<b class="pipe">!! HELLO WORLD</b>
</span>
</div>
ϐrown wants to be very fast an minimal, therefore uses json-dsl. ϐrown combines ideas from smarty, mustache and emmet/zencoding. ϐrown focuses on json and json-portability instead of text (smarty/mustache) or introducing a new syntax which require lexicalscanner/parsertree-bloat (jade,coffeecup,haml etc).
With these basics you can literally do anything. Need more? just use functions and filters.
Want master templates? Easy, you can call brown inside brown.
data =
master:
html:
head: ''
body:
'div#main': '{{content()}}'
page:
'ul#menu':
div: "{{foo}}"
data:
foo: "hello world"
content: () -> brown @.page, @.data
brown data.master, data
NOTE: instead of coffeescript, see the javascript example here
<html><head></head><body><div id="main"><ul id="menu"><div>hello world</div></ul></div></body></html></body></head></html>
Arrays here you go
div:
ul: 'arr->li>{ {{.}} }'
ol: 'arr->{{.|upper}}'
And for objects just reference the keys like so: {{.keyname}}
For more info see the info above or the tests
Easy, just use extend (npm install extend
).
global =
somefilter: (str) -> str.toUpperCase()
projectname: () -> return "myprojectname"
unique =
welcome: "hello"
json =
div:
span: '{{welcome}} {{projectname()|somefilter}}'
console.log brown json, extend global, unique
<div><span>hello MYPROJECTNAME</span></div>
$ brown 'a>b'
will output: <a><b></b></b>
FAQs
Ultra-extendable Mustache-ish template engine on steroids in 620 gzipped kilobytes, need nothing more!
The npm package brown receives a total of 4 weekly downloads. As such, brown popularity was classified as not popular.
We found that brown demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.