This repository has been archived on 2023-08-15. You can view files and clone it, but cannot push or open issues or pull requests.
2021-08-14 02:34:58 +00:00
|
|
|
package com.causa_arcana
|
|
|
|
|
2021-08-14 02:58:09 +00:00
|
|
|
class HtmlGenerator(private val title: String, private val contentHtml: String) {
|
2021-08-14 02:34:58 +00:00
|
|
|
fun fullHtml(): String {
|
|
|
|
return """
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>${headInnerHtml()}</head>
|
2021-08-14 02:58:09 +00:00
|
|
|
<body>${bodyInnerHtml()}</body>
|
2021-08-14 02:34:58 +00:00
|
|
|
</html>
|
|
|
|
"""
|
|
|
|
}
|
|
|
|
|
|
|
|
private fun headInnerHtml(): String {
|
|
|
|
return """
|
|
|
|
<meta charset="utf-8"/>
|
|
|
|
<style>${fullCss()}</style>
|
|
|
|
"""
|
|
|
|
}
|
|
|
|
|
2021-08-14 02:58:09 +00:00
|
|
|
private fun bodyInnerHtml(): String {
|
|
|
|
return """
|
|
|
|
<main>
|
|
|
|
<article>
|
|
|
|
<header>
|
|
|
|
<h1>$title</h1>
|
|
|
|
</header>
|
|
|
|
<div>$contentHtml</div>
|
|
|
|
</article>
|
|
|
|
</main>
|
|
|
|
"""
|
|
|
|
}
|
|
|
|
|
2021-08-14 02:34:58 +00:00
|
|
|
private fun fullCss(): String {
|
|
|
|
return """
|
2021-08-14 04:23:56 +00:00
|
|
|
article {
|
|
|
|
word-break: break-word;
|
|
|
|
word-wrap: break-word;
|
|
|
|
}
|
2021-08-14 03:06:55 +00:00
|
|
|
img {
|
|
|
|
max-width: 100%;
|
2021-08-14 02:34:58 +00:00
|
|
|
}
|
|
|
|
"""
|
|
|
|
}
|
|
|
|
}
|