Skip to content

karantin2020/go-fb2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

License GoDoc


Features

  • Documented API
  • Creates valid FB 2.1 files
  • Includes support for adding CSS, images

Python package for working with FictionBook2

Usage example

package main

import (
    fb2 "github.com/karantin2020/go-fb2"
)

func main() {
    book := fb2.NewFB2("Example book")
    // "Example book" is a book title
    err := book.SetCover("./testdata/AirPlane_400x600.jpg")
    if err != nil {
        panic(err)
    }
    book.SetAuthor(fb2.AuthorType{
        FirstName: "TestFirstName",
        LastName:  "TestLastName",
    })
    book.SetDescription(`Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut alios omittam, hunc appello, quem ille unum secutus est.`)
	d.AddSection(`<p>Chapter text.</p>
<p><strong>Strong text.</strong></p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.`, "Chapter 1")
    err = d.WriteToFile("ExampleBook.fb2")
    if err != nil {
        panic(err)
    }
}

Installation

Contributions

Contributions are welcome.

Development

Clone this repository using Git. Run tests as documented below.

Dependencies are managed using Go modules

Run tests

go test

About

FictionBook2 library, create fb2 books

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages