Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
brakkoli-pmb
Advanced tools
Readme
An SGML (XML, HTML) template engine that uses arrays for hierarchy.
This module is in the first stages of development. Expect major differences between docs and implementation.
from test/usage.js:
var brakk = require('brakkoli-pmb')(), spec,
recipes = { basicPage: require('brakkoli-html5-pmb/basic_page') };
recipes.createAndSharePage = function (topic, answers) {
var pg = recipes.basicPage({ indent: 2,
title: 'Create & share ->your<- ' + topic,
});
pg.head.push({ link_css: 'quiz.css' });
pg.body.push([ 'h1', pg.head.title ],
[ 'form method="get" action="x-nope://"',
[ 'ul class="quiz"'].concat(answers.map(recipes.checkboxAnswer)),
[ 'input type="submit">' ],
]);
return pg;
};
recipes.checkboxAnswer = function (ans) {
return [ [ 'li', { indentTags: 0, }, [ 'label',
[ 'input type="checkbox" name="ingr[]">',
{ attr: { value: ans } } ],
'\n ', ans ] ], '\n' ];
};
spec = recipes.createAndSharePage('sandwich', [ 'bacon',
'lettuce', 'tomato', 'cheese', 'onion',
'hot & spicy sauce', 'mustard', '"Ben\'s beans"' ]);
tu.expectEqual(brakk(spec), expectedHTML);
tu.expectEqual(spec, expectedTree);
var brakkoliFactory = require('brakkoli-pmb'),
brakk = brakkoliFactory(), // <-- using default config
customBrakk = brakkoliFactory({ tplSlotRx: /\{{2}([\w\-]*)\}{2}/g });
brakk
expects one argument, spec
, which should be an array.
If multiple argument are given, spec
is constructed internally
as an array that contains the empty string, followed by all arguments.
brakk
maintains a dictionary object fxcfg
to keep track of
special effects settings.
The factory function accepts a single, optional argument fxdefaults
with your favorite defaults for fxcfg
.
spec
's elements are processed, in original order, depending on their type:
undefined
and null
values are ignored.All tag content is converted as described below and concatenated to construct the initial result string.
Currently, the only supported type of tag head is a string.
If the tag head is not empty, the template effects (see below) are applied.
If the tag head still is not empty,
an opening tag is constructed from it,
and is prepended before the result string.
If the tag head ends with a character other than >
,
a closing tag is constructed and appended to the result string.
Arrays are converted using brakk
, and special effect processing is skipped
since it should have happened already, as part of the conversion.
All other values are String()
ified and then special effects may be applied:
fxcfg.rawXml !== false
, XML special characters are replaced like
xmldefuse does in default mode.(to be documented)
store
→ Object upd
: Object.assign(fxcfg.tplVars, upd);
ISC
FAQs
An SGML (XML, HTML) template engine that uses arrays for hierarchy.
The npm package brakkoli-pmb receives a total of 3 weekly downloads. As such, brakkoli-pmb popularity was classified as not popular.
We found that brakkoli-pmb 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.