Skip to content

Commit

Permalink
Refactor using SCSS. Now 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mksinicus committed Jan 28, 2023
1 parent 37c44e1 commit db51e3e
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 57 deletions.
57 changes: 0 additions & 57 deletions glossing.css

This file was deleted.

77 changes: 77 additions & 0 deletions glossing.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
%font-normalize {
font-style: normal;
font-weight: normal;
font-variant: none;
font-size: 1em;
}

$padding: .1em .4em;

@mixin quotes($lquot, $rquot) {
&::before {
content: $lquot;
}
&::after {
content: $rquot;
}
}

.glossing {
// Table cells doesn't break internally.
white-space: nowrap;

// Original text, usually right before the table for glossing.
// Not every `p`, because people may want to wrap the whole document inside.
.original p {
margin: 0;
padding: $padding;
text-indent: 0;
}

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

table, th, tr, td, caption, thead, tbody {
@extend %font-normalize;
margin: 0;
border: 0;
background: none;
text-align: left;
}

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

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

td, caption {
padding: $padding;
}

// Allow caption to span beyond max width of table contents.
// But you will need to break lines manually if needed.
caption {
caption-side: bottom;
white-space: nowrap;
overflow: visible;
}
&.s-quotes caption {
@include quotes("", "");
}
&.d-quotes caption {
@include quotes("", "");
}
}

0 comments on commit db51e3e

Please sign in to comment.