You've already forked joplin
							
							
				mirror of
				https://github.com/laurent22/joplin.git
				synced 2025-10-31 00:07:48 +02:00 
			
		
		
		
	Doc: add donate button
This commit is contained in:
		
							
								
								
									
										1
									
								
								Assets/WebsiteAssets/images/badges/Donate-IBAN.svg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								Assets/WebsiteAssets/images/badges/Donate-IBAN.svg
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="86" height="20" role="img" aria-label="Donate: IBAN"><title>Donate: IBAN</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="86" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="49" height="20" fill="#555"/><rect x="49" width="37" height="20" fill="#007ec6"/><rect width="86" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="255" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="390">Donate</text><text x="255" y="140" transform="scale(.1)" fill="#fff" textLength="390">Donate</text><text aria-hidden="true" x="665" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="270">IBAN</text><text x="665" y="140" transform="scale(.1)" fill="#fff" textLength="270">IBAN</text></g></svg> | ||||
| After Width: | Height: | Size: 1.1 KiB | 
| @@ -1,4 +1,6 @@ | ||||
| [](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) [](https://github.com/sponsors/laurent22/) [](https://www.patreon.com/joplin) | ||||
| <!-- DONATELINKS --> | ||||
| [](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) [](https://github.com/sponsors/laurent22/) [](https://www.patreon.com/joplin) [](https://joplinapp.org/donate/#donations) | ||||
| <!-- DONATELINKS --> | ||||
|  | ||||
| * * * | ||||
|  | ||||
|   | ||||
| @@ -541,6 +541,16 @@ function tocMd() { | ||||
| 	return tocMd_; | ||||
| } | ||||
|  | ||||
| const donateLinksRegex_ = /<!-- DONATELINKS -->([^]*)<!-- DONATELINKS -->/; | ||||
| 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'); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user