New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OSS Gate Workshop: Online: 2023-09-30: hirano-vm4: rails_autolink: Work log #1676
Comments
作業ログつくってみました〜😊 |
tenderlove/rails_autolink: The auto_link function from Rails今回はこちらを対象にしたいと思います〜 |
まずはライセンスを確認 rails_autolink/LICENSE at master · tenderlove/rails_autolinkここを確認して |
|
ここからインストールして実際に使ってみる作業に入ります〜 |
余談ですががRails バージョン 3.1 までrails_autolinkは公式に使えたんですね〜 |
確かにあった気がしますね〜 |
Synopsisこのあらすじの部分、コードをみたら解釈できなくはないですが、文章として説明があったほうがより親切かな? 少し読み手のリソースが取られる感じがしました〜 |
公式ドキュメントの手順通りの方法でインストールは問題なくできた🧐 |
日本語のフォントに対応していないだけではなさそう? |
スペースがないと最初のURLがどこで終わりなのかを判断するのが不可能なので難しいかもです。 |
英語だと基本スペースが入るので日本語のように繋げて使うのは考慮されていないのかもしれませんね〜。全角も日本独自なので当然考慮には入っていない🤔 |
コードの実行例ごとに、どういう例なのかという説明があったら確かにわかりやすいかもですね。 |
@komagata ありがとうございます!簡単に一文添えるだけでもかなり親切だと思うのでその方向で考えてみます〜 |
修正案1
※ただ日本語でだけ発生する問題だと思われるのでかなり限定的 修正案2
この2つが今回使ってみて感じたことです。需要的にも後者をissueとしてあげる予定です! |
|
提案素晴らしいgemを提供してくれてありがとうございます。 プログラミングのビギナーの人にもより、このgemのメリットを短時間で理解してもらうために、Synopsisをより充実させたいです。 現状だとコードと実行結果のみが記載されています。それに加えて、短時間でrails_autolinkの機能が理解できるシンプルな説明文を加えたいです。 現在のSynopsisrequire 'rails_autolink'
auto_link("Go to http://www.rubyonrails.org and say hello to david@loudthinking.com")
# => "Go to <a href=\"http://www.rubyonrails.org\">http://www.rubyonrails.org</a> and
# say hello to <a href=\"mailto:david@loudthinking.com\">david@loudthinking.com</a>"
auto_link("Visit http://www.loudthinking.com/ or e-mail david@loudthinking.com", :link => :urls)
# => "Visit <a href=\"http://www.loudthinking.com/\">http://www.loudthinking.com/</a>
# or e-mail david@loudthinking.com"
auto_link("Visit http://www.loudthinking.com/ or e-mail david@loudthinking.com", :link => :email_addresses)
# => "Visit http://www.loudthinking.com/ or e-mail <a href=\"mailto:david@loudthinking.com\">david@loudthinking.com</a>"
auto_link("Go to http://www.rubyonrails.org <script>Malicious code!</script>")
# => "Go to <a href=\"http://www.rubyonrails.org\">http://www.rubyonrails.org</a> "
auto_link("Go to http://www.rubyonrails.org <script>alert('Script!')</script>", :sanitize => false)
# => "Go to <a href=\"http://www.rubyonrails.org\">http://www.rubyonrails.org</a> <script>alert('Script!')</script>"
post_body = "Welcome to my new blog at http://www.myblog.com/. Please e-mail me at me@email.com."
auto_link(post_body, :html => { :target => '_blank' }) do |text|
truncate(text, :length => 15)
end
# => "Welcome to my new blog at <a href=\"http://www.myblog.com/\" target=\"_blank\">http://www.m...</a>. Synopsisの改善案require 'rails_autolink'
# 1. URLとメールアドレスのリンクを生成する基本的な使い方
auto_link("Go to http://www.rubyonrails.org and say hello to david@loudthinking.com")
# => "Go to <a href=\"http://www.rubyonrails.org\">http://www.rubyonrails.org</a> and
# say hello to <a href=\"mailto:david@loudthinking.com\">david@loudthinking.com</a>"
# 2. URLのみをリンクに変換する
auto_link("Visit http://www.loudthinking.com/ or e-mail david@loudthinking.com", :link => :urls)
# => "Visit <a href=\"http://www.loudthinking.com/\">http://www.loudthinking.com/</a>
# or e-mail david@loudthinking.com"
# 3. メールアドレスのみをリンクに変換する
auto_link("Visit http://www.loudthinking.com/ or e-mail david@loudthinking.com", :link => :email_addresses)
# => "Visit http://www.loudthinking.com/ or e-mail <a href=\"mailto:david@loudthinking.com\">david@loudthinking.com</a>"
# 4. HTMLタグをサニタイズせずにリンクを生成する
## デフォルトではHTMLタグをサニタイズして、悪意のあるコードから保護
auto_link("Go to http://www.rubyonrails.org <script>Malicious code!</script>")
# => "Go to <a href=\"http://www.rubyonrails.org\">http://www.rubyonrails.org</a> "
## :sanitize => falseをオプションにつけることでサニタイズさせない
auto_link("Go to http://www.rubyonrails.org <script>alert('Script!')</script>", :sanitize => false)
# => "Go to <a href=\"http://www.rubyonrails.org\">http://www.rubyonrails.org</a> <script>alert('Script!')</script>"
# 5. リンクのカスタマイズとテキストの短縮
post_body = "Welcome to my new blog at http://www.myblog.com/. Please e-mail me at me@email.com."
auto_link(post_body, :html => { :target => '_blank' }) do |text|
truncate(text, :length => 15)
end
# => "Welcome to my new blog at <a href=\"http://www.myblog.com/\" target=\"_blank\">http://www.m...</a>. |
ひとまず自分なりに改善案を日本語で書いてみました🧐 |
@komagata さん たしかにその方が目立って読みやすいですね!修正してみます🙏 |
提案素晴らしいgemを提供していただきありがとうございます。 プログラミングのビギナーの人にも、このgemのメリットを簡単に理解してもらうために、Synopsisをより充実させたいです。 現状だとコードと実行結果のみが記載されています。それに加えて、短時間でrails_autolinkの機能が理解できるシンプルな説明文を加えたいです。 現在のSynopsisrequire 'rails_autolink'
auto_link("Go to http://www.rubyonrails.org and say hello to david@loudthinking.com")
# => "Go to <a href=\"http://www.rubyonrails.org\">http://www.rubyonrails.org</a> and
# say hello to <a href=\"mailto:david@loudthinking.com\">david@loudthinking.com</a>"
auto_link("Visit http://www.loudthinking.com/ or e-mail david@loudthinking.com", :link => :urls)
# => "Visit <a href=\"http://www.loudthinking.com/\">http://www.loudthinking.com/</a>
# or e-mail david@loudthinking.com"
auto_link("Visit http://www.loudthinking.com/ or e-mail david@loudthinking.com", :link => :email_addresses)
# => "Visit http://www.loudthinking.com/ or e-mail <a href=\"mailto:david@loudthinking.com\">david@loudthinking.com</a>"
auto_link("Go to http://www.rubyonrails.org <script>Malicious code!</script>")
# => "Go to <a href=\"http://www.rubyonrails.org\">http://www.rubyonrails.org</a> "
auto_link("Go to http://www.rubyonrails.org <script>alert('Script!')</script>", :sanitize => false)
# => "Go to <a href=\"http://www.rubyonrails.org\">http://www.rubyonrails.org</a> <script>alert('Script!')</script>"
post_body = "Welcome to my new blog at http://www.myblog.com/. Please e-mail me at me@email.com."
auto_link(post_body, :html => { :target => '_blank' }) do |text|
truncate(text, :length => 15)
end
# => "Welcome to my new blog at <a href=\"http://www.myblog.com/\" target=\"_blank\">http://www.m...</a>. Synopsisの改善案基本的な使い方require 'rails_autolink'
auto_link("Go to http://www.rubyonrails.org and say hello to david@loudthinking.com")
# => "Go to <a href=\"http://www.rubyonrails.org\">http://www.rubyonrails.org</a> and
# say hello to <a href=\"mailto:david@loudthinking.com\">david@loudthinking.com</a>" URLのみをリンクに変換するauto_link("Visit http://www.loudthinking.com/ or e-mail david@loudthinking.com", :link => :urls)
# => "Visit <a href=\"http://www.loudthinking.com/\">http://www.loudthinking.com/</a>
# or e-mail david@loudthinking.com" メールアドレスのみをリンクに変換するauto_link("Visit http://www.loudthinking.com/ or e-mail david@loudthinking.com", :link => :email_addresses)
# => "Visit http://www.loudthinking.com/ or e-mail <a href=\"mailto:david@loudthinking.com\">david@loudthinking.com</a>" HTMLタグをサニタイズせずにリンクを生成する## デフォルトではHTMLタグをサニタイズして、悪意のあるコードから保護
auto_link("Go to http://www.rubyonrails.org <script>Malicious code!</script>")
# => "Go to <a href=\"http://www.rubyonrails.org\">http://www.rubyonrails.org</a> "
## :sanitize => falseをオプションにつけることでサニタイズさせない
auto_link("Go to http://www.rubyonrails.org <script>alert('Script!')</script>", :sanitize => false)
# => "Go to <a href=\"http://www.rubyonrails.org\">http://www.rubyonrails.org</a> <script>alert('Script!')</script>" リンクのカスタマイズとテキストの短縮post_body = "Welcome to my new blog at http://www.myblog.com/. Please e-mail me at me@email.com."
auto_link(post_body, :html => { :target => '_blank' }) do |text|
truncate(text, :length => 15)
end
# => "Welcome to my new blog at <a href=\"http://www.myblog.com/\" target=\"_blank\">http://www.m...</a>. |
特に数字の並びに意味がなければ見出しの数字はなくても良いかも?と思いました〜 |
@komagata さん 特に意図はなかったので削除します!確かに序列があるものではないですね🧐 |
@komagata さん |
これは下記だけでも良いかな〜と少し思いました〜。 基本的な使い方 |
こういうREADMEでは大体、典型的な使い方が一番最初に来るのが定番なので、みる人もそれを想定してる人が多いかもで、その他がオプションありというか、発展的な使い方だというのがわかりやすいかなと思いました。 |
なるほど!たしかに、そのような並びが多くみますし、自分自身がREADMEを読む時は、その前提で見ている気がします👀こちらもアドバイスを反映させました! |
良い感じだと思います〜!あとはこれを英語にする感じでOKだと思います。 |
ありがとうございます!英語に翻訳してみます! |
ProposalThank you for providing this fantastic gem. To make it easier for programming beginners to understand the benefits of this gem, I would like to enhance the Synopsis. Currently, it only includes code and execution results. In addition to that, I would like to add a simple explanation that allows users to grasp the functionality of rails_autolink quickly. Current Synopsisrequire 'rails_autolink'
auto_link("Go to http://www.rubyonrails.org and say hello to david@loudthinking.com")
# => "Go to <a href=\"http://www.rubyonrails.org\">http://www.rubyonrails.org</a> and
# say hello to <a href=\"mailto:david@loudthinking.com\">david@loudthinking.com</a>"
auto_link("Visit http://www.loudthinking.com/ or e-mail david@loudthinking.com", :link => :urls)
# => "Visit <a href=\"http://www.loudthinking.com/\">http://www.loudthinking.com/</a>
# or e-mail david@loudthinking.com"
auto_link("Visit http://www.loudthinking.com/ or e-mail david@loudthinking.com", :link => :email_addresses)
# => "Visit http://www.loudthinking.com/ or e-mail <a href=\"mailto:david@loudthinking.com\">david@loudthinking.com</a>"
auto_link("Go to http://www.rubyonrails.org <script>Malicious code!</script>")
# => "Go to <a href=\"http://www.rubyonrails.org\">http://www.rubyonrails.org</a> "
auto_link("Go to http://www.rubyonrails.org <script>alert('Script!')</script>", :sanitize => false)
# => "Go to <a href=\"http://www.rubyonrails.org\">http://www.rubyonrails.org</a> <script>alert('Script!')</script>"
post_body = "Welcome to my new blog at http://www.myblog.com/. Please e-mail me at me@email.com."
auto_link(post_body, :html => { :target => '_blank' }) do |text|
truncate(text, :length => 15)
end
# => "Welcome to my new blog at <a href=\"http://www.myblog.com/\" target=\"_blank\">http://www.m...</a>. Proposed SynopsisBasic Usagerequire 'rails_autolink'
auto_link("Go to http://www.rubyonrails.org and say hello to david@loudthinking.com")
# => "Go to <a href=\"http://www.rubyonrails.org\">http://www.rubyonrails.org</a> and
# say hello to <a href=\"mailto:david@loudthinking.com\">david@loudthinking.com</a>" Convert Only URLs to Linksauto_link("Visit http://www.loudthinking.com/ or e-mail david@loudthinking.com", :link => :urls)
# => "Visit <a href=\"http://www.loudthinking.com/\">http://www.loudthinking.com/</a>
# or e-mail david@loudthinking.com" Convert Only Email Addresses to Linksauto_link("Visit http://www.loudthinking.com/ or e-mail david@loudthinking.com", :link => :email_addresses)
# => "Visit http://www.loudthinking.com/ or e-mail <a href=\"mailto:david@loudthinking.com\">david@loudthinking.com</a>" Generate Links Without Sanitizing HTML Tags## By default, HTML tags are sanitized to protect from malicious code
auto_link("Go to http://www.rubyonrails.org <script>Malicious code!</script>")
# => "Go to <a href=\"http://www.rubyonrails.org\">http://www.rubyonrails.org</a> "
## Use the :sanitize => false option to prevent sanitization
auto_link("Go to http://www.rubyonrails.org <script>alert('Script!')</script>", :sanitize => false)
# => "Go to <a href=\"http://www.rubyonrails.org\">http://www.rubyonrails.org</a> <script>alert('Script!')</script>" Customize Links and Shorten Textpost_body = "Welcome to my new blog at http://www.myblog.com/. Please e-mail me at me@email.com."
auto_link(post_body, :html => { :target => '_blank' }) do |text|
truncate(text, :length => 15)
end
# => "Welcome to my new blog at <a href=\"http://www.myblog.com/\" target=\"_blank\">http://www.m...</a>. |
翻訳してみました〜😊 |
僕も英語自信ないのですが、
は
の方がいいように思いました。(他のonlyを使った文も) |
@komagata さん |
とってもいい感じになっていると思います〜! |
ありがとうございます!助言のおかげて良き感じになりました🙏 |
@komagata さんに助言をいただきREADME.mdの更新であること、差分があるほうがわかりやすいということでissueとPR両方に提出しました〜! issuePR |
PRはミスをみつけたので修正中です〜 |
PRまで完了しました〜🙏 |
PR良い感じだと思います! この続きでわからないことがあったらお気軽に聞いてくださいね〜 |
1日ありがとうございました🙏勉強になりました!引き続きよろしくお願いします!わからないことがあれば相談させてもらいます〜 |
おつかれさまでした! ワークショップの終了にともないissueを閉じますが、このまま作業メモとして使っても構いません 👌 ワークショップの感想を集めています! ブログなどに書かれた際は、このページへリンクの追加をお願いします 🙏 またの参加をお待ちしています! |
@hirano-vm4 こちらのPR、2週間以上経っているのでメインのコントリビューターにメンションで「こちらいかがでしょうか?」的なコメントを送って催促してみてもいいかもですね〜 |
@komagata さん Q.メインのコントリビューターの確認方法リポジトリ所有者=メインのコントリビューターという認識は違うような気がしています🧐 InsightのContributorsは開いてみましたが、メインのコントリビューターの判断する方法はありますでしょうか? 最近だとramhojさんという人が活動しているように見受けられます! |
そうですね!そのとおりだと思います!
たぶん、すでに確認していると思いますが、最近のコミットを見るというのがあります。 コミットしたりマージしたりしている人がメインのコントリビューターである可能性は高いです。ただ、「メインのコントリビューター」でなくても、誰かしらメンテンナスしている人に見てもらえれば十分なので、「これどうっすかー?」というときは、最近アクティブなコントリビューター数人にメンションくらいで大丈夫です。(必ずしも「メインのコントリビューター」でなくてもいい。) このケースだと私ならramhojさんとamatsudaさんにメンションします。 |
@kou さん ご回答いただき、ありがとうございます!勉強になりました🙏 助言をもとにメンションしてみたいと思います!また動きがありましたらご報告いたします! |
@kou さん アドバイスいただきありがとうございました🙏無事にマージされました!勉強になりました〜 |
よかったです! |
kouさんのおっしゃる通りな感じです〜! |
This is a work log of a "OSS Gate workshop".
"OSS Gate workshop" is an activity to increase OSS developers.
Here's been discussed in Japanese. Thanks.
作業ログ作成時の説明
以下のテンプレートを埋めてタイトルに設定します。埋め方例はスクロールすると見えてきます。
タイトル例↓:
OSS Gateワークショップ関連情報
The text was updated successfully, but these errors were encountered: