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

Correct invalid html generated by _repr_html_() #975

Merged
merged 10 commits into from
Feb 2, 2023

Conversation

pjhartzell
Copy link
Collaborator

@pjhartzell pjhartzell commented Feb 1, 2023

Related Issue(s):

Description:
Fixes a few bugs and makes the display formatting more consistent.

  • Fixes:

    • Missing Link hrefs now populated
    • Missing <strong> tag added to Catalog id
    • None is no longer displayed in Asset heading when the Asset does not have a title.
    • No longer displays empty iterables, e.g., {}, when they exist in extra_fields
    • Removes duplicate field display in Item
    • With the above fixed, we are able to uncomment the remaining html tests and improve coverage.
  • Formats:

    • Lowercase all fields. Was a mix of upper and lower before.
    • Use bbox in place of Bounding Box, type in place of Media Type, and href in place of Target for a 1:1 with the JSON fields.
    • Align field ordering between Asset and Link for consistency

PR Checklist:

  • Code is formatted (run pre-commit run --all-files)
  • Tests pass (run scripts/test)
  • Documentation has been updated to reflect changes, if applicable
  • This PR maintains or improves overall codebase code coverage.
  • Changes are added to the CHANGELOG. See the docs for information about adding to the changelog.

For comparison to the image in issue #955:
image

- this fixes the incorrect html and missing link targets
- bug caused by link.target's preference to return the resolved STAC object rather than the target href string
- consistent: all lowercase; prior was a mix of capitalized and uncapitalized
- match JSON: things like 'bbox' instead of 'bounding box' and 'type' instead of 'media type' for a 1:1 with the JSON
- addresses the extra_field 'properties' containing a blank dictionary
… titles

- reorder: basically, make field ordering more consistent between assets and links
- remove link heading: the existing link heading was only populated when a title existed, and, IMO, looked awkward. I moved the title to the heading to be consistent with the asset structure
- guard against missing titles: no longer display 'None' in the asset heading when there is no title
@pjhartzell pjhartzell marked this pull request as draft February 1, 2023 20:43
@pjhartzell pjhartzell changed the title Issues/955 invalid html Correct invalid html generated by _repr_html_() Feb 1, 2023
@pjhartzell pjhartzell marked this pull request as ready for review February 1, 2023 22:05
@pjhartzell pjhartzell requested a review from gadomski February 1, 2023 22:05
@codecov-commenter
Copy link

codecov-commenter commented Feb 1, 2023

Codecov Report

Base: 90.09% // Head: 90.21% // Increases project coverage by +0.11% 🎉

Coverage data is based on head (c918876) compared to base (b393b0d).
Patch has no changes to coverable lines.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #975      +/-   ##
==========================================
+ Coverage   90.09%   90.21%   +0.11%     
==========================================
  Files          47       47              
  Lines        6090     6090              
  Branches      915      915              
==========================================
+ Hits         5487     5494       +7     
+ Misses        422      414       -8     
- Partials      181      182       +1     
Impacted Files Coverage Δ
pystac/catalog.py 92.67% <0.00%> (+0.70%) ⬆️
pystac/collection.py 94.59% <0.00%> (+1.15%) ⬆️
pystac/html/jinja_env.py 100.00% <0.00%> (+8.33%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@pjhartzell pjhartzell self-assigned this Feb 1, 2023
@pjhartzell pjhartzell added this to the 1.7 milestone Feb 1, 2023
@pjhartzell pjhartzell merged commit 6e31149 into main Feb 2, 2023
@pjhartzell pjhartzell deleted the issues/955-invalid-html branch February 2, 2023 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid html from _repr_html_()
3 participants