@@ -12,16 +12,27 @@ object Synchronize {
12
12
}
13
13
14
14
private def formatChangesForFileExt (changes: List [Change ], fileExt: String ): String = {
15
- val formattedExamples = for {
16
- change <- changes.sortBy(_.example.filename)
17
- filename = change.example.filename
18
- summary <- change.example.summary
19
- url <- change.publishedUrls.get(" gist" ) // TODO - Hardcoded for gist
20
- } yield {
21
- s " - [ $filename]( $url) : $summary"
15
+ def formatChanges (changes : List [Change ]) = {
16
+ for {
17
+ change <- changes.sortBy(_.example.filename)
18
+ filename = change.example.filename
19
+ summary <- change.example.summary
20
+ url <- change.publishedUrls.get(" gist" ) // TODO - Hardcoded for gist
21
+ } yield {
22
+ s " - [ $filename]( $url) : $summary"
23
+ }
22
24
}
23
- val count = formattedExamples.size
24
- val content = formattedExamples.mkString(" \n " )
25
+
26
+ val markdownFormattedLinesForExamples =
27
+ changes.groupBy(_.example.category).toList.sortBy{case (k,_)=> k}.flatMap{
28
+ case (None , changes) =>
29
+ formatChanges(changes)
30
+ case (Some (category), changes) =>
31
+ s " - $category" :: (formatChanges(changes).map(line => s " $line" ))
32
+ }
33
+
34
+ val count = changes.size
35
+ val content = markdownFormattedLinesForExamples.mkString(" \n " )
25
36
val exampleFileType = fileExtToExampleType(fileExt)
26
37
s " ## $count $exampleFileType examples \n $content"
27
38
}
0 commit comments