improve style

This commit is contained in:
Celogeek 2023-04-22 10:29:36 +02:00
parent b27a826cd2
commit d96e63bc50
Signed by: celogeek
SSH Key Fingerprint: SHA256:njNJLzoLQdbV9PC6ehcruRb0QnEgxABoCYZ+0+aUIYc
5 changed files with 17 additions and 10 deletions

View File

@ -97,13 +97,8 @@ func (e *ePub) writeImage(wz *epubZip, img *Image) error {
err := wz.WriteFile( err := wz.WriteFile(
fmt.Sprintf("OEBPS/%s", img.TextPath()), fmt.Sprintf("OEBPS/%s", img.TextPath()),
e.render(textTmpl, map[string]any{ e.render(textTmpl, map[string]any{
"Title": fmt.Sprintf("Image %d Part %d", img.Id, img.Part), "Title": fmt.Sprintf("Image %d Part %d", img.Id, img.Part),
"ViewPort": fmt.Sprintf("width=%d, height=%d", e.ViewWidth, e.ViewHeight), "ViewPort": fmt.Sprintf("width=%d,height=%d", e.ViewWidth, e.ViewHeight),
"ImageStyle": fmt.Sprintf(
"width:%dpx; height:%dpx;",
img.Width,
img.Height,
),
"ImagePath": img.ImgPath(), "ImagePath": img.ImgPath(),
}), }),
) )
@ -120,7 +115,7 @@ func (e *ePub) writeBlank(wz *epubZip, img *Image) error {
fmt.Sprintf("OEBPS/Text/%d_sp.xhtml", img.Id), fmt.Sprintf("OEBPS/Text/%d_sp.xhtml", img.Id),
e.render(blankTmpl, map[string]any{ e.render(blankTmpl, map[string]any{
"Title": fmt.Sprintf("Blank Page %d", img.Id), "Title": fmt.Sprintf("Blank Page %d", img.Id),
"ViewPort": fmt.Sprintf("width=%d, height=%d", e.ViewWidth, e.ViewHeight), "ViewPort": fmt.Sprintf("width=%d,height=%d", e.ViewWidth, e.ViewHeight),
}), }),
) )
} }

View File

@ -2,6 +2,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops">
<head> <head>
<meta charset="utf-8" />
<title>{{ .Title }}</title> <title>{{ .Title }}</title>
<link href="style.css" type="text/css" rel="stylesheet"/> <link href="style.css" type="text/css" rel="stylesheet"/>
<meta name="viewport" content="{{ .ViewPort }}"/> <meta name="viewport" content="{{ .ViewPort }}"/>

View File

@ -1,13 +1,22 @@
body { body {
color: #000; color: #000;
background: #FFF; background: #FFF;
top: 0;
left: 0;
margin: 0; margin: 0;
padding: 0; padding: 0;
width: {{ .PageWidth }}px; width: {{ .PageWidth }}px;
height: {{ .PageHeight }}px; height: {{ .PageHeight }}px;
text-align: center;
} }
div { img {
position: absolute;
margin:0; margin:0;
padding:0; padding:0;
z-index:0;
top:0;
left:0;
width: {{ .PageWidth }}px;
height: {{ .PageHeight }}px;
} }

View File

@ -2,13 +2,14 @@
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops">
<head> <head>
<meta charset="utf-8" />
<title>{{ .Title }}</title> <title>{{ .Title }}</title>
<link href="style.css" type="text/css" rel="stylesheet"/> <link href="style.css" type="text/css" rel="stylesheet"/>
<meta name="viewport" content="{{ .ViewPort }}"/> <meta name="viewport" content="{{ .ViewPort }}"/>
</head> </head>
<body> <body>
<div> <div>
<img style="{{ .ImageStyle }}" src="../{{ .ImagePath }}"/> <img src="../{{ .ImagePath }}" alt="{{ .Title }}"/>
</div> </div>
</body> </body>
</html> </html>

View File

@ -2,6 +2,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops">
<head> <head>
<meta charset="utf-8" />
<title>Part {{ .Part }}</title> <title>Part {{ .Part }}</title>
<link href="style.css" type="text/css" rel="stylesheet"/> <link href="style.css" type="text/css" rel="stylesheet"/>
<meta name="viewport" content="width={{ .Info.ViewWidth }}, height={{ .Info.ViewHeight }}"/> <meta name="viewport" content="width={{ .Info.ViewWidth }}, height={{ .Info.ViewHeight }}"/>