Improvement: Novel Updates: Plugin Update (#1553)

* novel-updates: plugin update

* novel-updates: update

* novel-updates: update

* novel-updates: update

* novel-updates: update

* novel-updates: update

* novel-updates: update

* novel-updates: update

* novel-updates: update

* novel-updates: update

* novel-updates: update

* novel-updates: update

* novel-updates: update

* novel-updates: update

* novel-updates: update

* chapter-sync: update test version

* chapter-sync: update

* chapter-sync: update

* chapter-sync: update

* novel-updates: update

* novel-updates: update

* novel-updates: update

* novel-updates: update

* novel-updates: update

* novel-updates: update

* novel-updates: update

* novel-updates: update

* novel-updates: update

* novel-updates: update

* novel-updates: update

* novel-updates: update

* novel-updates: update

* novel-updates: update

* novel-updates: update

* novel-updates: revert test version
This commit is contained in:
Batorian
2025-03-20 11:19:27 +01:00
committed by GitHub
parent 7ad6a5e4b7
commit ade1efa2e7
2 changed files with 459 additions and 564 deletions
+9 -13
View File
@@ -18,7 +18,7 @@ class Genesis implements Plugin.PluginBase {
icon = 'src/en/genesis/icon.png'; icon = 'src/en/genesis/icon.png';
customCSS = 'src/en/genesis/customCSS.css'; customCSS = 'src/en/genesis/customCSS.css';
site = 'https://genesistudio.com'; site = 'https://genesistudio.com';
version = '1.1.1'; version = '1.1.2';
imageRequestInit?: Plugin.ImageRequestInit | undefined = { imageRequestInit?: Plugin.ImageRequestInit | undefined = {
headers: { headers: {
@@ -421,6 +421,7 @@ class Genesis implements Plugin.PluginBase {
// Extract the main novel data from the nodes // Extract the main novel data from the nodes
const data = this.extractData(nodes); const data = this.extractData(nodes);
// Look for chapter container with required fields
const contentKey = 'content'; const contentKey = 'content';
const notesKey = 'notes'; const notesKey = 'notes';
const footnotesKey = 'footnotes'; const footnotesKey = 'footnotes';
@@ -429,7 +430,7 @@ class Genesis implements Plugin.PluginBase {
for (const key in data) { for (const key in data) {
const mapping = data[key]; const mapping = data[key];
// Look for an object with a 'chapters' key // Check container for keys that match the required fields
if ( if (
mapping && mapping &&
typeof mapping === 'object' && typeof mapping === 'object' &&
@@ -437,21 +438,16 @@ class Genesis implements Plugin.PluginBase {
notesKey in mapping && notesKey in mapping &&
footnotesKey in mapping footnotesKey in mapping
) { ) {
// Use the found mapping object to determine the actual keys.
const contentMappingKey = mapping[contentKey];
const notesMappingKey = mapping[notesKey];
const footnotesMappingKey = mapping[footnotesKey];
// Retrieve the chapter's content, notes, and footnotes using the mapping. // Retrieve the chapter's content, notes, and footnotes using the mapping.
// Provide a fallback for content if needed. const content = data[mapping[contentKey]];
const content = data[contentMappingKey] ?? data[19]; const notes = data[mapping[notesKey]];
const notes = data[notesMappingKey]; const footnotes = data[mapping[footnotesKey]];
const footnotes = data[footnotesMappingKey];
// Return the combined parts with appropriate formatting
return ( return (
content + content +
(notes ? `<b>Notes</b><br>${notes}` : '') + (notes ? `<h2>Notes</h2><br>${notes}` : '') +
(footnotes ? `<b>Footnotes</b><br>${footnotes}` : '') (footnotes ?? '')
); );
} }
} }
File diff suppressed because it is too large Load Diff