Skip to content

Commit

Permalink
Update project description for HTML5 CSS (pypi#12080)
Browse files Browse the repository at this point in the history
* feat: render inline literals as code

Docutils HTML5 writer has decided that the emitted style for inline
literals will no longer inherit the (deprecated) `tt` style, rather
place the onus on the author to declare what kind of style to apply to a
literal.

Refs: https://sourceforge.net/p/docutils/bugs/393/

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

* fix: reduce margins included in table cells

docutils HTML5 writer adds `<p>` tags to cells in tables, adding
margins, and bloating the overall size.

Docutils has an inline TODO, contemplating removing this behavior:
https://sourceforge.net/p/docutils/code/HEAD/tree/tags/docutils-0.19/docutils/writers/_html_base.py#l1381

Until such time, inherit the same margins for the `th/td` attributes.

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

* feat: render description lists as grid items

Docutils HTML5 changes the output for lists like `docinfo` and
`field-list` to no longer have `table` semantics, preferring to lean on
CSS to place and style them.

This isn't 100% the same as before, but it's close enough for a
reasonable display.

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
Co-authored-by: Dustin Ingram <di@users.noreply.github.com>
  • Loading branch information
miketheman and di committed Aug 15, 2022
1 parent 045f97b commit 665eb50
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
3 changes: 2 additions & 1 deletion warehouse/static/sass/base/_typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ code,
kbd,
pre,
samp,
tt {
tt,
.docutils.literal {
font-family: $code-font;
background-color: lighten($base-grey, 5);
border: 1px solid $border-color;
Expand Down
22 changes: 22 additions & 0 deletions warehouse/static/sass/blocks/_project-description.scss
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,24 @@
dl {
margin: ($spacing-unit / 2) 0 0 0;

&.docinfo,
&.field-list {
display: grid;
grid-template-columns: max-content auto;

dt {
grid-column-start: 1;

&:first-of-type {
margin-top: ($spacing-unit / 2); // override inherited _lists.scss
}
}

dd {
grid-column-start: 2;
}
}

dt {
font-weight: $bold-font-weight;
}
Expand Down Expand Up @@ -177,6 +195,10 @@
border: 0;
padding: 10px 7px;
border-right: 1px solid $border-color;

p {
margin: inherit;
}
}

thead tr {
Expand Down

0 comments on commit 665eb50

Please sign in to comment.