var assert = require('assert')
var stringify = require('commonform-markup-stringify')
assert.equal(
stringify({content: ['This is a test.']}),
'This is a test.'
)
assert.equal(
stringify({
content: [
'This agreement (this ',
{definition: 'Agreement'},
') is between ',
{blank: ''},
' and the ',
{use: 'Company'},
'. See ',
{reference: 'Something'},
'.'
]
}),
'This agreement (this ""Agreement"") is between [] and the' +
' <Company>. See {Something}.'
)
assert.equal(
stringify({content: ['This paragraph has [brackets] in it.']}),
'This paragraph has \\[brackets\\] in it.'
)
assert.equal(
stringify({
content: [
'If you see:',
{form: {content: ['a lion;']}},
{form: {content: ['a tiger; or']}},
{
form: {
content: [
{form: {content: ['something scary;']}},
{form: {content: ['like a bear']}}
]
}
},
'then run!'
]
}),
[
'If you see:',
'',
' \\\\',
' a lion;',
' ',
'',
' \\\\',
' a tiger; or',
' ',
'',
' \\\\',
' ',
'',
' \\\\',
' something scary;',
' ',
'',
' \\\\',
' like a bear',
' ',
' ',
'',
'then run!'
]
.join('\n')
)
var form = {
content: [
{
heading: 'Definition',
form: {
content: [
{definition: 'Change of Control'},
' means',
{
form: {
content: [
'a transaction or series of related transactions in' +
' which any "person" or "group" (within the meaning' +
' of Section 13(d) and 14(d) of the Securities' +
' Exchange Act of 1934, as amended), becomes the' +
' "beneficial owner" (as defined in Rule 13d-3' +
' under the Securities Exchange Act of 1934, as' +
' amended), directly or indirectly, of more than ',
{blank: ''},
' of the outstanding voting securities of the ',
{use: 'Company'},
' having the right to vote for the election of' +
' members of the ',
{use: 'Company'},
'\'s board of directors,'
]
}
},
{
form: {
content: [
'any reorganization, merger or consolidation of the ',
{use: 'Company'},
', other than a transaction or series of related' +
' transactions in which the holders of the voting' +
' securities of the ',
{use: 'Company'},
' outstanding immediately prior to such transaction' +
' or series of related transactions retain,' +
' immediately after such transaction or series of' +
' related transactions, at least a majority of the' +
' total voting power represented by the outstanding' +
' voting securities of the ',
{use: 'Company'},
' or such other surviving or resulting entity or'
]
}
},
{
form: {
content: [
'a sale, lease or other disposition of all or' +
' substantially all of the assets of the ',
{use: 'Company'},
'.'
]
}
}
]
}
}
]
}
var parse = require('commonform-markup-parse')
assert.deepEqual(
parse(stringify(form)).form,
form
)
commonform-markup-stringify
1.0.0 • Public • PublishedPackage Sidebar
Install
npm i commonform-markup-stringify
Homepage
Weekly Downloads
1
Version
1.0.0
License
Apache-2.0