scrape

package
v0.0.0-...-ee5d40d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ChapTmpl = template.Must(template.New("").Parse(`<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops">
<head>
<title>{{.Title}}</title>
</head>
<body>
<h2>{{.Title}}</h2>
{{.Body}}
</body>
</html>`))
View Source
var CoverTmpl = template.Must(template.New("").Parse(`<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops">
<head>
<title>Cover</title>
</head>
<body>
<div style="text-align: center; padding: 0pt; margin: 0pt;">
<img src="../{{.Filename}}" />
</div>
</body>
</html>
`))
View Source
var NavTmpl = template.Must(template.New("").Parse(`<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" lang="en" xml:lang="en">
<head>
  <meta charset="utf-8"/>
  <style type="text/css">
    nav#landmarks, nav#page-list { display:none; }
    ol { list-style-type: none; }
  </style>
  <title>Table of Contents</title>
</head>
<body epub:type="frontmatter">
  <nav epub:type="toc" id="toc">
    <h1>Table of Contents</h1>
    <ol>
	  {{range .}}
      <li>
        <a href="../{{.Path}}">{{.Title}}</a>
      </li>
	  {{end}}
    </ol>
  </nav>
  <nav epub:type="landmarks" id="landmarks" hidden="">
    <h1>Landmarks</h1>
    <ol>
      <li>
        <a epub:type="toc" href="#toc">Table of Contents</a>
      </li>
	  {{range .}}
      <li>
        <a epub:type="chapter" href="../{{.Path}}">Chapter</a>
      </li>
	  {{end}}
    </ol>
  </nav>
</body>
</html>`))
View Source
var TOCTmpl = template.Must(template.New("").Parse(`<?xml version="1.0" encoding="utf-8" ?>
<ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1">
<head>
</head>
<docTitle>
<text>{{.Title}}</text>
</docTitle>
<navMap>
{{range .Chapters}}
<navPoint>
<navLabel>
<text>{{.Title}}</text>
</navLabel>
<content src="{{.Path}}"/>
</navPoint>
{{end}}
</navMap>
</ncx>`))

Functions

func Run

func Run(wuxiaURL string, a fyne.App, pg binding.Float, file fyne.URIWriteCloser) error

Types

type Book

type Book struct {
	Title        string
	Author       string
	Cover        string
	Chapters     []Chapter
	ChapterCount int
}

func (*Book) Consume

func (b *Book) Consume(ch chan Chapter, pg binding.Float)

func (*Book) FindAllChapters

func (b *Book) FindAllChapters(u string) ([]string, error)

func (*Book) Write

func (b *Book) Write(a fyne.App, file fyne.URIWriteCloser) error

type Chapter

type Chapter struct {
	Title   string
	Content *bytes.Buffer
	URL     string
	Number  int
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL