MCPcopy Index your code
hub / github.com/braziljs/eloquente-javascript / transformInline

Function transformInline

src/transform.mjs:70–86  ·  view source on GitHub ↗
(tokens, options, prevType)

Source from the content-addressed store, hash-verified

68}
69
70function transformInline(tokens, options, prevType) {
71 let capitalize = options.capitalizeTitles && prevType == "heading_open"
72 let result = []
73 for (let i = 0; i < tokens.length; i++) {
74 let tok = tokens[i], type = tok.type
75 if (type == "meta_if_close" || (options.index === false && type == "meta_index")) {
76 // Drop
77 } else if (type == "meta_if_open") {
78 i = handleIf(tokens, i, options)
79 } else {
80 if (type == "text" && /[\'\"]/.test(tok.content)) tok.content = smartQuotes(tokens, i, options.texQuotes, options.moveQuotes)
81 if (capitalize) tok.content = capitalizeTitle(tok.content)
82 result.push(tok)
83 }
84 }
85 return result
86}
87
88function nextTag(tokens, i) {
89 for (let j = i + 1; j < tokens.length; j++) if (tokens[j].tag) return tokens[j];

Callers 1

transformTokensFunction · 0.85

Calls 3

handleIfFunction · 0.85
smartQuotesFunction · 0.85
capitalizeTitleFunction · 0.85

Tested by

no test coverage detected