Improve documentation comments

This commit is contained in:
Adrian-George Bostan 2018-12-01 11:47:22 +02:00
parent 7e7292dbff
commit 7912d378a9
2 changed files with 9 additions and 8 deletions

View File

@ -289,6 +289,7 @@ func (blk *Block) drawToPage(page *model.PdfPage) error {
return err return err
} }
// Add block annotations to the page.
for _, annotation := range blk.annotations { for _, annotation := range blk.annotations {
page.Annotations = append(page.Annotations, annotation) page.Annotations = append(page.Annotations, annotation)
} }

View File

@ -86,6 +86,13 @@ func newStyledParagraph(style TextStyle) *StyledParagraph {
} }
} }
// appendChunk adds the provided text chunk to the paragraph.
func (p *StyledParagraph) appendChunk(chunk *TextChunk) *TextChunk {
p.chunks = append(p.chunks, chunk)
p.wrapText()
return chunk
}
// Append adds a new text chunk to the paragraph. // Append adds a new text chunk to the paragraph.
func (p *StyledParagraph) Append(text string) *TextChunk { func (p *StyledParagraph) Append(text string) *TextChunk {
chunk := newTextChunk(text, p.defaultStyle) chunk := newTextChunk(text, p.defaultStyle)
@ -116,7 +123,7 @@ func (p *StyledParagraph) AddExternalLink(text, url string) *TextChunk {
} }
// AddInternalLink adds a new internal link tot the paragraph. // AddInternalLink adds a new internal link tot the paragraph.
// The text param represents the text that is displayed. // The text parameter represents the text that is displayed.
// The user is taken to the specified page, at the specified x and y // The user is taken to the specified page, at the specified x and y
// coordinates. Position 0, 0 is at the top left of the page. // coordinates. Position 0, 0 is at the top left of the page.
// The zoom of the destination page is controlled with the zoom // The zoom of the destination page is controlled with the zoom
@ -127,13 +134,6 @@ func (p *StyledParagraph) AddInternalLink(text string, page int64, x, y, zoom fl
return p.appendChunk(chunk) return p.appendChunk(chunk)
} }
// appendChunk adds the provided text chunk to the paragraph.
func (p *StyledParagraph) appendChunk(chunk *TextChunk) *TextChunk {
p.chunks = append(p.chunks, chunk)
p.wrapText()
return chunk
}
// Reset removes all the text chunks the paragraph contains. // Reset removes all the text chunks the paragraph contains.
func (p *StyledParagraph) Reset() { func (p *StyledParagraph) Reset() {
p.chunks = []*TextChunk{} p.chunks = []*TextChunk{}