JAL-3989 add in issue shortcodes to the archive version page changes list
authorBen Soares <bsoares@dundee.ac.uk>
Thu, 28 Apr 2022 13:47:55 +0000 (14:47 +0100)
committerBen Soares <bsoares@dundee.ac.uk>
Thu, 28 Apr 2022 13:47:55 +0000 (14:47 +0100)
build.gradle

index b0d0fbb..79fb2d9 100644 (file)
@@ -2476,52 +2476,39 @@ task hugoTemplates {
             summary += (patchReleaseString != null) ? " is the ${patchReleaseString} release in the ${JALVIEW_VERSION.substring(0,lastDotIndex)} series." : ""
           }
 
             summary += (patchReleaseString != null) ? " is the ${patchReleaseString} release in the ${JALVIEW_VERSION.substring(0,lastDotIndex)} series." : ""
           }
 
-          if (headings[1] != null && headings[1].size() > 0) {
-            def noheadings = true
-            releaseCells[1].children().each { e ->
-              if (e.tagName().toLowerCase() == "ul") {
-                e.select("li").each { li ->
-                  def mdItem = "- "
-                  li.childNodes().any {n ->
-                    if (n.nodeName().equals("#comment")) {
-                      mdItem += "${n} "
-                      return true
+          [1,2].each { col ->
+            if (headings[col] != null && headings[col].size() > 0) {
+              def noheadings = true
+              releaseCells[col].children().each { e ->
+                if (e.tagName().toLowerCase() == "ul") {
+                  e.select("li").each { li ->
+                    def issues = []
+                    def mdItem = "- "
+                    li.childNodes().any {n ->
+                      if (n.nodeName().equals("#comment")) {
+                        mdItem += "${n} "
+                        issues = n.getData().trim().split(/[,\s]+/)
+                        return true
+                      }
                     }
                     }
-                  }
-                  mdItem += li.text()
-                  if (noheadings) {
-                    changes += "\n### ${headings[1]}\n\n"
-                    noheadings = false
-                  }
-                  changes += "${mdItem}\n"
-                }
-              } else if (e.tag() == "em") {
-                changes += "\n#### ${e.text()}\n\n"
-                noheadings = false
-              }
-            }
-          }
-
-          if (headings[2] != null && headings[2].size() > 0) {
-            changes += "\n### ${headings[2]}\n\n"
-            releaseCells[2].children().each { e ->
-              if (e.tagName().toLowerCase() == "ul") {
-                e.select("li").each { li ->
-                  def mdItem = "- "
-                  li.childNodes().any {n ->
-                    if (n.nodeName().equals("#comment")) {
-                      mdItem += "${n} "
-                      return true
+                    mdItem += li.text()
+                    issues.each { jal ->
+                      mdItem += " {{< jal issue=\"${jal}\" >}}"
                     }
                     }
+                    if (noheadings) {
+                      changes += "\n### ${headings[1]}\n\n"
+                      noheadings = false
+                    }
+                    changes += "${mdItem}\n"
                   }
                   }
-                  mdItem += li.text()
-                  changes += "${mdItem}\n"
+                } else if (e.tag() == "em") {
+                  changes += "\n#### ${e.text()}\n\n"
+                  noheadings = false
                 }
                 }
-              } else if (e.tagName().toLowerCase() == "em") {
-                changes += "\n#### ${e.text()}\n\n"
               }
             }
           }
               }
             }
           }
+
         }
       }
     }
         }
       }
     }