diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2015-02-21 16:16:32 -0800 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2015-02-21 16:18:54 -0800 |
commit | c2f6b4b772f3f52fa04fdc8252afbe73fda61b03 (patch) | |
tree | c9d28084d01781cde7caa7d744cbae7df051d237 /lib | |
parent | Remove old variable. (diff) | |
download | frontend-c2f6b4b772f3f52fa04fdc8252afbe73fda61b03.tar.gz frontend-c2f6b4b772f3f52fa04fdc8252afbe73fda61b03.tar.bz2 frontend-c2f6b4b772f3f52fa04fdc8252afbe73fda61b03.zip |
Also link to MARC.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/helpers.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/helpers.rb b/lib/helpers.rb index 5c3422e..3620d49 100644 --- a/lib/helpers.rb +++ b/lib/helpers.rb @@ -2,6 +2,9 @@ require 'date' require 'rinku' require 'erb' +GMANE_FIND = 'http://news.gmane.org/find-root.php?message_id=' +MARC_FIND = 'https://marc.info/?i=' + helpers do def list_check unless [$config['active_lists'], $config['frozen_lists']].flatten.include?(params[:list]) @@ -68,5 +71,19 @@ helpers do Rinku.auto_link(str, :urls, 'rel="nofollow"') end + def msgid_to_gmane(msgid) + GMANE_FIND + ERB::Util::url_encode(msgid) + end + def msgid_to_marc(msgid) + # We have to transform the msg-id first + # CAK86ViRgefgrb0qUyjQdYa+6C5BTiNvn8UKZwQsMvcJmY-L0mg@mail.gmail.com + # CAK86ViRgefgrb0qUyjQdYa+6C5BTiNvn8UKZwQsMvcJmY-L0mg () mail ! gmail ! com + # http://marc.info/?i=CAK86ViRgefgrb0qUyjQdYa+6C5BTiNvn8UKZwQsMvcJmY-L0mg%20()%20mail%20!%20gmail%20!%20com + # pan.2009.08.28.00.00.38@cox.net + # http://marc.info/?i=pan.2009.08.28.00.00.38%20()%20cox%20!%20net + local, host = msgid.split('@', 2) + new_msgid = local + ' () ' + host.gsub('.',' ! ') + MARC_FIND + ERB::Util::url_encode(new_msgid) + end end |