go-maymoon/renderhtml.go

45 lines
643 B
Go
Raw Permalink Normal View History

2023-08-18 16:28:18 +00:00
package maymoon
import (
"io"
)
func renderHTML(writer io.Writer, reader io.Reader) error {
{
_, err := io.WriteString(
writer,
`<html>` +"\n"+
`<head>` +"\n"+
`<meta charset="utf-8" />` +"\n"+
`</head>` +"\n"+
`<body>` +"\n"+
`<main>` +"\n",
)
if nil != err {
return err
}
}
{
_, err := io.Copy(writer, reader)
if nil != err {
return err
}
}
{
_, err := io.WriteString(
writer,
`</main>` +"\n"+
`</body>` +"\n"+
`</html>` +"\n",
)
if nil != err {
return err
}
}
return nil
}