(tokens, i, tex, moveQuotes)
| 30 | } |
| 31 | |
| 32 | function smartQuotes(tokens, i, tex, moveQuotes) { |
| 33 | let text = tokens[i].content, from = 0 |
| 34 | for (let j = i - 1, tt; j >= 0; j--) if (tt = tokenText(tokens[j])) { |
| 35 | text = tt + text |
| 36 | from = tt.length |
| 37 | break |
| 38 | } |
| 39 | let to = text.length |
| 40 | for (let j = i + 1, tt; j < tokens.length; j++) if (tt = tokenText(tokens[j])) { |
| 41 | text += tt |
| 42 | break |
| 43 | } |
| 44 | |
| 45 | let quoted = text |
| 46 | .replace(/([\w\.,!?\)])'/g, "$1’") |
| 47 | .replace(/'(\w|\(\()/g, "‘$1") |
| 48 | .replace(/([\w\.,!?\)])"/g, "$1”") |
| 49 | .replace(/"(\w|\(\()/g, "“$1") |
| 50 | .slice(from, to) |
| 51 | if (moveQuotes) quoted = quoted.replace(/”([.!?:;,]+)/g, "$1”") |
| 52 | return tex ? quoted.replace(/‘/g, "`").replace(/’/g, "'").replace(/“/g, "``").replace(/”/g, "''") : quoted |
| 53 | } |
| 54 | |
| 55 | function handleIf(tokens, i, options) { |
| 56 | let tag = tokens[i].args[0] |
no test coverage detected