Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
999 changes: 621 additions & 378 deletions docs/quickstart.ipynb

Large diffs are not rendered by default.

2,488 changes: 1,610 additions & 878 deletions docs/tutorials/how-to-create-stac-catalogs.ipynb

Large diffs are not rendered by default.

3,538 changes: 1,918 additions & 1,620 deletions docs/tutorials/pystac-introduction.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pystac/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def _repr_html_(self) -> str:
jinja_env = get_jinja_env()
if jinja_env:
template = jinja_env.get_template("JSON.jinja2")
return str(template.render(dict=self.to_dict()))
return str(template.render(dict=self.to_dict(), plain=escape(repr(self))))
else:
return escape(repr(self))

Expand Down
16 changes: 14 additions & 2 deletions pystac/html/JSON.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,19 @@
color: rgb(0, 128, 0);
font-weight: 700;
}
.pystac-wrap {
display: block !important;
}
.pystac-text-repr-fallback {
/* fallback to plain text repr when CSS is not injected (untrusted notebook) */
display: none;
}
</style>
<div class="jp-RenderedJSON jp-mod-trusted jp-OutputArea-output">
<div>
<div class="pystac-text-repr-fallback">
{{ plain }}
</div>
<div class="jp-RenderedJSON jp-mod-trusted jp-OutputArea-output pystac-wrap" style='display:none'>
<div class="container" style="line-height: normal;">
<ul style="padding: 0px; margin: 0px; list-style: none; display: block;">
{% for key, value in dict.items() %}
Expand All @@ -42,4 +53,5 @@
{% endfor %}
</ul>
</div>
</div>
</div>
</div>
2 changes: 1 addition & 1 deletion pystac/item_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def _repr_html_(self) -> str:
jinja_env = get_jinja_env()
if jinja_env:
template = jinja_env.get_template("JSON.jinja2")
return str(template.render(dict=self.to_dict()))
return str(template.render(dict=self.to_dict(), plain=escape(repr(self))))
else:
return escape(repr(self))

Expand Down
6 changes: 5 additions & 1 deletion pystac/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,11 @@ def _repr_html_(self) -> str:
jinja_env = get_jinja_env()
if jinja_env:
template = jinja_env.get_template("JSON.jinja2")
return str(template.render(dict=self.to_dict()))
return str(
template.render(
dict=self.to_dict(transform_href=False), plain=escape(repr(self))
)
)
else:
return escape(repr(self))

Expand Down
2 changes: 1 addition & 1 deletion pystac/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def _repr_html_(self) -> str:
jinja_env = get_jinja_env()
if jinja_env:
template = jinja_env.get_template("JSON.jinja2")
return str(template.render(dict=self.to_dict()))
return str(template.render(dict=self.to_dict(), plain=escape(repr(self))))
else:
return escape(repr(self))

Expand Down
6 changes: 5 additions & 1 deletion pystac/stac_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,11 @@ def _repr_html_(self) -> str:
jinja_env = get_jinja_env()
if jinja_env:
template = jinja_env.get_template("JSON.jinja2")
return str(template.render(dict=self.to_dict(transform_hrefs=False)))
return str(
template.render(
dict=self.to_dict(transform_hrefs=False), plain=escape(repr(self))
)
)
else:
return escape(repr(self))

Expand Down
Loading