css._volume-breaking.scss Maven / Gradle / Ivy
The newest version!
/**
* Volume breaking
*/
/**
* @var integer $maximum-number-of-sheets
*
* @brief Maximum number of sheets per volume
*
* The maximum number of sheets in a volume.
*
* The following CSS rule is included by default (where `$maximum-number-of-sheets` is the value of
* this option):
*
* ~~~sass
* @volume {
* max-length: $maximum-number-of-sheets;
* }
* ~~~
*
* See the CSS specification for more info:
*
* - the [`@volume`](http://braillespecs.github.io/braille-css/#h3_the-volume-rule) rule
* - the [`max-length`](http://braillespecs.github.io/braille-css/#h3_the-length-properties) property
*/
$maximum-number-of-sheets: 70 !default;
@volume {
max-length: $maximum-number-of-sheets;
}
/**
* @var integer $allow-volume-break-inside-leaf-section-factor
*
* @brief Allow volume breaks within sections
*
* Amount with which volume breaks are allowed within sections.
*
* The value can range from 1 to 10. The lower the value, the more preference is given to volume breaks
* right before `section` elements. The higher the value, the more equal the volumes will be in
* size.
*/
$allow-volume-break-inside-leaf-section-factor: 10 !default;
// Allowing volume breaks within "leaf sections" means allowing a volume to be broken not
// right before a heading.
//
// A leaf section is a block of adjacent content with the same sectioning depth.
// Which means:
// - either; a section element with no child sections
// - or; the content in a section (,
, etc.), which may have section element siblings
//
// If a section contains other sections, then this style sheet wraps the normal content
// (
,
, etc.) in the section in a
element.
/**
* @var string $prefer-volume-break-before-higher-level-factor
*
* @brief Prefer breaks at higher level sections
*
* Amount with which preference is given to volume breaks before higher level sections.
*
* The value must be greater or equal to 0. It can be a non-integer. A value of 0 means no preference
* is given. A higher value results in volumes that are less equal in size.
*/
$prefer-volume-break-before-higher-level-factor: 0 !default;
// Depending on the value of $allow-volume-break-inside-leaf-section-factor,
// increasing $prefer-volume-break-before-higher-level-factor beyond a certain value does
// not have an effect anymore.
@if $allow-volume-break-inside-leaf-section-factor < 10 {
$min-volume-keep-priority: min(10, max(1, round($allow-volume-break-inside-leaf-section-factor)));
$duplex: true !default;
@xslt "volume-breaking.xsl" {
duplex: $duplex;
maximum-number-of-sheets: $maximum-number-of-sheets;
allow-volume-break-inside-leaf-section-factor: $allow-volume-break-inside-leaf-section-factor;
prefer-volume-break-before-higher-level-factor: $prefer-volume-break-before-higher-level-factor;
}
@if $min-volume-keep-priority < 10 {
section,
div.leaf-section {
volume-break-inside: -obfl-keep($min-volume-keep-priority);
}
@if $prefer-volume-break-before-higher-level-factor > 0 {
$level: 1;
$volume-keep-priority: min(10, max($min-volume-keep-priority, round(10 - $level * $prefer-volume-break-before-higher-level-factor)));
@if $volume-keep-priority > $min-volume-keep-priority {
section {
@if $volume-keep-priority < 10 {
&:has(> section, > div.leaf-section) {
volume-break-inside: -obfl-keep($volume-keep-priority);
}
}
$level: $level + 1;
$volume-keep-priority: min(10, max($min-volume-keep-priority, round(10 - $level * $prefer-volume-break-before-higher-level-factor)));
@if $volume-keep-priority > $min-volume-keep-priority {
& > section {
@if $volume-keep-priority < 10 {
&:has(> section, > div.leaf-section) {
volume-break-inside: -obfl-keep($volume-keep-priority);
}
}
$level: $level + 1;
$volume-keep-priority: min(10, max($min-volume-keep-priority, round(10 - $level * $prefer-volume-break-before-higher-level-factor)));
@if $volume-keep-priority > $min-volume-keep-priority {
& > section {
@if $volume-keep-priority < 10 {
&:has(> section, > div.leaf-section) {
volume-break-inside: -obfl-keep($volume-keep-priority);
}
}
$level: $level + 1;
$volume-keep-priority: min(10, max($min-volume-keep-priority, round(10 - $level * $prefer-volume-break-before-higher-level-factor)));
@if $volume-keep-priority > $min-volume-keep-priority {
& > section {
@if $volume-keep-priority < 10 {
&:has(> section, > div.leaf-section) {
volume-break-inside: -obfl-keep($volume-keep-priority);
}
}
$level: $level + 1;
$volume-keep-priority: min(10, max($min-volume-keep-priority, round(10 - $level * $prefer-volume-break-before-higher-level-factor)));
@if $volume-keep-priority > $min-volume-keep-priority {
& > section {
@if $volume-keep-priority < 10 {
&:has(> section, > div.leaf-section) {
volume-break-inside: -obfl-keep($volume-keep-priority);
}
}
$level: $level + 1;
$volume-keep-priority: min(10, max($min-volume-keep-priority, round(10 - $level * $prefer-volume-break-before-higher-level-factor)));
@if $volume-keep-priority > $min-volume-keep-priority {
& > section {
@if $volume-keep-priority < 10 {
&:has(> section, > div.leaf-section) {
volume-break-inside: -obfl-keep($volume-keep-priority);
}
}
$level: $level + 1;
$volume-keep-priority: min(10, max($min-volume-keep-priority, round(10 - $level * $prefer-volume-break-before-higher-level-factor)));
@if $volume-keep-priority > $min-volume-keep-priority {
& > section {
@if $volume-keep-priority < 10 {
&:has(> section, > div.leaf-section) {
volume-break-inside: -obfl-keep($volume-keep-priority);
}
}
$level: $level + 1;
$volume-keep-priority: min(10, max($min-volume-keep-priority, round(10 - $level * $prefer-volume-break-before-higher-level-factor)));
@if $volume-keep-priority > $min-volume-keep-priority {
& > section {
@if $volume-keep-priority < 10 {
&:has(> section, > div.leaf-section) {
volume-break-inside: -obfl-keep($volume-keep-priority);
}
}
$level: $level + 1;
$volume-keep-priority: min(10, max($min-volume-keep-priority, round(10 - $level * $prefer-volume-break-before-higher-level-factor)));
@if $volume-keep-priority > $min-volume-keep-priority {
& > section {
@if $volume-keep-priority < 10 {
&:has(> section, > div.leaf-section) {
volume-break-inside: -obfl-keep($volume-keep-priority);
}
}
$level: $level + 1;
$volume-keep-priority: min(10, max($min-volume-keep-priority, round(10 - $level * $prefer-volume-break-before-higher-level-factor)));
@if $volume-keep-priority > $min-volume-keep-priority {
& > section {
@if $volume-keep-priority < 10 {
&:has(> section, > div.leaf-section) {
volume-break-inside: -obfl-keep($volume-keep-priority);
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
// Avoid orphaned headlines.
//
// volume-breaking.xsl adds the "keep-with-next-section" class on small leaf
// sections.
.keep-with-next-section {
-obfl-keep-with-next-sheets: 1;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy