Skip to content

Commit

Permalink
Update docs (#389)
Browse files Browse the repository at this point in the history
* Update docs
  • Loading branch information
johnfercher authored Jan 13, 2024
1 parent d41c6cb commit 2a65cc4
Show file tree
Hide file tree
Showing 27 changed files with 133 additions and 133 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ You can write your PDFs like you are creating a site using Bootstrap. A Row may
Besides that, pages will be added when content may extrapolate the useful area. You can define a header which will be added
always when a new page appear, in this case, a header may have many rows, lines or tablelist.

#### Maroto `v2.0.0-beta.9` is here! Try out:
#### Maroto `v2.0.0-beta.12` is here! Try out:

* Installation with`go get`:

```bash
go get github.com/johnfercher/maroto/v2@v2.0.0-beta.9
go get github.com/johnfercher/maroto/v2@v2.0.0-beta.12
```

* You can see the full `v2` documentation [here](https://maroto.io/).
Expand Down
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
[![Visits Badge](https://badges.pufler.dev/visits/johnfercher/maroto)](https://badges.pufler.dev)
[![Stars Badge](https://img.shields.io/github/stars/johnfercher/maroto.svg?style=social&label=Stars)](https://github.com/johnfercher/maroto/stargazers)

#### Maroto`v2.0.0-beta.10`is here! Try out:
#### Maroto`v2.0.0-beta.12`is here! Try out:

* Installation with`go get`:

```bash
go get github.com/johnfercher/maroto/v2@v2.0.0-beta.10
go get github.com/johnfercher/maroto/v2@v2.0.0-beta.12
```

The public API was completely redesigned with the aim of enhancing the
Expand Down
2 changes: 1 addition & 1 deletion docs/_coverpage.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![logo](assets/images/logo.png)

# Maroto <small>v2.0.0-beta.10</small>
# Maroto <small>v2.0.0-beta.12</small>

> An open-source golang lib to create PDFs. Fast and Simple.
Expand Down
14 changes: 7 additions & 7 deletions pkg/components/code/barcode.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Package code implements creation of barcode, matrixcode and qrcode.
// nolint:dupl // It's similar to barcode.go and it's hard to extract common code.
// Package code implements creation of Barcode, MatrixCode and QrCode.
// nolint:dupl // It's similar to Barcode.go and it's hard to extract common code.
package code

import (
Expand All @@ -12,7 +12,7 @@ import (
"github.com/johnfercher/maroto/v2/pkg/props"
)

type barcode struct {
type Barcode struct {
code string
prop props.Barcode
config *entity.Config
Expand All @@ -26,7 +26,7 @@ func NewBar(code string, ps ...props.Barcode) core.Component {
}
prop.MakeValid()

return &barcode{
return &Barcode{
code: code,
prop: prop,
}
Expand All @@ -46,12 +46,12 @@ func NewBarRow(height float64, code string, ps ...props.Barcode) core.Row {
}

// Render renders a Barcode into a PDF context.
func (b *barcode) Render(provider core.Provider, cell *entity.Cell) {
func (b *Barcode) Render(provider core.Provider, cell *entity.Cell) {
provider.AddBarCode(b.code, cell, &b.prop)
}

// GetStructure returns the Structure of a Barcode.
func (b *barcode) GetStructure() *node.Node[core.Structure] {
func (b *Barcode) GetStructure() *node.Node[core.Structure] {
str := core.Structure{
Type: "barcode",
Value: b.code,
Expand All @@ -62,6 +62,6 @@ func (b *barcode) GetStructure() *node.Node[core.Structure] {
}

// SetConfig sets the configuration of a Barcode.
func (b *barcode) SetConfig(config *entity.Config) {
func (b *Barcode) SetConfig(config *entity.Config) {
b.config = config
}
12 changes: 6 additions & 6 deletions pkg/components/code/matrixcode.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Package code implements creation of barcode, matrixcode and qrcode.
// Package code implements creation of Barcode, MatrixCode and QrCode.
// nolint:dupl
package code

Expand All @@ -12,7 +12,7 @@ import (
"github.com/johnfercher/maroto/v2/pkg/props"
)

type matrixCode struct {
type MatrixCode struct {
code string
prop props.Rect
config *entity.Config
Expand All @@ -26,7 +26,7 @@ func NewMatrix(code string, barcodeProps ...props.Rect) core.Component {
}
prop.MakeValid()

return &matrixCode{
return &MatrixCode{
code: code,
prop: prop,
}
Expand All @@ -46,12 +46,12 @@ func NewMatrixRow(height float64, code string, ps ...props.Rect) core.Row {
}

// Render renders a MatrixCode into a PDF context.
func (m *matrixCode) Render(provider core.Provider, cell *entity.Cell) {
func (m *MatrixCode) Render(provider core.Provider, cell *entity.Cell) {
provider.AddMatrixCode(m.code, cell, &m.prop)
}

// GetStructure returns the Structure of a MatrixCode.
func (m *matrixCode) GetStructure() *node.Node[core.Structure] {
func (m *MatrixCode) GetStructure() *node.Node[core.Structure] {
str := core.Structure{
Type: "matrixcode",
Value: m.code,
Expand All @@ -62,6 +62,6 @@ func (m *matrixCode) GetStructure() *node.Node[core.Structure] {
}

// SetConfig sets the configuration of a MatrixCode.
func (m *matrixCode) SetConfig(config *entity.Config) {
func (m *MatrixCode) SetConfig(config *entity.Config) {
m.config = config
}
12 changes: 6 additions & 6 deletions pkg/components/code/qrcode.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Package code implements creation of barcode, matrixcode and qrcode.
// Package code implements creation of Barcode, MatrixCode and QrCode.
// nolint:dupl
package code

Expand All @@ -12,7 +12,7 @@ import (
"github.com/johnfercher/maroto/v2/pkg/props"
)

type qrCode struct {
type QrCode struct {
code string
prop props.Rect
config *entity.Config
Expand All @@ -26,7 +26,7 @@ func NewQr(code string, barcodeProps ...props.Rect) core.Component {
}
prop.MakeValid()

return &qrCode{
return &QrCode{
code: code,
prop: prop,
}
Expand All @@ -46,12 +46,12 @@ func NewQrRow(height float64, code string, ps ...props.Rect) core.Row {
}

// Render renders a QrCode into a PDF context.
func (q *qrCode) Render(provider core.Provider, cell *entity.Cell) {
func (q *QrCode) Render(provider core.Provider, cell *entity.Cell) {
provider.AddQrCode(q.code, cell, &q.prop)
}

// GetStructure returns the Structure of a QrCode.
func (q *qrCode) GetStructure() *node.Node[core.Structure] {
func (q *QrCode) GetStructure() *node.Node[core.Structure] {
str := core.Structure{
Type: "qrcode",
Value: q.code,
Expand All @@ -62,6 +62,6 @@ func (q *qrCode) GetStructure() *node.Node[core.Structure] {
}

// SetConfig set the config for the component.
func (q *qrCode) SetConfig(config *entity.Config) {
func (q *QrCode) SetConfig(config *entity.Config) {
q.config = config
}
18 changes: 9 additions & 9 deletions pkg/components/col/col.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/johnfercher/maroto/v2/pkg/props"
)

type col struct {
type Col struct {
size int
isMax bool
components []core.Component
Expand All @@ -20,20 +20,20 @@ type col struct {
// New is responsible to create an instance of core.Col.
func New(size ...int) core.Col {
if len(size) == 0 {
return &col{isMax: true}
return &Col{isMax: true}
}

return &col{size: size[0]}
return &Col{size: size[0]}
}

// Add is responsible to add a component to a core.Col.
func (c *col) Add(components ...core.Component) core.Col {
func (c *Col) Add(components ...core.Component) core.Col {
c.components = append(c.components, components...)
return c
}

// GetSize returns the size of a core.Col.
func (c *col) GetSize() int {
func (c *Col) GetSize() int {
if c.isMax {
return c.config.MaxGridSize
}
Expand All @@ -42,7 +42,7 @@ func (c *col) GetSize() int {
}

// GetStructure returns the Structure of a core.Col.
func (c *col) GetStructure() *node.Node[core.Structure] {
func (c *Col) GetStructure() *node.Node[core.Structure] {
str := core.Structure{
Type: "col",
Value: c.size,
Expand All @@ -67,7 +67,7 @@ func (c *col) GetStructure() *node.Node[core.Structure] {
}

// Render renders a core.Col into a PDF context.
func (c *col) Render(provider core.Provider, cell entity.Cell, createCell bool) {
func (c *Col) Render(provider core.Provider, cell entity.Cell, createCell bool) {
if createCell {
provider.CreateCol(cell.Width, cell.Height, c.config, c.style)
}
Expand All @@ -78,15 +78,15 @@ func (c *col) Render(provider core.Provider, cell entity.Cell, createCell bool)
}

// SetConfig set the config for the component.
func (c *col) SetConfig(config *entity.Config) {
func (c *Col) SetConfig(config *entity.Config) {
c.config = config
for _, component := range c.components {
component.SetConfig(config)
}
}

// WithStyle sets the style for the column.
func (c *col) WithStyle(style *props.Cell) core.Col {
func (c *Col) WithStyle(style *props.Cell) core.Col {
c.style = style
return c
}
10 changes: 5 additions & 5 deletions pkg/components/image/bytesimage.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/johnfercher/maroto/v2/pkg/props"
)

type bytesImage struct {
type BytesImage struct {
bytes []byte
extension extension.Type
prop props.Rect
Expand All @@ -27,7 +27,7 @@ func NewFromBytes(bytes []byte, extension extension.Type, ps ...props.Rect) core
}
prop.MakeValid()

return &bytesImage{
return &BytesImage{
bytes: bytes,
prop: prop,
extension: extension,
Expand All @@ -48,12 +48,12 @@ func NewFromBytesRow(height float64, bytes []byte, extension extension.Type, ps
}

// Render renders an Image into a PDF context.
func (b *bytesImage) Render(provider core.Provider, cell *entity.Cell) {
func (b *BytesImage) Render(provider core.Provider, cell *entity.Cell) {
provider.AddImageFromBytes(b.bytes, cell, &b.prop, b.extension)
}

// GetStructure returns the Structure of an Image.
func (b *bytesImage) GetStructure() *node.Node[core.Structure] {
func (b *BytesImage) GetStructure() *node.Node[core.Structure] {
trimLength := 10
if len(b.bytes) < trimLength {
trimLength = len(b.bytes)
Expand All @@ -72,6 +72,6 @@ func (b *bytesImage) GetStructure() *node.Node[core.Structure] {
}

// SetConfig sets the pdf config.
func (b *bytesImage) SetConfig(config *entity.Config) {
func (b *BytesImage) SetConfig(config *entity.Config) {
b.config = config
}
10 changes: 5 additions & 5 deletions pkg/components/image/fileimage.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/johnfercher/maroto/v2/pkg/props"
)

type fileImage struct {
type FileImage struct {
path string
prop props.Rect
config *entity.Config
Expand All @@ -25,7 +25,7 @@ func NewFromFile(path string, ps ...props.Rect) core.Component {
}
prop.MakeValid()

return &fileImage{
return &FileImage{
path: path,
prop: prop,
}
Expand All @@ -45,12 +45,12 @@ func NewFromFileRow(height float64, path string, ps ...props.Rect) core.Row {
}

// Render renders an Image into a PDF context.
func (f *fileImage) Render(provider core.Provider, cell *entity.Cell) {
func (f *FileImage) Render(provider core.Provider, cell *entity.Cell) {
provider.AddImageFromFile(f.path, cell, &f.prop)
}

// GetStructure returns the Structure of an Image.
func (f *fileImage) GetStructure() *node.Node[core.Structure] {
func (f *FileImage) GetStructure() *node.Node[core.Structure] {
str := core.Structure{
Type: "fileImage",
Value: f.path,
Expand All @@ -61,6 +61,6 @@ func (f *fileImage) GetStructure() *node.Node[core.Structure] {
}

// SetConfig sets the pdf config.
func (f *fileImage) SetConfig(config *entity.Config) {
func (f *FileImage) SetConfig(config *entity.Config) {
f.config = config
}
12 changes: 6 additions & 6 deletions pkg/components/line/line.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/johnfercher/maroto/v2/pkg/props"
)

type line struct {
type Line struct {
config *entity.Config
prop props.Line
}
Expand All @@ -24,7 +24,7 @@ func New(ps ...props.Line) core.Component {
}
lineProp.MakeValid()

return &line{
return &Line{
prop: lineProp,
}
}
Expand All @@ -43,21 +43,21 @@ func NewRow(height float64, ps ...props.Line) core.Row {
}

// GetStructure returns the Structure of a Line.
func (l *line) GetStructure() *node.Node[core.Structure] {
func (l *Line) GetStructure() *node.Node[core.Structure] {
str := core.Structure{
Type: "lineStyle",
Type: "line",
Details: l.prop.ToMap(),
}

return node.New(str)
}

// SetConfig sets the config.
func (l *line) SetConfig(config *entity.Config) {
func (l *Line) SetConfig(config *entity.Config) {
l.config = config
}

// Render renders a Line into a PDF context.
func (l *line) Render(provider core.Provider, cell *entity.Cell) {
func (l *Line) Render(provider core.Provider, cell *entity.Cell) {
provider.AddLine(cell, &l.prop)
}
Loading

0 comments on commit 2a65cc4

Please sign in to comment.