https://github.com/karantin2020/go-fb2
FictionBook2 library, create fb2 books
https://github.com/karantin2020/go-fb2
fb2 fictionbook2 go golang
Last synced: 4 months ago
JSON representation
FictionBook2 library, create fb2 books
- Host: GitHub
- URL: https://github.com/karantin2020/go-fb2
- Owner: karantin2020
- License: mit
- Created: 2021-08-05T12:57:39.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-04-04T21:14:13.000Z (about 4 years ago)
- Last Synced: 2024-06-20T03:46:24.533Z (about 2 years ago)
- Topics: fb2, fictionbook2, go, golang
- Language: Go
- Homepage:
- Size: 294 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/karantin2020/go-fb2/blob/master/LICENSE)
[](https://godoc.org/github.com/karantin2020/go-fb2)
---
### Features
- [Documented API](https://godoc.org/github.com/karantin2020/go-fb2)
- Creates valid FB 2.1 files
- Includes support for adding CSS, images
Python package for working with FictionBook2
## Usage example
```go
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(`
Chapter text.
Strong text.
Lorem ipsum dolor sit amet, consectetur adipiscing elit.`, "Chapter 1")
err = d.WriteToFile("ExampleBook.fb2")
if err != nil {
panic(err)
}
}
```
## Installation
- use [Go modules](https://golang.org/ref/mod)
### Contributions
Contributions are welcome.
### Development
Clone this repository using Git. Run tests as documented below.
Dependencies are managed using [Go modules](https://golang.org/ref/mod)
#### Run tests
```
go test
```