article 관련 html 코드 - 개선중
fun htmlArticleWriter(article:Article){
var fileContents = ""
var filePath = "data/Article/article_detail_${article.id}.html"
val member = membersRepository.getMemberByMemIndex(article.memIndex)!!
val memberName = member.memNick
val board = boardsRepository.getBoardByIndex(article.boardIndex)!!
val boardName = board.name
fileContents += "<!DOCTYPE html>\r\n"
fileContents += """<html lang = "ko">""" +"\r\n"
fileContents += "<head>\r\n"
fileContents += "<!--${article.boardIndex}-->\r\n"
fileContents += "\t<title>${article.title}</title>\r\n"
fileContents += "</head>\r\n"
fileContents += "<body>\r\n"
fileContents += "\t<h1>$boardName</h1>\r\n"
fileContents += "\t<h2>${article.title}</h2>\r\n"
fileContents += "\t<div>${article.body}</div>\r\n"
fileContents += "\t<div>$memberName</div>\r\n"
fileContents += "</body>\r\n"
fileContents += "</html>\r\n"
File("data/Article/article_detail_${article.id}.html").writeText(fileContents)
}
kotlin 에서 html파일을 만드는 함수, 개선중
'Language > Kotlin' 카테고리의 다른 글
2021 - 05 - 16, Kotlin (0) | 2021.05.16 |
---|---|
2021 - 05 - 15, Kotlin (0) | 2021.05.16 |
2021 - 05 - 14, Kotlin (0) | 2021.05.16 |
2021 - 05 - 13, Kotlin (0) | 2021.05.14 |
2021 - 05 - 12, Kotlin (0) | 2021.05.13 |