* Creates markup for a symbol node.
()
| 1241 | |
| 1242 | |
| 1243 | toMarkup() { |
| 1244 | // TODO(alpert): More duplication than I'd like from |
| 1245 | // span.prototype.toMarkup and symbolNode.prototype.toNode... |
| 1246 | let needsSpan = false; |
| 1247 | let markup = "<span"; |
| 1248 | |
| 1249 | if (this.classes.length) { |
| 1250 | needsSpan = true; |
| 1251 | markup += " class=\""; |
| 1252 | markup += utils.escape(createClass(this.classes)); |
| 1253 | markup += "\""; |
| 1254 | } |
| 1255 | |
| 1256 | let styles = ""; |
| 1257 | |
| 1258 | if (this.italic > 0) { |
| 1259 | styles += "margin-right:" + this.italic + "em;"; |
| 1260 | } |
| 1261 | |
| 1262 | for (const style in this.style) { |
| 1263 | if (this.style.hasOwnProperty(style)) { |
| 1264 | styles += utils.hyphenate(style) + ":" + this.style[style] + ";"; |
| 1265 | } |
| 1266 | } |
| 1267 | |
| 1268 | if (styles) { |
| 1269 | needsSpan = true; |
| 1270 | markup += " style=\"" + utils.escape(styles) + "\""; |
| 1271 | } |
| 1272 | |
| 1273 | const escaped = utils.escape(this.text); |
| 1274 | |
| 1275 | if (needsSpan) { |
| 1276 | markup += ">"; |
| 1277 | markup += escaped; |
| 1278 | markup += "</span>"; |
| 1279 | return markup; |
| 1280 | } else { |
| 1281 | return escaped; |
| 1282 | } |
| 1283 | } |
| 1284 | |
| 1285 | } |
| 1286 | /** |
nothing calls this directly
no test coverage detected