| 1197 | // Attempt to parse backticks, adding either a backtick code span or a |
| 1198 | // literal sequence of backticks. |
| 1199 | var parseBackticks = function(block) { |
| 1200 | var ticks = this.match(reTicksHere); |
| 1201 | if (ticks === null) { |
| 1202 | return false; |
| 1203 | } |
| 1204 | var afterOpenTicks = this.pos; |
| 1205 | var matched; |
| 1206 | var node; |
| 1207 | while ((matched = this.match(reTicks)) !== null) { |
| 1208 | if (matched === ticks) { |
| 1209 | node = new Node('code'); |
| 1210 | node._literal = this.subject.slice(afterOpenTicks, |
| 1211 | this.pos - ticks.length) |
| 1212 | .trim().replace(reWhitespace, ' '); |
| 1213 | block.appendChild(node); |
| 1214 | return true; |
| 1215 | } |
| 1216 | } |
| 1217 | // If we got here, we didn't match a closing backtick sequence. |
| 1218 | this.pos = afterOpenTicks; |
| 1219 | block.appendChild(text(ticks)); |
| 1220 | return true; |
| 1221 | }; |
| 1222 | |
| 1223 | // Parse a backslash-escaped special character, adding either the escaped |
| 1224 | // character, a hard line break (if the backslash is followed by a newline), |