Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Creator support for outlines #321

Merged
merged 7 commits into from
Jan 18, 2019
Merged

Add Creator support for outlines #321

merged 7 commits into from
Jan 18, 2019

Conversation

adrg
Copy link
Collaborator

@adrg adrg commented Jan 17, 2019

Generate PDF outlines automatically for Chapter and Subchapter components in the Creator.
Also, adds a high level interface for creating outline trees in the model package, compatible with the
low level interface.

Resolves #87
Resolves #14


This change is Reviewable

@codecov
Copy link

codecov bot commented Jan 17, 2019

Codecov Report

Merging #321 into v3 will decrease coverage by 0.42%.
The diff coverage is 39.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##               v3     #321      +/-   ##
==========================================
- Coverage   38.99%   38.56%   -0.43%     
==========================================
  Files         120      121       +1     
  Lines       22945    23081     +136     
==========================================
- Hits         8947     8901      -46     
- Misses      12743    12899     +156     
- Partials     1255     1281      +26
Impacted Files Coverage Δ
pdf/model/outlines.go 0% <0%> (ø) ⬆️
pdf/model/outline.go 0% <0%> (ø)
pdf/creator/creator.go 70.09% <100%> (-5.56%) ⬇️
pdf/creator/chapters.go 62.88% <79.16%> (-3.79%) ⬇️
pdf/creator/subchapter.go 68.68% <79.31%> (-4.81%) ⬇️
pdf/creator/toc.go 85.32% <0%> (-8.26%) ⬇️
pdf/creator/toc_line.go 73.8% <0%> (-6.82%) ⬇️
pdf/creator/block.go 67.61% <0%> (-6.44%) ⬇️
pdf/creator/styled_paragraph.go 86.18% <0%> (-4.53%) ⬇️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 82906a2...f6ab87c. Read the comment docs.

Copy link

@gunnsth-review gunnsth-review left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 5 of 5 files at r1.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @adrg)

a discussion (no related file):
Looks great. Couple of suggestions and questions.



pdf/model/outline.go, line 112 at r1 (raw file):

// OutlineItem represents a PDF outline item dictionary (Table 153 - pp. 376 - 377).
type OutlineItem struct {

Good approach to wrap the PdfOutlineItem in an OutlineItem (higher level), separating the creation function and the logic.
Can this also be used when reading the outlines, e.g. getting a list of all outlines?
Might be good to add a comment that this is intended for creation use.


pdf/model/outlines.go, line 50 at r1 (raw file):

func NewPdfOutline() *PdfOutline {
	outline := &PdfOutline{
		primitive: &PdfIndirectObject{

More concise syntax: core.MakeIndirect(core.MakeDict())


pdf/model/outlines.go, line 69 at r1 (raw file):

func NewPdfOutlineItem() *PdfOutlineItem {
	outlineItem := &PdfOutlineItem{
		primitive: &PdfIndirectObject{

same here

Copy link
Collaborator Author

@adrg adrg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 3 of 5 files reviewed, 4 unresolved discussions (waiting on @adrg and @gunnsth-review)


pdf/model/outline.go, line 112 at r1 (raw file):

Previously, gunnsth-review wrote…

Good approach to wrap the PdfOutlineItem in an OutlineItem (higher level), separating the creation function and the logic.
Can this also be used when reading the outlines, e.g. getting a list of all outlines?
Might be good to add a comment that this is intended for creation use.

I added a comment on the Outline struct specifying that currently it can be used only to build outlines. The outline object could be used to also read the outlines from a PDF file.
I think we should do this in another pull request though and make this one about the Creator. The interface for the high-level outlines could contain a method for reading outlines from a PDF file, one for printing them in user friendly format. Maybe merging and splitting as well.


pdf/model/outlines.go, line 50 at r1 (raw file):

Previously, gunnsth-review wrote…

More concise syntax: core.MakeIndirect(core.MakeDict())

Done.


pdf/model/outlines.go, line 69 at r1 (raw file):

Previously, gunnsth-review wrote…

same here

Done.

Copy link

@gunnsth-review gunnsth-review left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 2 files at r2.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @adrg)

Copy link

@gunnsth-review gunnsth-review left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@gunnsth gunnsth merged commit 33d17ce into unidoc:v3 Jan 18, 2019
@adrg adrg deleted the pdf-outlines branch January 21, 2019 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants