txt: trim punctuations in parsed author names (#1707)
* txt: trim punctuations in parsed author names * release: version 0.9.68
This commit is contained in:
@@ -1,5 +1,16 @@
|
||||
{
|
||||
"releases": {
|
||||
"0.9.68": {
|
||||
"date": "2025-07-30",
|
||||
"notes": [
|
||||
"Reader: Files now open in a new window by default on Desktop",
|
||||
"Translation: Skips translating content inside <pre>, <code>, and <math> tags",
|
||||
"Performance: Improved multi-part downloading for large books",
|
||||
"Sync: Resolved issue preventing some PDF files from syncing",
|
||||
"CSS: Resolved issue with fixed font color in some EPUB files",
|
||||
"TXT: Enhanced TXT parsing for better compatibility"
|
||||
]
|
||||
},
|
||||
"0.9.67": {
|
||||
"date": "2025-07-22",
|
||||
"notes": [
|
||||
|
||||
@@ -66,12 +66,7 @@ const BookItem: React.FC<BookItemProps> = ({
|
||||
mode === 'list' && 'min-w-20',
|
||||
)}
|
||||
>
|
||||
<BookCover
|
||||
mode={mode}
|
||||
book={book}
|
||||
coverFit={coverFit}
|
||||
showSpine={book.format !== 'PDF' || !!book.metadata?.publisher}
|
||||
/>
|
||||
<BookCover mode={mode} book={book} coverFit={coverFit} showSpine={false} />
|
||||
{bookSelected && (
|
||||
<div className='absolute inset-0 bg-black opacity-30 transition-opacity duration-300'></div>
|
||||
)}
|
||||
|
||||
@@ -62,7 +62,11 @@ export class TxtToEpubConverter {
|
||||
const authorMatch =
|
||||
fileHeader.match(/[【\[]?作者[】\]]?[::\s]\s*(.+)\r?\n/) ||
|
||||
fileHeader.match(/[【\[]?\s*(.+)\s+著\s*[】\]]?\r?\n/);
|
||||
const author = authorMatch ? authorMatch[1]!.trim() : providedAuthor || '';
|
||||
let matchedAuthor = authorMatch ? authorMatch[1]!.trim() : providedAuthor || '';
|
||||
try {
|
||||
matchedAuthor = matchedAuthor.replace(/^[\p{P}\p{S}]+|[\p{P}\p{S}]+$/gu, '');
|
||||
} catch {}
|
||||
const author = matchedAuthor || providedAuthor || '';
|
||||
const language = providedLanguage || this.detectLanguage(fileHeader);
|
||||
const identifier = await partialMD5(txtFile);
|
||||
const metadata = { bookTitle, author, language, identifier };
|
||||
|
||||
Reference in New Issue
Block a user