Skip to content

Commit 4331e80

Browse files
committed
✨ DojoCast ポッドキャストを「最近の CoderDojo」セクションに追加
- news:fetch タスクに DOJO_CAST_FEED を追加(📻絵文字でログ出力) - ポッドキャストエピソードは内部リンクを使用 - タイトルの先頭3桁数字から番号を抽出(033 → 33、001 → 1) - 内部URL: https://coderdojo.jp/podcasts/{番号} - 番号が取得できない場合はエラーを発生 - ニュース表示時にソースごとに絵文字を使い分け - news.coderdojo.jp → 📰 - coderdojo.jp/podcasts → 📻 - prtimes.jp → 📢 - format_news_title ヘルパーメソッドを更新 - テストケースも対応済み
1 parent bd148e6 commit 4331e80

File tree

4 files changed

+327
-160
lines changed

4 files changed

+327
-160
lines changed

app/helpers/application_helper.rb

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,18 @@ def translate_dojo_tag(tag_name)
213213
end
214214

215215
def format_news_title(news)
216-
has_emoji = news.title[0]&.match?(/[\p{Emoji}&&[^0-9#*]]/)
217-
has_emoji ? news.title : "📰 #{news.title}"
216+
has_custom_emoji = news.title[0]&.match?(/[\p{Emoji}&&[^0-9#*]]/)
217+
return news.title if has_custom_emoji
218+
219+
# Add preset Emoji to its prefix if news.title does not have Emoji.
220+
emoji = case news.url
221+
when %r{coderdojo\.jp/podcasts}, %r{spotify\.com/pod/show/coderdojo-japan}
222+
'📻'
223+
when %r{prtimes\.jp}
224+
'📢'
225+
else
226+
'📰'
227+
end
228+
"#{emoji} #{news.title}"
218229
end
219230
end

0 commit comments

Comments
 (0)