From 7912d378a9dc4ef0bca234d41e47ef92b0771714 Mon Sep 17 00:00:00 2001 From: Adrian-George Bostan Date: Sat, 1 Dec 2018 11:47:22 +0200 Subject: [PATCH] Improve documentation comments --- pdf/creator/block.go | 1 + pdf/creator/styled_paragraph.go | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/pdf/creator/block.go b/pdf/creator/block.go index ed277b92..2884bf2d 100644 --- a/pdf/creator/block.go +++ b/pdf/creator/block.go @@ -289,6 +289,7 @@ func (blk *Block) drawToPage(page *model.PdfPage) error { return err } + // Add block annotations to the page. for _, annotation := range blk.annotations { page.Annotations = append(page.Annotations, annotation) } diff --git a/pdf/creator/styled_paragraph.go b/pdf/creator/styled_paragraph.go index 62aabafd..a00f14a6 100644 --- a/pdf/creator/styled_paragraph.go +++ b/pdf/creator/styled_paragraph.go @@ -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. func (p *StyledParagraph) Append(text string) *TextChunk { 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. -// 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 // coordinates. Position 0, 0 is at the top left of the page. // 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) } -// 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. func (p *StyledParagraph) Reset() { p.chunks = []*TextChunk{}