Skip to content

Commit

Permalink
Merge pull request #75 from JetBrains-Research/fix-html-base-template
Browse files Browse the repository at this point in the history
[ML4SE-229] New approach to build html files
  • Loading branch information
mikrise2 authored Nov 7, 2023
2 parents ba3ef7d + 67c2aa1 commit c03ceb4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,15 @@ abstract class HtmlBaseTemplate : HtmlTemplate {
css
).joinToString(System.lineSeparator())

protected fun loadCssFromFile(filename: String) = getFileContentFromResources("$CSS_FOLDER/$filename.css").toCss()
protected fun loadCssFromFile(filename: String) = getFileContentFromResources("$CSS_FOLDER/$filename.css")

protected fun getFileContentFromResources(path: String) =
HtmlBaseTemplate::class.java.getResource(path)?.readText()
?: error("Base file with path `$path` must exist")

private fun String.toCss() = replace("%", "%%")

protected fun String.wrapToSmallText() = lines().wrapToSmallText()

protected fun List<String>.wrapToSmallText() = joinToString(System.lineSeparator()) {
private fun List<String>.wrapToSmallText() = joinToString(System.lineSeparator()) {
"""
<p class="small-font">$it</p>
""".trimIndent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
}

.form-group input {
width: 100%;
padding: 12px;
border-radius: 3px;
font-size: 20px;
Expand Down

0 comments on commit c03ceb4

Please sign in to comment.