✨ feature: Enhance output options with Google Sheets integration and improve Excel writer functionality
This commit is contained in:
+13
-1
@@ -35,6 +35,18 @@ function issueDate(date: string): string {
|
||||
return new Date(date).toISOString().slice(0, 10);
|
||||
}
|
||||
|
||||
function sponsorDescription(linkTitle: string, description: string): string {
|
||||
return description
|
||||
.replace(/\b(?:sponsor|sponsored|advertisement|partner)\b/i, '')
|
||||
.replace(new RegExp(`^\\s*${escapeRegExp(linkTitle)}\\s*(?:[-:–—]|\\s)+`, 'i'), '')
|
||||
.replace(/\s+/g, ' ')
|
||||
.trim();
|
||||
}
|
||||
|
||||
function escapeRegExp(value: string): string {
|
||||
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
}
|
||||
|
||||
export async function runCatalog(options: RunOptions): Promise<RunSummary> {
|
||||
const config = normalizeConfig(options.config);
|
||||
const state = new StateStore(config.stateFile);
|
||||
@@ -76,7 +88,7 @@ export async function runCatalog(options: RunOptions): Promise<RunSummary> {
|
||||
Newsletter: newsletterName(message.from),
|
||||
Sponsor: link.title,
|
||||
Link: link.normalizedUrl,
|
||||
Description: link.description ?? ''
|
||||
Description: sponsorDescription(link.title, link.description ?? '')
|
||||
});
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user