Skip to content

Commit

Permalink
Varius fixes, and update README
Browse files Browse the repository at this point in the history
  • Loading branch information
mksinicus committed Jun 3, 2024
1 parent 35778f0 commit cfa4fc1
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 16 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ sass glossing.scss | cleancss -O2 > glossing.min.css

## Usage

Simply [download](https://github.com/mksinicus/glossing.css/releases/latest)
and include it in your HTML document with `<link rel="stylesheet" href="path/to/glossing.min.css">`.
Simply include the [minimized CSS file](./glossing.min.css) in your HTML document with `<link rel="stylesheet" href="path/to/glossing.min.css">`.

- `.glossing > .original` is where you place the original sentence for
glossing. Paragraph margins and paddings will fit with the glossing part.
Expand Down
2 changes: 1 addition & 1 deletion glossing.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

61 changes: 48 additions & 13 deletions glossing.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%font-normalize {
color: inherit;
font-style: normal;
font-weight: normal;
font-variant: none;
Expand All @@ -11,12 +12,18 @@ $padding: .1em .4em;
&::before {
content: $lquot;
}

&::after {
content: $rquot;
}
}

.glossing {
margin {
top: 0;
bottom: 1rem;
}

// Original text, usually right before the table for glossing.
// Not every `p`, because people may want to wrap the whole document inside.
.original p {
Expand All @@ -26,51 +33,79 @@ $padding: .1em .4em;
}

// Use `strong`, or alternatively `.abbr`. Semantically sensible to me.
strong, .abbr {
strong,
.abbr {
@extend %font-normalize;
text-decoration: none;
background: none;
font-variant: small-caps;
}

table, th, tr, td, caption, thead, tbody {
table {
width: auto;
}

table,
th,
tr,
td,
caption,
thead,
tbody {
@extend %font-normalize;
// Table cells don't break internally.
white-space: nowrap;
margin: 0;
border: 0;
background: none;
text-align: left;
line-height: 1.4em;
line-height: 1.5em;
}

// Text in the first row are expected to have been split by morpheme
tr:nth-child(1) td {
font-style: italic;
}
&.no-italic tr:nth-child(1) {
// Text in the first row are expected to have been split by morpheme
// tr:nth-child(1) td {
// font-style: italic;
// }
&.no-italic tr:nth-child(1) td {
font-style: normal;
}

// The line with glossings are usually smaller
tr:nth-child(2) {
font-size: .9em;
&:not(.normal) {
tr:nth-child(2) {
font-size: .9em;
}

tr:nth-child(1) td {
font-style: italic;
}
}

td, caption {
td,
caption {
padding: $padding;

&:first-child {
padding-left: 0;
}

&:last-child {
padding-right: 0;
}
}

// Allow caption to span beyond max width of table contents.
// But you will need to break lines manually if needed.
caption {
caption-side: bottom;
overflow: visible;
}

&.s-quotes caption {
@include quotes("", "");
}

&.d-quotes caption {
@include quotes("", "");
}
}
}

0 comments on commit cfa4fc1

Please sign in to comment.