[script] Update layout (#935)
This commit is contained in:
parent
0dec11c116
commit
81a71eee45
|
@ -8,7 +8,6 @@ ARCHIVE = 'ARCHIVE.md'
|
||||||
APPSTORE = 'APPSTORE.md'
|
APPSTORE = 'APPSTORE.md'
|
||||||
LATEST = 'LATEST.md'
|
LATEST = 'LATEST.md'
|
||||||
|
|
||||||
NOT_ENGLISH = '🌐'
|
|
||||||
ARCHIVE_TAG = 'archive'
|
ARCHIVE_TAG = 'archive'
|
||||||
|
|
||||||
LATEST_NUM = 30
|
LATEST_NUM = 30
|
||||||
|
@ -87,88 +86,87 @@ def output_apps(apps, appstoreonly)
|
||||||
desc = a['description']
|
desc = a['description']
|
||||||
tags = a['tags']
|
tags = a['tags']
|
||||||
stars = a['stars']
|
stars = a['stars']
|
||||||
lang = a['lang']
|
|
||||||
|
|
||||||
date_added = a['date_added']
|
|
||||||
date_updated = a['updated']
|
date_updated = a['updated']
|
||||||
screenshots = a['screenshots']
|
screenshots = a['screenshots']
|
||||||
license = a['license']
|
license = a['license']
|
||||||
|
|
||||||
t = "[#{name}](#{link})"
|
lines = []
|
||||||
|
|
||||||
if desc.nil?
|
line = []
|
||||||
t << ' '
|
line.push "[#{name}](#{link})"
|
||||||
else
|
|
||||||
t << ": #{desc} " if desc.size>0
|
unless desc.nil?
|
||||||
|
line.push ": #{desc}" if desc.size>0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
lines.push line
|
||||||
|
|
||||||
|
line = []
|
||||||
|
unless homepage.nil?
|
||||||
|
line.push "<a href=#{homepage}>`#{homepage}`</a>"
|
||||||
|
end
|
||||||
|
|
||||||
|
lines.push line
|
||||||
|
|
||||||
|
line = []
|
||||||
unless itunes.nil?
|
unless itunes.nil?
|
||||||
t << "[` App Store`](#{itunes}) "
|
line.push "[` App Store`](#{itunes})"
|
||||||
end
|
end
|
||||||
|
|
||||||
if appstoreonly
|
if appstoreonly
|
||||||
next if itunes.nil?
|
next if itunes.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
o << "- #{t} \n"
|
unless screenshots.nil? || screenshots.empty?
|
||||||
o << " <details>\n\t<summary>"
|
screenshots.each_with_index do |s, i|
|
||||||
|
line.push " <a href='#{screenshots[i]}'>`Screenshot #{i+1}`</a> "
|
||||||
details = ""
|
|
||||||
|
|
||||||
unless tags.nil?
|
|
||||||
details << '<code>swift</code> ' if tags.include? 'swift'
|
|
||||||
tags.each do |t|
|
|
||||||
details << "<code>#{t.downcase}</code> " if t.downcase != 'swift'
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
details << "#{NOT_ENGLISH} " unless lang.nil?
|
lines.push line
|
||||||
|
|
||||||
unless stars.nil?
|
line = []
|
||||||
details << output_stars(stars)
|
|
||||||
end
|
|
||||||
|
|
||||||
unless date_updated.nil?
|
unless date_updated.nil?
|
||||||
date = DateTime.parse(date_updated)
|
date = DateTime.parse(date_updated)
|
||||||
formatted_date = date.strftime "%Y"
|
formatted_date = date.strftime "%Y"
|
||||||
details << " <code>#{formatted_date}</code> "
|
line.push " `#{formatted_date}` "
|
||||||
end
|
|
||||||
|
|
||||||
o << details
|
|
||||||
|
|
||||||
o << "</summary>"
|
|
||||||
|
|
||||||
details_list = []
|
|
||||||
unless homepage.nil?
|
|
||||||
details_list.push homepage
|
|
||||||
end
|
|
||||||
|
|
||||||
unless date_added.nil?
|
|
||||||
date = DateTime.parse(date_added)
|
|
||||||
formatted_date = date.strftime "%B %Y"
|
|
||||||
details_list.push "Added: `#{formatted_date}`"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
unless license.nil?
|
unless license.nil?
|
||||||
license_display = license == 'other' ? "`#{license}`" : "[`#{license}`](http://choosealicense.com/licenses/#{license}/)"
|
license_display = license == 'other' ? "" : "[`#{license}`](http://choosealicense.com/licenses/#{license}/)"
|
||||||
details_list.push "License: #{license_display}"
|
line.push << " #{license_display} "
|
||||||
end
|
end
|
||||||
|
|
||||||
details = "\n\n\t"
|
unless tags.nil?
|
||||||
details << details_list[0]
|
line.push '`swift` ' if tags.include? 'swift'
|
||||||
details_list[1..-1].each { |x| details << "<br> #{x}" }
|
tags.each do |t|
|
||||||
|
line.push "`#{t.downcase}` " if t.downcase != 'swift'
|
||||||
unless screenshots.nil? || screenshots.empty?
|
|
||||||
details << "<br>"
|
|
||||||
details << "\n\t"
|
|
||||||
screenshots.each_with_index do |s, i|
|
|
||||||
details << "<a href='#{screenshots[i]}'><code>Screenshot #{i+1}</code></a> "
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
details << "\n "
|
lines.push line
|
||||||
details << "</details>\n\n"
|
|
||||||
o << details
|
line = []
|
||||||
|
unless stars.nil?
|
||||||
|
line.push " ☆`#{stars}` " if stars > 0
|
||||||
|
end
|
||||||
|
|
||||||
|
lines.push line
|
||||||
|
|
||||||
|
lines.each_with_index do |item, i|
|
||||||
|
temp = ''
|
||||||
|
item.each { |x| temp << "#{x}" }
|
||||||
|
unless temp.empty?
|
||||||
|
if i == 0
|
||||||
|
o << "\n- #{temp}"
|
||||||
|
else
|
||||||
|
o << "\n - #{temp}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# o << "\n"
|
||||||
end
|
end
|
||||||
o
|
o
|
||||||
end
|
end
|
||||||
|
@ -188,23 +186,6 @@ def output_badges(count, twitter)
|
||||||
return b
|
return b
|
||||||
end
|
end
|
||||||
|
|
||||||
def output_stars(number)
|
|
||||||
case number
|
|
||||||
when 100...200
|
|
||||||
'⭐'
|
|
||||||
when 200...500
|
|
||||||
'⭐⭐'
|
|
||||||
when 500...1000
|
|
||||||
'⭐⭐⭐'
|
|
||||||
when 1000...2000
|
|
||||||
'⭐⭐⭐⭐'
|
|
||||||
when 2000...100000
|
|
||||||
'⭐⭐⭐⭐⭐'
|
|
||||||
else
|
|
||||||
''
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def write_archive(j, subtitle)
|
def write_archive(j, subtitle)
|
||||||
t = j['title']
|
t = j['title']
|
||||||
apps = j['projects']
|
apps = j['projects']
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"title": "Open-Source iOS Apps",
|
"title": "Open-Source iOS Apps",
|
||||||
"subtitle": "A collaborative list of open-source `iOS`, `iPadOS`, `watchOS` and `tvOS` apps, your [contribution](https://github.com/dkhamsing/open-source-ios-apps/blob/master/.github/CONTRIBUTING.md) is welcome (project [website](https://open-source-ios-apps.netlify.app)) :smile:",
|
"subtitle": "A collaborative list of open-source `iOS`, `iPadOS`, `watchOS` and `tvOS` apps, your [contribution](https://github.com/dkhamsing/open-source-ios-apps/blob/master/.github/CONTRIBUTING.md) is welcome (project [website](https://open-source-ios-apps.netlify.app)) :smile:",
|
||||||
"description": "<!-- \n⚠️ This README is generated, please do not update. To contribute, make changes to contents.json ⚠️ \n https://github.com/dkhamsing/open-source-ios-apps -->",
|
"description": "<!-- \n⚠️ This README is generated, please do not update. To contribute, make changes to contents.json ⚠️ \n https://github.com/dkhamsing/open-source-ios-apps -->",
|
||||||
"header": "```\n 100+ Stars: ⭐\n 200+ Stars: ⭐⭐\n 500+ Stars: ⭐⭐⭐\n1000+ Stars: ⭐⭐⭐⭐\n2000+ Stars: ⭐⭐⭐⭐⭐ \n\n🌐 Project is not in English \n\nClick ► to show more details\n```",
|
"header": "",
|
||||||
"footer": "## Thanks\n\nThis list was inspired by [awesome-ios](https://github.com/vsouza/awesome-ios) and [awesome-swift](https://github.com/matteocrippa/awesome-swift). Thanks to all the [contributors](https://github.com/dkhamsing/open-source-ios-apps/graphs/contributors) 🎉 \n\n## Contact\n\n- [github.com/dkhamsing](https://github.com/dkhamsing)\n- [twitter.com/dkhamsing](https://twitter.com/dkhamsing)\n",
|
"footer": "## Thanks\n\nThis list was inspired by [awesome-ios](https://github.com/vsouza/awesome-ios) and [awesome-swift](https://github.com/matteocrippa/awesome-swift). Thanks to all the [contributors](https://github.com/dkhamsing/open-source-ios-apps/graphs/contributors) 🎉 \n\n## Contact\n\n- [github.com/dkhamsing](https://github.com/dkhamsing)\n- [twitter.com/dkhamsing](https://twitter.com/dkhamsing)\n",
|
||||||
"sponsor": "",
|
"sponsor": "",
|
||||||
"categories": [
|
"categories": [
|
||||||
|
|
Loading…
Reference in New Issue