@@ -19,6 +19,7 @@ let submissionsDirectoryName = "Submission"
1919let template = #"""
2020Name:
2121Status:
22+ ProjectTitle:
2223Technologies:
2324
2425AboutMeUrl:
@@ -29,6 +30,7 @@ VideoUrl:
2930EXAMPLE
3031Name: John Appleseed
3132Status: Submitted <or> Winner <or> Distinguished <or> Rejected
33+ ProjectTitle: The Accessibility Rose
3234Technologies: SwiftUI, RealityKit, CoreGraphic
3335
3436AboutMeUrl: https://linkedin.com/in/johnappleseed
@@ -55,13 +57,14 @@ var validatedTemplates = [(originalFilename: String, newFilename: String, conten
5557for potentialTemplate in potentialTemplates {
5658 let lines = potentialTemplate. content. split ( separator: " \n " )
5759
58- guard lines. count >= 6 else { continue }
60+ guard lines. count >= 7 else { continue }
5961 guard lines [ 0 ] . hasPrefix ( " Name: " ) else { continue }
6062 guard lines [ 1 ] . hasPrefix ( " Status: " ) else { continue }
61- guard lines [ 2 ] . hasPrefix ( " Technologies: " ) else { continue }
62- guard lines [ 3 ] . hasPrefix ( " AboutMeUrl: " ) else { continue }
63- guard lines [ 4 ] . hasPrefix ( " SourceUrl: " ) else { continue }
64- guard lines [ 5 ] . hasPrefix ( " VideoUrl: " ) else { continue }
63+ guard lines [ 2 ] . hasPrefix ( " ProjectTitle: " ) else { continue }
64+ guard lines [ 3 ] . hasPrefix ( " Technologies: " ) else { continue }
65+ guard lines [ 4 ] . hasPrefix ( " AboutMeUrl: " ) else { continue }
66+ guard lines [ 5 ] . hasPrefix ( " SourceUrl: " ) else { continue }
67+ guard lines [ 6 ] . hasPrefix ( " VideoUrl: " ) else { continue }
6568
6669 let newFilename = lines [ 0 ]
6770 . replacingOccurrences ( of: " Name: " , with: " " )
@@ -105,6 +108,7 @@ try? template.write(toFile: "Template.md", atomically: true, encoding: .utf8)
105108struct Submission {
106109 let name : String
107110 let status : Status
111+ let projectTitle : String ?
108112 let technologies : [ String ]
109113
110114 let aboutMeUrl : URL ?
@@ -204,19 +208,24 @@ for submissionFile in submissionFiles {
204208 )
205209 } else { nil }
206210
207- let technologies : [ String ] = if lines [ 2 ] . hasPrefix ( " Technologies: " ) , let value = toValue ( lines [ 2 ] , key: " Technologies: " ) {
211+
212+ let projectTitle : String ? = if lines [ 2 ] . hasPrefix ( " ProjectTitle: " ) {
213+ toValue ( lines [ 2 ] , key: " ProjectTitle: " )
214+ } else { nil }
215+
216+ let technologies : [ String ] = if lines [ 3 ] . hasPrefix ( " Technologies: " ) , let value = toValue ( lines [ 3 ] , key: " Technologies: " ) {
208217 value. split ( separator: " , " ) . map { String ( $0) }
209218 } else { [ ] }
210219
211- let aboutMeUrl : URL ? = if lines [ 3 ] . hasPrefix ( " AboutMeUrl: " ) , let value = toValue ( lines [ 3 ] , key: " AboutMeUrl: " ) , let url = URL ( string: value) , url. isValid {
220+ let aboutMeUrl : URL ? = if lines [ 4 ] . hasPrefix ( " AboutMeUrl: " ) , let value = toValue ( lines [ 4 ] , key: " AboutMeUrl: " ) , let url = URL ( string: value) , url. isValid {
212221 url
213222 } else { nil }
214223
215- let sourceUrl : URL ? = if lines [ 4 ] . hasPrefix ( " SourceUrl: " ) , let value = toValue ( lines [ 4 ] , key: " SourceUrl: " ) , let url = URL ( string: value) , url. isValid {
224+ let sourceUrl : URL ? = if lines [ 5 ] . hasPrefix ( " SourceUrl: " ) , let value = toValue ( lines [ 5 ] , key: " SourceUrl: " ) , let url = URL ( string: value) , url. isValid {
216225 url
217226 } else { nil }
218227
219- let videoUrl : URL ? = if lines [ 5 ] . hasPrefix ( " VideoUrl: " ) , let value = toValue ( lines [ 5 ] , key: " VideoUrl: " ) , let url = URL ( string: value) , url. isValid {
228+ let videoUrl : URL ? = if lines [ 6 ] . hasPrefix ( " VideoUrl: " ) , let value = toValue ( lines [ 6 ] , key: " VideoUrl: " ) , let url = URL ( string: value) , url. isValid {
220229 url
221230 } else { nil }
222231
@@ -225,6 +234,7 @@ for submissionFile in submissionFiles {
225234 . init(
226235 name: name,
227236 status: status ?? . unknown,
237+ projectTitle: projectTitle,
228238 technologies: technologies,
229239 aboutMeUrl: aboutMeUrl,
230240 sourceUrl: sourceUrl,
@@ -233,10 +243,6 @@ for submissionFile in submissionFiles {
233243 )
234244}
235245
236- //AboutMeUrl
237- //SourceUrl
238- //VideoUrl
239-
240246// MARK: - Generate new README.md file from template
241247var readmeFile : String {
242248"""
0 commit comments