Skip to content

Commit

Permalink
chore : improve output html template readability
Browse files Browse the repository at this point in the history
  • Loading branch information
fhebuterne committed Feb 25, 2021
1 parent 889dfd1 commit 26528a1
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
build/
out/
tmp/
/mcscankt-results
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {

allprojects {
group = "fr.fabienhebuterne"
version = "1.0.0"
version = "1.0.1"

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ abstract class ItemBase {
return getColoredText(it, div)
} ?: run {
if (firstColor != null) {
getColoredText(firstColor, div)
return getColoredText(firstColor, div)
}

return div.span {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,17 @@ class OutputHtmlService(private val countItemService: CountItemService) : Output
override fun showResults() {
logger.info { "start parsing item into html" }

val inputStream: InputStream = javaClass.classLoader?.getResource("template.html")?.openStream()
File("./mcscankt-results").mkdir()

val htmlDefaultTemplate: InputStream = javaClass.classLoader?.getResource("template.html")?.openStream()
?: throw IllegalAccessException("template html not found")
val template = File("./template.html")
template.writeBytes(inputStream.readAllBytes())
val template = File("./mcscankt-results/template.html")
template.writeBytes(htmlDefaultTemplate.readAllBytes())

val fontDefaultTemplate: InputStream = javaClass.classLoader?.getResource("minecraftia-regular.ttf")?.openStream()
?: throw IllegalAccessException("custom font not found")
val fontTemplate = File("./mcscankt-results/minecraftia-regular.ttf")
fontTemplate.writeBytes(fontDefaultTemplate.readAllBytes())

// TODO : Split into pages when have too many item in one page
countItemService.getCounter()
Expand Down
2 changes: 2 additions & 0 deletions domain/src/main/resources/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
justify-content: flex-start;
align-content: center;
align-items: flex-start;
background: linear-gradient(to left, #636FA4, #E8CBC0);
}

.item {
Expand Down Expand Up @@ -43,6 +44,7 @@
.item-count-center {
align-self: center;
text-align: center;
color: white;
}

.id {
Expand Down

0 comments on commit 26528a1

Please sign in to comment.