mirror of https://github.com/mue/mue.git
fix: quote image license text (closes #549)
This commit is contained in:
parent
c29376f715
commit
a7069fbf1e
|
@ -113,6 +113,11 @@ export default class Quote extends PureComponent {
|
||||||
.join('_')}`;
|
.join('_')}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stripHTML(html) {
|
||||||
|
const tmpdoc = new DOMParser().parseFromString(html, 'text/html');
|
||||||
|
return tmpdoc.body.textContent || "";
|
||||||
|
}
|
||||||
|
|
||||||
async getAuthorImg(author) {
|
async getAuthorImg(author) {
|
||||||
if (localStorage.getItem('authorImg') === 'false') {
|
if (localStorage.getItem('authorImg') === 'false') {
|
||||||
return {
|
return {
|
||||||
|
@ -150,7 +155,7 @@ export default class Quote extends PureComponent {
|
||||||
const license = metadata.LicenseShortName;
|
const license = metadata.LicenseShortName;
|
||||||
const photographer =
|
const photographer =
|
||||||
metadata.Attribution.value ||
|
metadata.Attribution.value ||
|
||||||
metadata.Artist?.value.match(/<a.+>(?<name>.+)<\/a>/i)?.groups.name ||
|
this.stripHTML(metadata.Artist?.value || '').replace(/ \(talk\)/, '') || // talk page link (if applicable) is only removed for English
|
||||||
'Unknown';
|
'Unknown';
|
||||||
authorimglicense = `© ${photographer}. ${license.value}`;
|
authorimglicense = `© ${photographer}. ${license.value}`;
|
||||||
authorimglicense = authorimglicense.replace(/copyright\s/i, '').replace(/©\s©\s/, '© ');
|
authorimglicense = authorimglicense.replace(/copyright\s/i, '').replace(/©\s©\s/, '© ');
|
||||||
|
|
Loading…
Reference in New Issue