|
| 1 | +# go-comicinfo |
| 2 | + |
| 3 | +[](https://pkg.go.dev/github.com/fmartingr/go-comicinfo) |
| 4 | +[](https://goreportcard.com/report/github.com/fmartingr/go-comicinfo) |
| 5 | +[](https://codecov.io/gh/fmartingr/go-comicinfo) |
| 6 | +[](https://opensource.org/licenses/MIT) |
| 7 | + |
| 8 | +Golang implementation of the [ComicInfo.xml specification](https://anansi-project.github.io/docs/category/comicinfo) to read and write `comicinfo.xml` files. |
| 9 | + |
| 10 | + |
| 11 | +## Contributing |
| 12 | + |
| 13 | +Contributions are welcome, please open an issue or a pull request. |
| 14 | + |
| 15 | +## Versioning |
| 16 | + |
| 17 | +This project uses [Semantic Versioning](https://semver.org/) and will follow the major and minor versions of the [ComicInfo.xml specification](https://anansi-project.github.io/docs/category/comicinfo), while using the hotfix version for any changes to the library itself. |
| 18 | + |
| 19 | +## Usage example |
| 20 | + |
| 21 | +```go |
| 22 | +package main |
| 23 | + |
| 24 | +import "github.com/fmartingr/go-comicinfo/v2" |
| 25 | + |
| 26 | +func main() { |
| 27 | + ci := comicinfo.NewComicInfo() |
| 28 | + ci.Series = "One Piece" |
| 29 | + ci.Number = "3093" |
| 30 | + ci.Summary = "Luffy and the Straw Hat Pirates return in an all-new Epic Voyage!" |
| 31 | + ci.AgeRating = comicinfo.AgeRatingEveryone |
| 32 | + ci.LanguageISO = "en" |
| 33 | + |
| 34 | + for i := 1; i <= 17; i++ { |
| 35 | + ci.Pages.Pages = append(ci.Pages.Pages, comicinfo.ComicPageInfo{ |
| 36 | + Image: i, |
| 37 | + }) |
| 38 | + } |
| 39 | + |
| 40 | + _ = comicinfo.Write(ci, "volume/comicinfo.xml") |
| 41 | +} |
| 42 | +``` |
| 43 | + |
| 44 | +Result |
| 45 | + |
| 46 | +```xml |
| 47 | +<?xml version="1.0" encoding="UTF-8"?> |
| 48 | +<ComicInfo xmlns:xsd="http://www.w3.org/2001/XMLSchema" |
| 49 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
| 50 | + <Series>One Piece</Series> |
| 51 | + <Number>3093</Number> |
| 52 | + <Summary>Luffy and the Straw Hat Pirates return in an all-new Epic Voyage!</Summary> |
| 53 | + <LanguageISO>en</LanguageISO> |
| 54 | + <AgeRating>Everyone</AgeRating> |
| 55 | + <Pages> |
| 56 | + <Page Image="1"></Page> |
| 57 | + <Page Image="2"></Page> |
| 58 | + <Page Image="3"></Page> |
| 59 | + <Page Image="4"></Page> |
| 60 | + <Page Image="5"></Page> |
| 61 | + <Page Image="6"></Page> |
| 62 | + <Page Image="7"></Page> |
| 63 | + <Page Image="8"></Page> |
| 64 | + <Page Image="9"></Page> |
| 65 | + <Page Image="10"></Page> |
| 66 | + <Page Image="11"></Page> |
| 67 | + <Page Image="12"></Page> |
| 68 | + <Page Image="13"></Page> |
| 69 | + <Page Image="14"></Page> |
| 70 | + <Page Image="15"></Page> |
| 71 | + <Page Image="16"></Page> |
| 72 | + <Page Image="17"></Page> |
| 73 | + </Pages> |
| 74 | +</ComicInfo> |
| 75 | + |
| 76 | +``` |
| 77 | + |
| 78 | +## License |
| 79 | + |
| 80 | +[MIT LICENSE](LICENSE) |
0 commit comments