| exports.tokenize = tokenizeBlockQuoteStart |
| exports.continuation = {tokenize: tokenizeBlockQuoteContinuation} |
| exports.exit = exit |
| |
| var markdownSpace = require('../character/markdown-space') |
| |
| var createSpace = require('./factory-space') |
| |
| function tokenizeBlockQuoteStart(effects, ok, nok) { |
| var self = this |
| |
| return start |
| |
| function start(code) { |
| if (code === 62) { |
| if (!self.containerState.open) { |
| effects.enter('blockQuote', {_container: true}) |
| self.containerState.open = true |
| } |
| |
| effects.enter('blockQuotePrefix') |
| effects.enter('blockQuoteMarker') |
| effects.consume(code) |
| effects.exit('blockQuoteMarker') |
| return after |
| } |
| |
| return nok(code) |
| } |
| |
| function after(code) { |
| if (markdownSpace(code)) { |
| effects.enter('blockQuotePrefixWhitespace') |
| effects.consume(code) |
| effects.exit('blockQuotePrefixWhitespace') |
| effects.exit('blockQuotePrefix') |
| return ok |
| } |
| |
| effects.exit('blockQuotePrefix') |
| return ok(code) |
| } |
| } |
| |
| function tokenizeBlockQuoteContinuation(effects, ok, nok) { |
| return createSpace( |
| effects, |
| effects.attempt(exports, ok, nok), |
| 'linePrefix', |
| 4 |
| ) |
| } |
| |
| function exit(effects) { |
| effects.exit('blockQuote') |
| } |