MCPcopy
hub / github.com/teadocs/numpy-cn / replaceEm

Method replaceEm

scripts/htmlToMd.js:299–321  ·  view source on GitHub ↗
($el)

Source from the content-addressed store, hash-verified

297 }
298
299 replaceEm($el) {
300 let that = this;
301 let hContent = $el.prop("outerHTML");
302 let ems = $el.find('em');
303 if (ems.length) {
304 ems.each(function (index, el) {
305 let outHtml = that.$(el).prop("outerHTML");
306 let oText = that.$(el).text();
307 let text = that.$(el).text();
308 text = that.uReplaceStr(text);
309 text = text.replace(/\*/g, '\\*');
310 let bText = `*${text}*`;
311 if (oText.match(/^\s/)) {
312 bText = ' ' + bText;
313 }
314 if (oText.match(/\s$/)) {
315 bText = bText + ' ';
316 }
317 hContent = hContent.replace(outHtml, ' ' + bText + ' ');
318 });
319 }
320 return hContent;
321 }
322
323 replaceSpec($el) {
324 let that = this;

Callers 1

getPcontentMethod · 0.95

Calls 1

uReplaceStrMethod · 0.80

Tested by

no test coverage detected