45 lines
643 B
Go
45 lines
643 B
Go
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
|
|
}
|