Skip to content

Commit

Permalink
Merge pull request #44 from iantmoore/no-glossary-no-breakage
Browse files Browse the repository at this point in the history
prevent the reportbuilder failing if no glossary info
  • Loading branch information
iantmoore committed Mar 2, 2017
2 parents 07e7518 + 29732ca commit c4c697a
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions core/src/main/scala/org/substeps/report/ReportBuilder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,22 @@ class ReportBuilder extends IReportBuilder with ReportFrameTemplate with UsageTr
def buildGlossaryData(sourceJsonFile : File) = {
implicit val formats = Serialization.formats(NoTypeHints)

val data = read[List[StepImplDesc]](sourceJsonFile)

val glossaryElements =
data.map(sid => sid.expressions.map(sd => {

val escapedExpression =
sd.expression.replaceAll("\\$$", "").replaceAll("<", "&lt;").replaceAll(">", "&gt;")
if (sourceJsonFile.exists()) {
val data = read[List[StepImplDesc]](sourceJsonFile)

data.map(sid => sid.expressions.map(sd => {

GlossaryElement(sd.section, escapedExpression, sid.className, sd.regex, sd.example, sd.description, sd.parameterNames, sd.parameterClassNames)
})).flatten
val escapedExpression =
sd.expression.replaceAll("\\$$", "").replaceAll("<", "&lt;").replaceAll(">", "&gt;")

GlossaryElement(sd.section, escapedExpression, sid.className, sd.regex, sd.example, sd.description, sd.parameterNames, sd.parameterClassNames)
})).flatten
}
else {
List()
}
glossaryElements
}

Expand Down

0 comments on commit c4c697a

Please sign in to comment.