mirror of
https://github.com/tenrok/BBob.git
synced 2026-06-14 18:42:24 +03:00
feat(*): react render support, move some helper functions to plugin-helper
This commit is contained in:
@@ -1,19 +1,4 @@
|
||||
function escapeQuote(value) {
|
||||
return value.replace(/"/g, '"');
|
||||
}
|
||||
|
||||
function attrValue(name, value) {
|
||||
const type = typeof value;
|
||||
|
||||
const types = {
|
||||
boolean: () => (value ? `${name}` : ''),
|
||||
number: () => `${name}="${value}"`,
|
||||
string: () => `${name}="${escapeQuote(value)}"`,
|
||||
object: () => `${name}="${escapeQuote(JSON.stringify(value))}"`,
|
||||
};
|
||||
|
||||
return types[type] ? types[type]() : '';
|
||||
}
|
||||
const { attrValue } = require('@bbob/plugin-helper');
|
||||
|
||||
/**
|
||||
* Transforms attrs to html params string
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
"version": "1.0.7",
|
||||
"description": "HTML renderer for BBCode pareser BBob",
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"@bbob/plugin-helper": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@bbob/parser": "^1.1.0"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user