Sha256: 0c18131a90b194e32c3c3494aefb2751c8627e4829bd866582461a95fa45b6d7
Contents?: true
Size: 935 Bytes
Versions: 39
Compression:
Stored size: 935 Bytes
Contents
# theme_online.rb: choice theme from online repository on tDiary.org # # options: # @options['theme_online.url']: top level URL of another theme site # # Copyright (C) 2014 by TADA Tadashi <t@tdtds.jp> # You can distribute and/or modify it under GPL2 or any later version. # require 'json' require 'open-uri' def theme_list_online(list) url = @options['theme_online.url'] || '//tdiary.github.io/tdiary-theme/' url = "http:#{url}" if url =~ %r|\A//| begin online_list = JSON.load(open(File.join(url, 'themes.json'), &:read))['themes'] list + online_list.keys.map do |t| title = online_list[t]['title'] label = t == title ? '' : " (#{title})" ["online/#{t}", "#{t}#{label}"] end rescue @logger.error "could not get theme list from online: #$!" list end end def theme_url_online(theme) url = @options['theme_online.url'] || '//tdiary.github.io/tdiary-theme/' File.join(url, "#{h theme}/#{h theme}.css") end
Version data entries
39 entries across 29 versions & 1 rubygems