Skip to content

Invalid html from _repr_html_() #955

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

Closed
pjhartzell opened this issue Jan 18, 2023 · 0 comments · Fixed by #975
Closed

Invalid html from _repr_html_() #955

pjhartzell opened this issue Jan 18, 2023 · 0 comments · Fixed by #975
Assignees
Labels
bug Things which are broken
Milestone

Comments

@pjhartzell
Copy link
Collaborator

When viewing the html generated by the _repr_html() method of a Collection or Catalog (e.g., in a notebook or browser), there are missing Target fields in some of the links. This appears to be due to invalid html. For example, something like this in a notebook...

import pystac
pystac.Collection.from_file("data-files/catalogs/test-case-1/country-1/area-1-1/collection.json")

...will be missing some Link Target values:

Screen Shot 2023-01-18 at 9 25 04 AM

Looking at the html for that first circled link...

        <table style="width: 100%; text-align: left;">
            <tr><td style="text-align: left;"><strong>Rel:</strong> root </td></tr>
            <tr><td style="text-align: left;"><strong>Target:</strong> <Catalog id=test> </td></tr>
            
                <tr><td style="text-align: left;"><strong>Media Type:</strong> application/json </td></tr>
            
            
        </table>

...the problem seems to be the invalid tag: <Catalog id=test>. I think the link address should replace the tag.


There are a few other minor items that could be included in a fix for this issue

  1. Not all field titles, e.g., the Collection ID in the example above, are in bold font.
  2. Might be worth adding <!DOCTYPE html> and enclosing the content in <html></html> tags.
@pjhartzell pjhartzell mentioned this issue Jan 18, 2023
5 tasks
@gadomski gadomski added the bug Things which are broken label Jan 18, 2023
pjhartzell added a commit that referenced this issue Jan 18, 2023
* Switches from unittest to pytest.

* Adds pytest parametrizations in place of for loops and subTests.

* The tests directory was removed from the coverage measurement to better represent the pystac code coverage. This results in a lower coverage percentage, so the benchmark (fail_under) was lowered from 94% to 90%.

* Adds tests for the html module to get coverage over 90%. In so doing, issue #955 was revealed. Once resolved, a more complete test of the module can be implemented.
@gadomski gadomski added this to the 1.7 milestone Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Things which are broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants