1
0
mirror of https://github.com/dkhamsing/open-source-ios-apps.git synced 2024-12-26 16:32:50 +01:00

[script] display tags update

This commit is contained in:
Daniel Khamsing 2016-09-02 18:39:38 -07:00
parent e5192c11e8
commit dcfb2caf14

View File

@ -32,83 +32,95 @@ end
def output_apps(apps) def output_apps(apps)
o = '' o = ''
apps.each do |a| apps.each do |a|
name = a['title'] name = a['title']
link = a['source'] link = a['source']
itunes = a['itunes'] itunes = a['itunes']
homepage = a['homepage'] homepage = a['homepage']
desc = a['description'] desc = a['description']
tags = a['tags'] tags = a['tags']
stars = a['stars'] stars = a['stars']
lang = a['lang'] lang = a['lang']
date_added = a['date_added'] date_added = a['date_added']
screenshots = a['screenshots'] screenshots = a['screenshots']
license = a['license'] license = a['license']
o << "- #{name}" t = "#{name}"
if desc.nil? if desc.nil?
o << ' ' t << ' '
else else
o << ": #{desc} " if desc.size>0 t << ": #{desc} " if desc.size>0
end
unless itunes.nil?
t << "[` App Store`](#{itunes}) "
end
o << "- #{t} \n"
o << "<details><summary>"
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
end
unless itunes.nil? unless lang.nil?
o << "[` App Store`](#{itunes}) " details << output_flag(lang)
details << ' '
end
unless stars.nil?
details << output_stars(stars)
end
o << details
o << "</summary>"
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 << "<br> #{x}" }
unless screenshots.nil?
details << "\n<div>"
screenshots.each_with_index do |s, i|
details << "<img height='300' alt='#{name} image #{i+1}' src='#{screenshots[i]}'> "
end end
details << "\n</div>"
end
unless tags.nil? details << "\n </details>\n"
o << '`Swift` ' if tags.include? 'swift' o << details
end
unless lang.nil? o << "</details> \n"
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 = " <details><summary>#{link}</summary>\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 << "<br> #{x}" }
unless screenshots.nil?
details << "\n<div>"
screenshots.each_with_index do |s, i|
details << "<img height='300' alt='#{name} image #{i+1}' src='#{screenshots[i]}'> "
end
details << "\n</div>"
end
details << "\n </details>\n"
o << details
end
end end
o o
end end
@ -225,7 +237,6 @@ def write_archive(j)
t = a['title'] t = a['title']
s = a['source'] s = a['source']
output << "- #{t} #{s}\n" output << "- #{t} #{s}\n"
# output <<
end end
output << "\n" output << "\n"