3 var trim = require('trim');
4 var interrupt = require('../util/interrupt');
6 module.exports = blockquote;
13 /* Tokenise a blockquote. */
14 function blockquote(eat, value, silent) {
16 var offsets = self.offset;
17 var tokenizers = self.blockTokenizers;
18 var interruptors = self.interruptBlockquote;
20 var currentLine = now.line;
21 var length = value.length;
36 while (index < length) {
37 character = value.charAt(index);
39 if (character !== C_SPACE && character !== C_TAB) {
46 if (value.charAt(index) !== C_GT) {
56 while (index < length) {
57 nextIndex = value.indexOf(C_NEWLINE, index);
61 if (nextIndex === -1) {
65 while (index < length) {
66 character = value.charAt(index);
68 if (character !== C_SPACE && character !== C_TAB) {
75 if (value.charAt(index) === C_GT) {
79 if (value.charAt(index) === C_SPACE) {
86 content = value.slice(index, nextIndex);
88 if (!prefixed && !trim(content)) {
94 rest = value.slice(index);
96 /* Check if the following code contains a possible
98 if (interrupt(interruptors, tokenizers, self, [eat, rest, true])) {
103 line = startIndex === index ? content : value.slice(startIndex, nextIndex);
105 indents.push(index - startIndex);
107 contents.push(content);
109 index = nextIndex + 1;
113 length = indents.length;
114 add = eat(values.join(C_NEWLINE));
116 while (++index < length) {
117 offsets[currentLine] = (offsets[currentLine] || 0) + indents[index];
121 exit = self.enterBlock();
122 contents = self.tokenizeBlock(contents.join(C_NEWLINE), now);