File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -24,12 +24,13 @@ def show
2424 return redirect_to podcasts_path
2525 end
2626
27+ @youtube = @episode . content . match ( /watch\? v=((\w )*)/ ) [ 1 ]
28+ @url = request . url
2729 @title = @episode . title . split ( '-' ) . last . strip
2830 @date = @episode . published_date . strftime ( "%Y年%-m月%-d日(#{ Podcast ::WDAY2JAPANESE [ @episode . published_date . wday ] } )" )
2931 @content = Kramdown ::Document . new (
3032 self . convert_shownote ( @episode . content ) ,
3133 input : 'GFM' ) . to_html
32- @url = request . url
3334 end
3435
3536 private
@@ -43,6 +44,13 @@ def convert_shownote(content)
4344 </ h2 >
4445 HTML
4546
46- content . gsub ( /(#+) Shownote/i , shownote )
47+ content . gsub! ( /(#+) Shownote/ ) { shownote }
48+ content . gsub! ( /-\s ((\d :)?\d {1,}:\d {2})/ ) do
49+ t = $1
50+ t = ( t . size == '0:00' . size ) ? '0' + t : t
51+ t = ( t . size == '00:00' . size ) ? '00:' + t : t
52+ t = Time . parse ( t ) . seconds_since_midnight . to_i
53+ "- [#{ $1} ](https://youtu.be/#{ @youtube } ?t=#{ t } ) "
54+ end
4755 end
4856end
Original file line number Diff line number Diff line change 2020 }
2121 }
2222 .episode-cover img { margin-bottom : 20px ;}
23+ .episode ul {
24+ padding-left : 0px ;
25+ list-style : none;
26+ }
2327</ style >
2428
2529<%= render 'podcasts/navigation' %>
You can’t perform that action at this time.
0 commit comments