-
Notifications
You must be signed in to change notification settings - Fork 463
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Save ComicInfo.xml in CBZ Files (Optional) (#6102)
* Add ComicInfo.xml generator and include it in chapters file * The label has been updated to provide clarity for the user * Fix code issues * Remove wrong code
- Loading branch information
Showing
4 changed files
with
40 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
export default class ComicInfoGenerator { | ||
createComicInfoXML(series, title, pagesCount) { | ||
series = this.escapeXML(series); | ||
title = this.escapeXML(title); | ||
return `<?xml version="1.0" encoding="utf-8"?> | ||
<ComicInfo xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<Title>${title}</Title> | ||
<Series>${series}</Series> | ||
<PageCount>${pagesCount}</PageCount> | ||
</ComicInfo>`; | ||
} | ||
|
||
escapeXML(str) { | ||
const symbols = { | ||
'<': '<', | ||
'>': '>', | ||
'&': '&', | ||
'\'': ''', | ||
'"': '"' | ||
}; | ||
|
||
return str.replace(/[<>&'"]/g, function (c) { | ||
return symbols[c]; | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -385,4 +385,4 @@ export default class Settings extends EventTarget { | |
return value; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters