diff --git a/.github/osia_convert.rb b/.github/osia_convert.rb index afca6c89..7a3d5048 100644 --- a/.github/osia_convert.rb +++ b/.github/osia_convert.rb @@ -32,83 +32,95 @@ end def output_apps(apps) o = '' apps.each do |a| - name = a['title'] - link = a['source'] - itunes = a['itunes'] - homepage = a['homepage'] - desc = a['description'] - tags = a['tags'] - stars = a['stars'] - lang = a['lang'] + name = a['title'] + link = a['source'] + itunes = a['itunes'] + homepage = a['homepage'] + desc = a['description'] + tags = a['tags'] + stars = a['stars'] + lang = a['lang'] - date_added = a['date_added'] - screenshots = a['screenshots'] - license = a['license'] + date_added = a['date_added'] + screenshots = a['screenshots'] + license = a['license'] - o << "- #{name}" + t = "#{name}" - if desc.nil? - o << ' ' - else - o << ": #{desc} " if desc.size>0 + if desc.nil? + t << ' ' + else + t << ": #{desc} " if desc.size>0 + end + + unless itunes.nil? + t << "[` App Store`](#{itunes}) " + end + o << "- #{t} \n" + + o << "
" + + details = if tags.nil? + '`objc` ' + else + '' + end + + unless tags.nil? + details << '`swift` ' if tags.include? 'swift' + + tags.each do |t| + details << "`#{t.downcase}` " if t.downcase!='swift' end + end - unless itunes.nil? - o << "[` App Store`](#{itunes}) " + unless lang.nil? + details << output_flag(lang) + details << ' ' + end + + unless stars.nil? + details << output_stars(stars) + end + o << details + + o << "" + + details_list = [] + + details_list.push link + + unless homepage.nil? + details_list.push homepage + end + + unless date_added.nil? + date = DateTime.parse(date_added) + formatted_date = date.strftime "%B %e, %Y" + details_list.push "Added #{formatted_date}" + end + + unless license.nil? + license_display = license=='other'? "`#{license}`" : "[`#{license}`](http://choosealicense.com/licenses/#{license}/)" + details_list.push "License: #{license_display}" + end + + details = ' ' + details << details_list[0] + details_list[1..-1].each { |x| details << "
#{x}" } + + unless screenshots.nil? + details << "\n
" + screenshots.each_with_index do |s, i| + details << "#{name} image #{i+1} " end + details << "\n
" + end - unless tags.nil? - o << '`Swift` ' if tags.include? 'swift' - end + details << "\n
\n" + o << details - unless lang.nil? - o << output_flag(lang) - end - - unless stars.nil? - o << output_stars(stars) - end - - o << "\n" - - show_details = !homepage.nil? || !screenshots.nil? || !license.nil? || !date_added.nil? - - if (!show_details) - o << " - #{link}\n" - else - details = "
#{link}\n" - - details_list = [] - unless date_added.nil? - date = DateTime.parse(date_added) - formatted_date = date.strftime "%B %e, %Y" - details_list.push "Added #{formatted_date}" - end - - unless license.nil? - license_display = license=='other'? "`#{license}`" : "[`#{license}`](http://choosealicense.com/licenses/#{license}/)" - details_list.push "License: #{license_display}" - end - - unless homepage.nil? - details_list.push homepage - end - - details << ' ' - details << details_list[0] - details_list[1..-1].each { |x| details << "
#{x}" } - - unless screenshots.nil? - details << "\n
" - screenshots.each_with_index do |s, i| - details << "#{name} image #{i+1} " - end - details << "\n
" - end - - details << "\n
\n" - o << details - end + o << " \n" end o end @@ -225,7 +237,6 @@ def write_archive(j) t = a['title'] s = a['source'] output << "- #{t} #{s}\n" - # output << end output << "\n"