Added chapter renderer and type for report
This commit is contained in:
parent
97e318ce6f
commit
838e9730a4
@ -16,7 +16,7 @@ const ChapterRenderer: React.FC<ChapterRendererProps> = ({ content, glossary })
|
||||
// Replace glossary terms in the line
|
||||
Object.entries(glossary).forEach(([term, definition]) => {
|
||||
const termRegex = new RegExp(`\\b${term}\\b`, "gi"); // Match whole word (case-insensitive)
|
||||
line = line.replace(termRegex, `<glossarypopup term="${term}" definition="${definition}" />`);
|
||||
line = line.replace(termRegex, `<glossarypopup term="${term}" definition="${definition}"></glossarypopup>`);
|
||||
});
|
||||
|
||||
line = line.replace(/<p>/g, "<div>").replace(/<\/p>/g, "</div>");
|
||||
@ -26,7 +26,11 @@ const ChapterRenderer: React.FC<ChapterRendererProps> = ({ content, glossary })
|
||||
|
||||
return (
|
||||
<div>
|
||||
{processed_lines.map((line, index) => (
|
||||
{processed_lines.map((line, index) => {
|
||||
if (!line.includes("<glossarypopup")) {
|
||||
return <div key={index} className="mb-4">{parse(line)}</div>;
|
||||
}
|
||||
return (
|
||||
<div key={index} className="mb-4">
|
||||
{parse(line, {
|
||||
replace: (domNode: DOMNode) => {
|
||||
@ -42,7 +46,8 @@ const ChapterRenderer: React.FC<ChapterRendererProps> = ({ content, glossary })
|
||||
},
|
||||
})}
|
||||
</div>
|
||||
))}
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
@ -81,7 +81,16 @@ export interface Release {
|
||||
datetime: string;
|
||||
url: string;
|
||||
}
|
||||
|
||||
export interface Report {
|
||||
error_type: string;
|
||||
details: string;
|
||||
resolve: boolean;
|
||||
}
|
||||
|
||||
export const Ad = {
|
||||
patreon: "https://patreon.com/nulltranslationgroup/membership",
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user