mirror of
https://github.com/mue/mue.git
synced 2026-07-27 02:31:06 +02:00
fix: quote author image copyright and license text
This commit is contained in:
@@ -154,20 +154,24 @@ class Quote extends PureComponent {
|
|||||||
authorimglicensedata.query.pages[Object.keys(authorimglicensedata.query.pages)[0]];
|
authorimglicensedata.query.pages[Object.keys(authorimglicensedata.query.pages)[0]];
|
||||||
const metadata = authorImagePage?.imageinfo?.[0]?.extmetadata;
|
const metadata = authorImagePage?.imageinfo?.[0]?.extmetadata;
|
||||||
const license = metadata?.LicenseShortName;
|
const license = metadata?.LicenseShortName;
|
||||||
const photographer =
|
const photographer = this.stripHTML(
|
||||||
this.stripHTML(metadata?.Attribution?.value || metadata?.Artist?.value || '').replace(
|
metadata?.Attribution?.value || metadata?.Artist?.value || '',
|
||||||
/ \(talk\)/,
|
)
|
||||||
'',
|
.replace(/©\s/, '')
|
||||||
) || // talk page link (if applicable) is only removed for English
|
.replace(/ \(talk\)/, ''); // talk page link (if applicable) is only removed for English
|
||||||
'Unknown';
|
|
||||||
authorimglicense = `© ${photographer}. ${license?.value}`;
|
|
||||||
authorimglicense = authorimglicense.replace(/copyright\s/i, '').replace(/©\s©\s/, '© ');
|
|
||||||
|
|
||||||
if (license?.value === 'Public domain') {
|
if (!photographer) {
|
||||||
authorimglicense = null;
|
|
||||||
} else if (photographer.value === 'Unknown' || !photographer) {
|
|
||||||
authorimglicense = null;
|
|
||||||
authorimg = null;
|
authorimg = null;
|
||||||
|
authorimglicense = null;
|
||||||
|
} else if (license?.value === 'Public domain') {
|
||||||
|
authorimglicense = null;
|
||||||
|
} else {
|
||||||
|
if (photographer) {
|
||||||
|
authorimglicense = `© ${photographer}${license ? `. ${license.value}` : ''}`;
|
||||||
|
} else if (license) {
|
||||||
|
authorimglicense = license.value;
|
||||||
|
}
|
||||||
|
authorimglicense = authorimglicense.replace(/copyright\s/i, '');
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
@@ -285,9 +289,7 @@ class Quote extends PureComponent {
|
|||||||
author: data.author,
|
author: data.author,
|
||||||
authorlink: this.getAuthorLink(data.author),
|
authorlink: this.getAuthorLink(data.author),
|
||||||
authorimg: authorimgdata.authorimg,
|
authorimg: authorimgdata.authorimg,
|
||||||
authorimglicense:
|
authorimglicense: authorimgdata.authorimglicense,
|
||||||
authorimgdata.authorimglicense &&
|
|
||||||
authorimgdata.authorimglicense.replace(' undefined. ', ' '),
|
|
||||||
quoteLanguage: quoteLanguage,
|
quoteLanguage: quoteLanguage,
|
||||||
authorOccupation: data.author_occupation,
|
authorOccupation: data.author_occupation,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user