We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7c981bb commit 0de2189Copy full SHA for 0de2189
app/controllers/podcasts_controller.rb
@@ -45,7 +45,9 @@ def convert_shownote(content)
45
HTML
46
47
content.gsub!(/(#+) Shownote/) { shownote }
48
- content.gsub!(/-\s((\d:)?\d{1,}:\d{2})/) do
+ return content unless content.match?(Podcast::TIMESTAMP_REGEX)
49
+
50
+ content.gsub!(Podcast::TIMESTAMP_REGEX) do
51
t = $1
52
t = (t.size == '0:00'.size) ? '0' + t : t
53
t = (t.size == '00:00'.size) ? '00:' + t : t
app/models/podcast.rb
@@ -2,6 +2,7 @@ class Podcast < ApplicationRecord
2
self.table_name = 'podcasts'
3
DIR_PATH = 'public/podcasts'
4
WDAY2JAPANESE = %w(日 月 火 水 木 金 土)
5
+ TIMESTAMP_REGEX = /-\s((\d:)?\d{1,}:\d{2})/
6
7
validates :title, presence: true
8
validates :content_size, presence: true
0 commit comments