File: github_link.rb

package info (click to toggle)
tdiary-contrib 5.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,772 kB
  • sloc: ruby: 17,305; javascript: 8,263; lisp: 562; xml: 451; php: 61; sql: 40; makefile: 18
file content (9 lines) | stat: -rw-r--r-- 262 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
def gh_link(gh_identifier, text=nil)
	text = gh_identifier.split('/').last if text.nil?
	id_and_name, number = gh_identifier.split('#')

	url = "https://github.com/#{id_and_name}"
	url = url + "/issues/#{number}" if number

	"<a href='#{url}'>#{h text}</a>"
end