diff --git a/src/components/Content/EdText.vue b/src/components/Content/EdText.vue
index 916cdf8..7346102 100644
--- a/src/components/Content/EdText.vue
+++ b/src/components/Content/EdText.vue
@@ -42,30 +42,45 @@ export default {
// console.log('EdText: builded html', this.html)
},
parseLinks () {
- const regx = //g
- let links = this.html.match(regx)
+ let links = this.html.match(//g)
console.log('links', links)
if (links) {
- let domlink, newlink, uuid
+ // let domparser = new DOMParser()
+ // let domlink
+ let linkparts, newlink, uuid
let index = null
for (var i = 0; i < links.length; i++) {
- domlink = new DOMParser().parseFromString(links[i], 'text/xml').firstChild
- console.log('domlink', domlink.classList)
- if (domlink.classList.contains('placeName')) { index = 'locorum' }
- if (domlink.classList.contains('persName')) { index = 'nominum' }
- if (domlink.classList.contains('objectName')) { index = 'operum' }
- console.log('index:', index)
+ // console.log(`link ${i}:`, links[i])
+ // domlink = domparser.parseFromString(links[i], 'text/xml').firstChild
+ // console.log('domlink', domlink.classList)
+ // if (domlink.classList.contains('placeName')) { index = 'locorum' }
+ // if (domlink.classList.contains('persName')) { index = 'nominum' }
+ // if (domlink.classList.contains('objectName')) { index = 'operum' }
+ // console.log('index:', index)
+ linkparts = RegExp(/(.+)<\/a>/g).exec(links[i], 'g')
+ // console.log('linkparts', linkparts)
+ switch (linkparts[1]) {
+ case 'persName':
+ index = 'nominum'
+ break
+ case 'placeName':
+ index = 'locorum'
+ break
+ case 'objectName':
+ index = 'operum'
+ break
+ }
if (index) {
- uuid = domlink.getAttribute('href').replace('#', '')
+ uuid = linkparts[2].replace('#', '')
newlink = `${domlink.innerHTML}`
- console.log('newlink', newlink)
+ `>${linkparts[3]}`
+ // console.log('newlink', newlink)
this.html = this.html.replace(links[i], newlink)
}
}