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

Minimize css a bit and make it better at overriding jupyter defaults #1311

Merged
merged 1 commit into from
Feb 21, 2024
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
28 changes: 22 additions & 6 deletions pystac/html/JSON.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 3,32 @@
<style>
.pystac-summary {
cursor: pointer;
display:list-item;
display: list-item;
list-style: revert;
margin-bottom: 0 !important;

.pystac-l {
padding-left: 0.5em;
color: rgb(64, 128, 128);
font-style: italic;
}
}
.pystac-row {
overflow-wrap: break-word;
padding-left: .825em;

.pystac-k {
display: inline-block;
margin: 0px 0.5em 0px 0px;
}
.pystac-v {
color: rgb(186, 33, 33);
}
}
.pystac-key {
.pystac-k {
color: rgb(0, 128, 0);
font-weight: 700;
}
.pystac-key-value {
display: inline-block;
margin: 0px 0.5em 0px 0px;
}
</style>
<div class="jp-RenderedJSON jp-mod-trusted jp-OutputArea-output">
<div class="container" style="line-height: normal;">
Expand Down
13 changes: 5 additions & 8 deletions pystac/html/Macros.jinja2
Original file line number Diff line number Diff line change
@@ -1,23 1,20 @@
{% macro scalar(key, value) -%}
{% if value is mapping %}
<li><details>
<summary class="pystac-summary"><span class="pystac-key">{{ key }}</span></summary>
<summary class="pystac-summary"><span class="pystac-k">{{ key }}</span></summary>
{{ dict(value) }}
</details></li>
{% else %}
<li style="overflow-wrap: break-word; padding-left: 2.125em; text-indent: -0.5em;">
<span class="pystac-key pystac-key-value">{{ key }}</span>
<span style="color: rgb(186, 33, 33);">{% if value is string %}"{{ value }}"{% else %}{{ value }}{% endif %}</span>
<li class="pystac-row">
<span class="pystac-k">{{ key }}</span>
<span class="pystac-v">{% if value is string %}"{{ value }}"{% else %}{{ value }}{% endif %}</span>
</li>
{% endif %}
{%- endmacro %}

{% macro list(key, value) -%}
<li><details>
<summary class="pystac-summary">
<span class="pystac-key">{{ key }}</span>
<span style="padding-left: 0.5em; color: rgb(64, 128, 128); font-style: italic;">[] {{ value|length }} items</span>
</summary>
<summary class="pystac-summary"><span class="pystac-k">{{ key }}</span><span class="pystac-l">[] {{ value|length }} items</span></summary>
{% for item in value %}
{{ dict({loop.index - 1: item}) }}
{% endfor %}
Expand Down