Fix containers in directive (container)
Closes GH-4.
This commit is contained in:
parent
90f35b016f
commit
152323ec29
4 changed files with 25 additions and 6 deletions
|
@ -10,8 +10,8 @@ var createAttributes = require('./factory-attributes')
|
|||
var createLabel = require('./factory-label')
|
||||
var createName = require('./factory-name')
|
||||
|
||||
var label = {tokenize: tokenizeLabel}
|
||||
var attributes = {tokenize: tokenizeAttributes}
|
||||
var label = {tokenize: tokenizeLabel, partial: true}
|
||||
var attributes = {tokenize: tokenizeAttributes, partial: true}
|
||||
|
||||
function tokenizeDirectiveContainer(effects, ok, nok) {
|
||||
var self = this
|
||||
|
@ -46,6 +46,7 @@ function tokenizeDirectiveContainer(effects, ok, nok) {
|
|||
}
|
||||
|
||||
function afterName(code) {
|
||||
console.log('after:name:', code)
|
||||
return code === 91 /* `[` */
|
||||
? effects.attempt(label, afterLabel, afterLabel)(code)
|
||||
: afterLabel(code)
|
||||
|
|
|
@ -8,8 +8,8 @@ var createAttributes = require('./factory-attributes')
|
|||
var createLabel = require('./factory-label')
|
||||
var createName = require('./factory-name')
|
||||
|
||||
var label = {tokenize: tokenizeLabel}
|
||||
var attributes = {tokenize: tokenizeAttributes}
|
||||
var label = {tokenize: tokenizeLabel, partial: true}
|
||||
var attributes = {tokenize: tokenizeAttributes, partial: true}
|
||||
|
||||
function tokenizeDirectiveLeaf(effects, ok, nok) {
|
||||
return start
|
||||
|
|
|
@ -7,8 +7,8 @@ var createAttributes = require('./factory-attributes')
|
|||
var createLabel = require('./factory-label')
|
||||
var createName = require('./factory-name')
|
||||
|
||||
var label = {tokenize: tokenizeLabel}
|
||||
var attributes = {tokenize: tokenizeAttributes}
|
||||
var label = {tokenize: tokenizeLabel, partial: true}
|
||||
var attributes = {tokenize: tokenizeAttributes, partial: true}
|
||||
|
||||
function previous(code) {
|
||||
// If there is a previous code, there will always be a tail.
|
||||
|
|
18
test.js
18
test.js
|
@ -1262,6 +1262,24 @@ test('content', function (t) {
|
|||
'should support text directives in container directives'
|
||||
)
|
||||
|
||||
t.equal(
|
||||
micromark(':::section\n* a\n:::', options({'*': h})),
|
||||
'<section>\n<ul>\n<li>a</li>\n</ul>\n</section>',
|
||||
'should support lists in container directives'
|
||||
)
|
||||
|
||||
t.equal(
|
||||
micromark(':::section[]\n* a\n:::', options({'*': h})),
|
||||
'<section>\n<ul>\n<li>a</li>\n</ul>\n</section>',
|
||||
'should support lists w/ label brackets in container directives'
|
||||
)
|
||||
|
||||
t.equal(
|
||||
micromark(':::section{}\n* a\n:::', options({'*': h})),
|
||||
'<section>\n<ul>\n<li>a</li>\n</ul>\n</section>',
|
||||
'should support lists w/ attribute braces in container directives'
|
||||
)
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue