Skip to content

Commit 4ad18c8

Browse files
committed
naming consistency
1 parent 40b1b1a commit 4ad18c8

2 files changed

Lines changed: 15 additions & 15 deletions

File tree

pkg/thread/io.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ func (th *Thread) ToJSON() error {
5656
}
5757

5858
// ToHTML generates and saves an HTML file from a thread using default or provided template and CSS files
59-
func (th *Thread) ToHTML(templateFile string, cssFile string) error {
60-
htmlTemplate, err := loadTemplate(th.Dir, templateFile, cssFile)
59+
func (th *Thread) ToHTML(templateFileName string, cssFileName string) error {
60+
htmlTemplate, err := loadTemplate(th.Dir, templateFileName, cssFileName)
6161
if err != nil {
6262
return fmt.Errorf("failed to load template: %w", err)
6363
}
@@ -102,9 +102,9 @@ func (th *Thread) DownloadAttachments() error {
102102
return nil
103103
}
104104

105-
func loadHTMLTemplateFile(threadDir *Directory, templateFile string) (string, error) {
106-
if templateFile != "" {
107-
return readFile(templateFile)
105+
func loadHTMLTemplateFile(threadDir *Directory, templateFileName string) (string, error) {
106+
if templateFileName != "" {
107+
return readFile(templateFileName)
108108
}
109109

110110
// Try to load default template from file
@@ -115,9 +115,9 @@ func loadHTMLTemplateFile(threadDir *Directory, templateFile string) (string, er
115115
return "", nil
116116
}
117117

118-
func getCSSFile(threadDir *Directory, cssFile string) string {
119-
if cssFile != "" {
120-
return filepath.Clean(cssFile)
118+
func getCSSFilePath(threadDir *Directory, cssFileName string) string {
119+
if cssFileName != "" {
120+
return cssFileName
121121
}
122122

123123
// Try to load default CSS file

pkg/thread/template.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@ func NewTemplateThread(th *Thread) TemplateThread {
3434
for i, tweet := range th.Tweets {
3535
attachments := []TemplateAttachment{}
3636
for _, attachment := range tweet.Attachments {
37-
attachmentFile := attachment.Name(tweet.ID)
37+
attachmentFileName := attachment.Name(tweet.ID)
3838

3939
// Skip attachment if not downloaded
40-
if _, exists := attachmentDir.SubDir(attachmentFile); !exists {
40+
if _, exists := attachmentDir.SubDir(attachmentFileName); !exists {
4141
continue
4242
}
4343

4444
attachments = append(attachments, TemplateAttachment{
45-
Path: attachmentFile,
46-
Ext: filepath.Ext(attachmentFile),
45+
Path: attachmentFileName,
46+
Ext: filepath.Ext(attachmentFileName),
4747
})
4848
}
4949
tweets = append(tweets, TemplateTweet{
@@ -82,8 +82,8 @@ func (a TemplateAttachment) IsVideo() bool {
8282
return valid
8383
}
8484

85-
func loadTemplate(threadDir *Directory, templateFile string, cssFile string) (string, error) {
86-
html, err := loadHTMLTemplateFile(threadDir, templateFile)
85+
func loadTemplate(threadDir *Directory, templateFileName string, cssFileName string) (string, error) {
86+
html, err := loadHTMLTemplateFile(threadDir, templateFileName)
8787
if err != nil {
8888
return "", err
8989
}
@@ -96,7 +96,7 @@ func loadTemplate(threadDir *Directory, templateFile string, cssFile string) (st
9696
return html, nil
9797
}
9898

99-
return fmt.Sprintf(html, getCSSFile(threadDir, cssFile)), nil
99+
return fmt.Sprintf(html, filepath.Clean(getCSSFilePath(threadDir, cssFileName))), nil
100100
}
101101

102102
const defaultTemplate = `

0 commit comments

Comments
 (0)