diff --git a/Assets/WebsiteAssets/images/badges/Donate-IBAN.svg b/Assets/WebsiteAssets/images/badges/Donate-IBAN.svg new file mode 100644 index 000000000..3d6978ca9 --- /dev/null +++ b/Assets/WebsiteAssets/images/badges/Donate-IBAN.svg @@ -0,0 +1 @@ +Donate: IBANDonateIBAN \ No newline at end of file diff --git a/README.md b/README.md index 2d4f3cc94..cbcfe0149 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -[![Donate](https://joplinapp.org/images/badges/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=E8JMYD2LQ8MMA&lc=GB&item_name=Joplin+Development¤cy_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted) [![Sponsor on GitHub](https://joplinapp.org/images/badges/GitHub-Badge.svg)](https://github.com/sponsors/laurent22/) [![Become a patron](https://joplinapp.org/images/badges/Patreon-Badge.svg)](https://www.patreon.com/joplin) + +[![Donate using PayPal](https://joplinapp.org/images/badges/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=E8JMYD2LQ8MMA&lc=GB&item_name=Joplin+Development¤cy_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted) [![Sponsor on GitHub](https://joplinapp.org/images/badges/GitHub-Badge.svg)](https://github.com/sponsors/laurent22/) [![Become a patron](https://joplinapp.org/images/badges/Patreon-Badge.svg)](https://www.patreon.com/joplin) [![Donate using IBAN](https://joplinapp.org/images/badges/Donate-IBAN.svg)](https://joplinapp.org/donate/#donations) + * * * diff --git a/packages/tools/build-website.js b/packages/tools/build-website.js index 0b488d1c8..be7b31603 100644 --- a/packages/tools/build-website.js +++ b/packages/tools/build-website.js @@ -541,6 +541,16 @@ function tocMd() { return tocMd_; } +const donateLinksRegex_ = /([^]*)/; +async function getDonateLinks() { + const md = await fs.readFile(`${rootDir}/README.md`, 'utf8'); + const matches = md.match(donateLinksRegex_, ''); + + if (!matches) throw new Error('Cannot fetch donate links'); + + return matches[1].trim(); +} + function replaceGitHubByJoplinAppLinks(md) { // let output = md.replace(/https:\/\/github.com\/laurent22\/joplin\/blob\/master\/readme\/(.*?)\/index\.md(#[^\s)]+|)/g, 'https://joplinapp.org/$1'); return md.replace(/https:\/\/github.com\/laurent22\/joplin\/blob\/dev\/readme\/(.*?)\.md(#[^\s)]+|)/g, 'https://joplinapp.org/$1/$2'); @@ -577,6 +587,10 @@ function renderMdToHtml(md, targetPath, templateParams) { md = replaceGitHubByJoplinAppLinks(md); + if (templateParams.donateLinksMd) { + md = `${templateParams.donateLinksMd}\n\n* * *\n\n${md}`; + } + templateParams.pageTitle = title.join(' | '); const html = markdownToHtml(md, templateParams); @@ -626,11 +640,15 @@ async function main() { }).map(f => f.substr(rootDir.length + 1)); const sources = []; + const donateLinksMd = await getDonateLinks(); for (const mdFile of mdFiles) { const title = await readmeFileTitle(`${rootDir}/${mdFile}`); const targetFilePath = `${mdFile.replace(/\.md/, '').replace(/readme\//, 'docs/')}/index.html`; - sources.push([mdFile, targetFilePath, { title: title }]); + sources.push([mdFile, targetFilePath, { + title: title, + donateLinksMd: donateLinksMd, + }]); } const path = require('path');