Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0c7c3dc

Browse files
committed
Add PodcastsController#convert_shownote to partialize in Podcasts
1 parent 7103173 commit 0c7c3dc

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

app/controllers/podcasts_controller.rb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,22 @@ def show
2323

2424
@title = @episode.title.split('-').last.strip
2525
@date = @episode.published_date.strftime("%Y年%-m月%-d日(#{Podcast::WDAY2JAPANESE[@episode.published_date.wday]})")
26-
@content = Kramdown::Document.new(@episode.content, input: 'GFM').to_html
26+
@content = Kramdown::Document.new(
27+
self.convert_shownote(@episode.content),
28+
input: 'GFM').to_html
2729
@url = request.url
2830
end
31+
32+
private
33+
34+
def convert_shownote(content)
35+
shownote = <<~HTML
36+
<h2 id='shownote'>
37+
<a href='#shownote'><i class="fa-solid fa-message-pen" style='color: #2275ca;'></i></a>
38+
Shownote − 話したこと
39+
</h2>
40+
HTML
41+
42+
content.gsub(/(#+) Shownote/i, shownote)
43+
end
2944
end

0 commit comments

Comments
 (0)