|
|
@@ -135,7 +135,7 @@ class _MDSpan {
|
|
135
|
135
|
/** @var {String[]} */
|
|
136
|
136
|
cssClasses = [];
|
|
137
|
137
|
/** @var {String|null} */
|
|
138
|
|
- id = null;
|
|
|
138
|
+ cssId = null;
|
|
139
|
139
|
/** @var {Object} */
|
|
140
|
140
|
attributes = {};
|
|
141
|
141
|
|
|
|
@@ -152,8 +152,8 @@ class _MDSpan {
|
|
152
|
152
|
if (this.cssClasses.length > 0) {
|
|
153
|
153
|
html += ` class="${this.cssClasses.join(' ')}"`;
|
|
154
|
154
|
}
|
|
155
|
|
- if (this.id !== null) {
|
|
156
|
|
- html += ` id="${this.id}"`;
|
|
|
155
|
+ if (this.cssId !== null) {
|
|
|
156
|
+ html += ` id="${this.cssId}"`;
|
|
157
|
157
|
}
|
|
158
|
158
|
for (const name in this.attributes) {
|
|
159
|
159
|
let value = this.attributes[name];
|
|
|
@@ -290,12 +290,12 @@ class _MDLinkSpan extends _MDSpan {
|
|
290
|
290
|
}
|
|
291
|
291
|
|
|
292
|
292
|
class _MDReferencedLinkSpan extends _MDLinkSpan {
|
|
293
|
|
- /** @var {String} id */
|
|
294
|
|
- id;
|
|
|
293
|
+ /** @var {String} */
|
|
|
294
|
+ ref;
|
|
295
|
295
|
|
|
296
|
|
- constructor(id, content) {
|
|
|
296
|
+ constructor(ref, content) {
|
|
297
|
297
|
super(null, content);
|
|
298
|
|
- this.id = id;
|
|
|
298
|
+ this.ref = ref;
|
|
299
|
299
|
}
|
|
300
|
300
|
|
|
301
|
301
|
/**
|
|
|
@@ -303,8 +303,8 @@ class _MDReferencedLinkSpan extends _MDLinkSpan {
|
|
303
|
303
|
*/
|
|
304
|
304
|
toHTML(state) {
|
|
305
|
305
|
if (!this.link) {
|
|
306
|
|
- let url = state.urls[this.id.toLowerCase()];
|
|
307
|
|
- let title = state.urlTitles[this.id.toLowerCase()];
|
|
|
306
|
+ let url = state.urls[this.ref.toLowerCase()];
|
|
|
307
|
+ let title = state.urlTitles[this.ref.toLowerCase()];
|
|
308
|
308
|
this.link = url;
|
|
309
|
309
|
this.title = title || this.title;
|
|
310
|
310
|
}
|
|
|
@@ -312,7 +312,7 @@ class _MDReferencedLinkSpan extends _MDLinkSpan {
|
|
312
|
312
|
return super.toHTML(state);
|
|
313
|
313
|
} else {
|
|
314
|
314
|
let contentHTML = this.content.toHTML(state);
|
|
315
|
|
- return `[${contentHTML}][${this.id}]`;
|
|
|
315
|
+ return `[${contentHTML}][${this.ref}]`;
|
|
316
|
316
|
}
|
|
317
|
317
|
}
|
|
318
|
318
|
}
|
|
|
@@ -422,27 +422,28 @@ class _MDImageSpan extends _MDSpan {
|
|
422
|
422
|
|
|
423
|
423
|
class _MDReferencedImageSpan extends _MDImageSpan {
|
|
424
|
424
|
/** @var {String} */
|
|
425
|
|
- id;
|
|
|
425
|
+ ref;
|
|
426
|
426
|
|
|
427
|
427
|
/**
|
|
428
|
|
- * @param {String} id
|
|
|
428
|
+ * @param {String} ref
|
|
|
429
|
+ * @param {String|null} alt
|
|
429
|
430
|
*/
|
|
430
|
|
- constructor(id, alt) {
|
|
|
431
|
+ constructor(ref, alt) {
|
|
431
|
432
|
super(null, alt);
|
|
432
|
|
- this.id = id;
|
|
|
433
|
+ this.ref = ref;
|
|
433
|
434
|
}
|
|
434
|
435
|
|
|
435
|
436
|
toHTML(state) {
|
|
436
|
437
|
if (!this.source) {
|
|
437
|
|
- let url = state.urls[this.id.toLowerCase()];
|
|
438
|
|
- let title = state.urlTitles[this.id.toLowerCase()];
|
|
|
438
|
+ let url = state.urls[this.ref.toLowerCase()];
|
|
|
439
|
+ let title = state.urlTitles[this.ref.toLowerCase()];
|
|
439
|
440
|
this.source = url;
|
|
440
|
441
|
this.title = title || this.title;
|
|
441
|
442
|
}
|
|
442
|
443
|
if (this.source) {
|
|
443
|
444
|
return super.toHTML(state);
|
|
444
|
445
|
} else {
|
|
445
|
|
- return `![${_MDUtils.escapeHTML(this.alt)}][${_MDUtils.escapeHTML(this.id)}]`;
|
|
|
446
|
+ return `![${_MDUtils.escapeHTML(this.alt)}][${_MDUtils.escapeHTML(this.ref)}]`;
|
|
446
|
447
|
}
|
|
447
|
448
|
}
|
|
448
|
449
|
}
|
|
|
@@ -472,7 +473,7 @@ class _MDBlock {
|
|
472
|
473
|
/** @var {String[]} */
|
|
473
|
474
|
cssClasses = [];
|
|
474
|
475
|
/** @var {String|null} */
|
|
475
|
|
- id = null;
|
|
|
476
|
+ cssId = null;
|
|
476
|
477
|
/** @var {Object} */
|
|
477
|
478
|
attributes = {};
|
|
478
|
479
|
|
|
|
@@ -488,8 +489,8 @@ class _MDBlock {
|
|
488
|
489
|
if (this.cssClasses.length > 0) {
|
|
489
|
490
|
html += ` class="${this.cssClasses.join(' ')}"`;
|
|
490
|
491
|
}
|
|
491
|
|
- if (this.id !== null) {
|
|
492
|
|
- html += ` id="${this.id}"`;
|
|
|
492
|
+ if (this.cssId !== null) {
|
|
|
493
|
+ html += ` id="${this.cssId}"`;
|
|
493
|
494
|
}
|
|
494
|
495
|
for (const name in this.attributes) {
|
|
495
|
496
|
let value = this.attributes[name];
|
|
|
@@ -964,7 +965,7 @@ class _MDTagModifier {
|
|
964
|
965
|
/** @var {String[]} */
|
|
965
|
966
|
cssClasses = [];
|
|
966
|
967
|
/** @var {String|null} */
|
|
967
|
|
- id = null;
|
|
|
968
|
+ cssId = null;
|
|
968
|
969
|
/** @var {Object} */
|
|
969
|
970
|
attributes = {};
|
|
970
|
971
|
|
|
|
@@ -984,7 +985,7 @@ class _MDTagModifier {
|
|
984
|
985
|
applyTo(elem) {
|
|
985
|
986
|
if (elem instanceof _MDBlock || elem instanceof _MDSpan) {
|
|
986
|
987
|
elem.cssClasses = elem.cssClasses.concat(this.cssClasses);
|
|
987
|
|
- if (this.id) elem.id = this.id;
|
|
|
988
|
+ if (this.cssId) elem.cssId = this.cssId;
|
|
988
|
989
|
for (const name in this.attributes) {
|
|
989
|
990
|
elem.attributes[name] = this.attributes[name];
|
|
990
|
991
|
}
|
|
|
@@ -1001,7 +1002,7 @@ class _MDTagModifier {
|
|
1001
|
1002
|
if (groups = this.#classRegex.exec(token)) {
|
|
1002
|
1003
|
mod.cssClasses.push(groups[1]);
|
|
1003
|
1004
|
} else if (groups = this.#idRegex.exec(token)) {
|
|
1004
|
|
- mod.id = groups[1];
|
|
|
1005
|
+ mod.cssId = groups[1];
|
|
1005
|
1006
|
} else if (groups = this.#attributeRegex.exec(token)) {
|
|
1006
|
1007
|
mod.attributes[groups[1]] = groups[2];
|
|
1007
|
1008
|
} else {
|