mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-25 05:54:25 -04:00
(blog) fix instances of <div> inside of <p>
This commit is contained in:
parent
edd314557c
commit
a942f6def2
@ -18,7 +18,7 @@ const mainPlusDetails = (dict: Record<string, string>, wide: boolean) => (_: str
|
||||
|
||||
return `
|
||||
<div class="${wide ? 'wide-escape' : ''}">
|
||||
<p>${content.replace(/%group%/g, 'general').replace(/<iframe class="graph" /g, '<iframe class="graph border" ')}</p>${
|
||||
${content.replace(/%group%/g, 'general').replace(/<iframe class="graph" /g, '<iframe class="graph border" ')}${
|
||||
Object.keys(selectedDict).map((group) => `
|
||||
<details class="border mb-3">
|
||||
<summary class="bg-light px-2 py-1" onclick="this.parentElement.querySelector('iframe.graph').contentDocument.location.reload()">${selectedDict[group]}</summary>
|
||||
@ -95,18 +95,18 @@ export default async function parseMarkdown(markdown: string, translator: Transl
|
||||
return `<a ${attributes.includes('target=') ? '' : 'target="_blank" '}${attributes.includes('rel=') ? '' : 'rel="noopener" '}${attributes}>`;
|
||||
})
|
||||
.replace(/<p>{details=(.+?)}<\/p>(.+?)<p>{\/details}<\/p>/gms, '<details class="border mb-3"><summary class="bg-light p-3">$1</summary><div class="border-top p-3 bg-white">$2</div></details>')
|
||||
.replace(/<img (.*?)>/g, (_, attrs) => {
|
||||
.replace(/<p><img (.*?)><\/p>/g, (_, attrs) => {
|
||||
let classNames = 'border';
|
||||
const m = attrs.match(/alt="\{(.*)\}/);
|
||||
if (m) {
|
||||
classNames = m[1];
|
||||
attrs = attrs.replace(/alt="{(.*)}/, 'alt="');
|
||||
}
|
||||
return `<div class="text-center"><img ${attrs} class="${classNames}" loading="lazy"></div>`;
|
||||
return `<div class="mb-3 text-center"><img ${attrs} class="${classNames}" loading="lazy"></div>`;
|
||||
})
|
||||
.replace(/{favicon=(.+?)}/g, '<img src="https://$1" alt="Favicon" style="width: 1em; height: 1em;">')
|
||||
.replace(/{embed=\/\/(.+?)=(.+?)}/g, '<div style="position: relative;height: 0;padding-bottom: 56.25%;"><iframe src="https://$1" title="$2" allowfullscreen sandbox="allow-same-origin allow-scripts allow-popups" style="position: absolute;top: 0; left: 0;width: 100%;height: 100%;border:0;"></iframe></div>')
|
||||
.replace(/{graph=([^}]+)}/g, '<iframe class="graph" src="$1.html" loading="lazy"></iframe>')
|
||||
.replace(/<p>{embed=\/\/(.+?)=(.+?)}<\/p>/g, '<div style="position: relative;height: 0;padding-bottom: 56.25%;"><iframe src="https://$1" title="$2" allowfullscreen sandbox="allow-same-origin allow-scripts allow-popups" style="position: absolute;top: 0; left: 0;width: 100%;height: 100%;border:0;"></iframe></div>')
|
||||
.replace(/<p>{graph=([^}]+)}<\/p>/g, '<iframe class="graph" src="$1.html" loading="lazy"></iframe>')
|
||||
|
||||
.replace(/<p>{set_census_groups=(.+?)}<\/p>/gms, (_, value) => {
|
||||
census_groups = JSON.parse(replaceQuoteEntity(value));
|
||||
@ -129,12 +129,12 @@ export default async function parseMarkdown(markdown: string, translator: Transl
|
||||
})
|
||||
.replace(/<h1 id="🏳️🌈-/g, '<h1 id="') // license header
|
||||
.replace(/ id=""/g, '')
|
||||
.replace(/{wide_table}/g, '<div class="table-wide table-responsive my-5 headers-nowrap">')
|
||||
.replace(/{\/wide_table}/g, '</div>')
|
||||
.replace(/{gallery={(.*?)}}/gms, generateGallery)
|
||||
.replace(/<p>{wide_table}<\/p>/g, '<div class="table-wide table-responsive my-5 headers-nowrap">')
|
||||
.replace(/<p>{\/wide_table}<\/p>/g, '</div>')
|
||||
.replace(/<p>{gallery={(.*?)}}<\/p>/gms, generateGallery)
|
||||
}</div>`;
|
||||
|
||||
content = content.replace(/{table_of_contents}/g, generateToC(content, translator));
|
||||
content = content.replace(/<p>{table_of_contents}<\/p>/g, generateToC(content, translator));
|
||||
|
||||
content = content.replace(/{optional}(.+?){\/optional}/gms, (_, content) => {
|
||||
if (content.includes('badge bg-danger')) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user