~dricottone/epub2html

epub2html/main.go -rw-r--r-- 568 bytes
ae806b41Dominic Ricottone Fixing blockquotes and refactoring 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package main

import (
	"fmt"
)

func dump_archive(archive_name string) error {
	// Read the archive
	archive, err := ReadArchive(archive_name)
	if err != nil {
		return err
	}

	// Get a sorted table of contents
	toc := ReadTableOfContents(archive["toc.ncx"])

	// Print files according to the table of contents
	for _, file_name := range toc {
		fmt.Println(ReadHtml(archive[file_name]))
	}

	return nil
}

func main() {
	// process arguments

	if err := dump_archive("test_docs/the_future_is_female.epub"); err != nil {
		fmt.Printf("fatal error: %s\n", err)
	}
}