Skip to content

Commit

Permalink
refactor(rewrite): remove unused function arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
fguillot committed Dec 13, 2024
1 parent 6ad5ad0 commit c3649bd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions internal/reader/rewrite/rewrite_functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var (
textLinkRegex = regexp.MustCompile(`(?mi)(\bhttps?:\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])`)
)

func addImageTitle(entryURL, entryContent string) string {
func addImageTitle(entryContent string) string {
doc, err := goquery.NewDocumentFromReader(strings.NewReader(entryContent))
if err != nil {
return entryContent
Expand All @@ -51,7 +51,7 @@ func addImageTitle(entryURL, entryContent string) string {
return entryContent
}

func addMailtoSubject(entryURL, entryContent string) string {
func addMailtoSubject(entryContent string) string {
doc, err := goquery.NewDocumentFromReader(strings.NewReader(entryContent))
if err != nil {
return entryContent
Expand Down Expand Up @@ -83,7 +83,7 @@ func addMailtoSubject(entryURL, entryContent string) string {
return entryContent
}

func addDynamicImage(entryURL, entryContent string) string {
func addDynamicImage(entryContent string) string {
doc, err := goquery.NewDocumentFromReader(strings.NewReader(entryContent))
if err != nil {
return entryContent
Expand Down Expand Up @@ -167,7 +167,7 @@ func addDynamicImage(entryURL, entryContent string) string {
return entryContent
}

func addDynamicIframe(entryURL, entryContent string) string {
func addDynamicIframe(entryContent string) string {
doc, err := goquery.NewDocumentFromReader(strings.NewReader(entryContent))
if err != nil {
return entryContent
Expand Down Expand Up @@ -204,7 +204,7 @@ func addDynamicIframe(entryURL, entryContent string) string {
return entryContent
}

func fixMediumImages(entryURL, entryContent string) string {
func fixMediumImages(entryContent string) string {
doc, err := goquery.NewDocumentFromReader(strings.NewReader(entryContent))
if err != nil {
return entryContent
Expand All @@ -221,7 +221,7 @@ func fixMediumImages(entryURL, entryContent string) string {
return output
}

func useNoScriptImages(entryURL, entryContent string) string {
func useNoScriptImages(entryContent string) string {
doc, err := goquery.NewDocumentFromReader(strings.NewReader(entryContent))
if err != nil {
return entryContent
Expand Down
12 changes: 6 additions & 6 deletions internal/reader/rewrite/rewriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ type rule struct {
func (rule rule) applyRule(entryURL string, entry *model.Entry) {
switch rule.name {
case "add_image_title":
entry.Content = addImageTitle(entryURL, entry.Content)
entry.Content = addImageTitle(entry.Content)
case "add_mailto_subject":
entry.Content = addMailtoSubject(entryURL, entry.Content)
entry.Content = addMailtoSubject(entry.Content)
case "add_dynamic_image":
entry.Content = addDynamicImage(entryURL, entry.Content)
entry.Content = addDynamicImage(entry.Content)
case "add_dynamic_iframe":
entry.Content = addDynamicIframe(entryURL, entry.Content)
entry.Content = addDynamicIframe(entry.Content)
case "add_youtube_video":
entry.Content = addYoutubeVideo(entryURL, entry.Content)
case "add_invidious_video":
Expand All @@ -46,9 +46,9 @@ func (rule rule) applyRule(entryURL string, entry *model.Entry) {
case "convert_text_link", "convert_text_links":
entry.Content = replaceTextLinks(entry.Content)
case "fix_medium_images":
entry.Content = fixMediumImages(entryURL, entry.Content)
entry.Content = fixMediumImages(entry.Content)
case "use_noscript_figure_images":
entry.Content = useNoScriptImages(entryURL, entry.Content)
entry.Content = useNoScriptImages(entry.Content)
case "replace":
// Format: replace("search-term"|"replace-term")
if len(rule.args) >= 2 {
Expand Down

0 comments on commit c3649bd

Please sign in to comment.