periodize

package module
v0.0.0-...-fe2af29 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2017 License: MIT Imports: 13 Imported by: 1

README

Periodize

GoDoc Reference Build Status Go Report Card

Go library to generate periodical .mobi files.

Dependencies

Periodize requires that the kindlegen executable be available in PATH.

Usage

package main

import (
	"os"

	"github.com/djcrock/periodize"
)

func main() {
	iss := periodize.Issue{
		UniqueID:    "123",
		Title:       "My Periodical",
		Creator:     "djcrock",
		Publisher:   "djcrock",
		Subject:     "eBook Publishing",
		Description: "Demonstration of periodical publishing",
		Date:        "2017-10-21",
		Sections: []periodize.Section{
			{
				Title: "Section 1",
				Articles: []periodize.Article{
					{
						Title:   "Article 1-1",
						Author:  "djcrock",
						Content: "<body>Content 1</body>",
					},
				},
			},
			{
				Title: "Section 2",
				Articles: []periodize.Article{
					{
						Title:   "Article 2-1",
						Author:  "djcrock",
						Content: "<body>Content 2</body>",
					},
					{
						Title:   "Article 2-2",
						Author:  "djcrock",
						Content: "<body>Content 3</body>",
					},
				},
			},
		},
	}

	mobi, _ := os.Create("my_periodical.mobi")
	defer mobi.Close()

	// GenerateMobi accepts any io.Writer
	iss.GenerateMobi(mobi)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Article

type Article struct {
	Title   string
	Author  string
	Content string
	// Set automatically by Issue.prepare()
	PlayOrder int
	Href      string
}

An Article appearing in an Issue of a periodical

type Issue

type Issue struct {
	UniqueID    string
	Title       string
	Creator     string
	Publisher   string
	Subject     string
	Description string
	Date        string
	CoverImage  io.Reader
	Sections    []Section
}

An Issue of a periodical

func (*Issue) GenerateMobi

func (iss *Issue) GenerateMobi(wr io.Writer) error

GenerateMobi writes a .mobi format periodical file for an Issue to the provided Writer

type Section

type Section struct {
	Title    string
	Articles []Article
	// Set automatically by Issue.prepare()
	SectionID string
	PlayOrder int
	Href      string
}

A Section of an Issue

Jump to

Keyboard shortcuts

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