@@ -96,6 +96,30 @@ export class TimeblockCalendarSyncService {
9696 return lines . length > 0 ? lines . join ( "\n" ) : undefined ;
9797 }
9898
99+ /**
100+ * Apply the shared Google Calendar event title template to a timeblock.
101+ * Supports task placeholders for compatibility and adds timeblock-specific fields.
102+ */
103+ private applyTitleTemplate ( timeblock : TimeBlock , date : string ) : string {
104+ const settings = this . plugin . settings . googleCalendarExport ;
105+ const template =
106+ settings . timeblockEventTitleTemplate || settings . eventTitleTemplate || "{{title}}" ;
107+ const fallbackTitle = timeblock . title || "Timeblock" ;
108+
109+ const rendered = template
110+ . replace ( / \{ \{ t i t l e \} \} / g, fallbackTitle )
111+ . replace ( / \{ \{ s t a t u s \} \} / g, "" )
112+ . replace ( / \{ \{ p r i o r i t y \} \} / g, "" )
113+ . replace ( / \{ \{ d u e \} \} / g, "" )
114+ . replace ( / \{ \{ s c h e d u l e d \} \} / g, "" )
115+ . replace ( / \{ \{ d a t e \} \} / g, date )
116+ . replace ( / \{ \{ s t a r t T i m e \} \} / g, timeblock . startTime || "" )
117+ . replace ( / \{ \{ e n d T i m e \} \} / g, timeblock . endTime || "" )
118+ . trim ( ) ;
119+
120+ return rendered || fallbackTitle ;
121+ }
122+
99123 private toCalendarEvent ( timeblock : TimeBlock , date : string ) : {
100124 summary : string ;
101125 description ?: string ;
@@ -114,7 +138,7 @@ export class TimeblockCalendarSyncService {
114138 end : { dateTime : string ; timeZone : string } ;
115139 colorId ?: string ;
116140 } = {
117- summary : timeblock . title || "Timeblock" ,
141+ summary : this . applyTitleTemplate ( timeblock , date ) ,
118142 start : { dateTime : startDateTime , timeZone : timezone } ,
119143 end : { dateTime : endDateTime , timeZone : timezone } ,
120144 } ;
0 commit comments