summaryrefslogtreecommitdiff
path: root/library/src/text
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-05-17 14:41:46 +0200
committerLaurenz <laurmaedje@gmail.com>2023-05-17 14:41:46 +0200
commit551ea99d05166b0be50792f767ddd38b996e32fa (patch)
treeec5e86a087e79e8c181c7d4b904216a775227e2d /library/src/text
parent46aace78ac4ac1c075b9b1670dbb7372df1a0a82 (diff)
Show default values in documentation
Fixes #169 Fixes #1102
Diffstat (limited to 'library/src/text')
-rw-r--r--library/src/text/deco.rs21
-rw-r--r--library/src/text/mod.rs6
2 files changed, 20 insertions, 7 deletions
diff --git a/library/src/text/deco.rs b/library/src/text/deco.rs
index 9bc52b61..cfb06956 100644
--- a/library/src/text/deco.rs
+++ b/library/src/text/deco.rs
@@ -15,8 +15,11 @@ use crate::prelude::*;
/// Category: text
#[element(Show)]
pub struct UnderlineElem {
- /// How to stroke the line. The text color and thickness are read from the
- /// font tables if `{auto}`.
+ /// How to stroke the line.
+ ///
+ /// See the [line's documentation]($func/line.stroke) for more details. If
+ /// set to `{auto}`, takes on the text's color and a thickness defined in
+ /// the current font.
///
/// ```example
/// Take #underline(
@@ -89,8 +92,11 @@ impl Show for UnderlineElem {
/// Category: text
#[element(Show)]
pub struct OverlineElem {
- /// How to stroke the line. The text color and thickness are read from the
- /// font tables if `{auto}`.
+ /// How to stroke the line.
+ ///
+ /// See the [line's documentation]($func/line.stroke) for more details. If
+ /// set to `{auto}`, takes on the text's color and a thickness defined in
+ /// the current font.
///
/// ```example
/// #set text(fill: olive)
@@ -169,8 +175,11 @@ impl Show for OverlineElem {
/// Category: text
#[element(Show)]
pub struct StrikeElem {
- /// How to stroke the line. The text color and thickness are read from the
- /// font tables if `{auto}`.
+ /// How to stroke the line.
+ ///
+ /// See the [line's documentation]($func/line.stroke) for more details. If
+ /// set to `{auto}`, takes on the text's color and a thickness defined in
+ /// the current font.
///
/// _Note:_ Please don't use this for real redaction as you can still
/// copy paste the text.
diff --git a/library/src/text/mod.rs b/library/src/text/mod.rs
index a7cf4fd7..6e3f1acf 100644
--- a/library/src/text/mod.rs
+++ b/library/src/text/mod.rs
@@ -573,7 +573,11 @@ cast_from_value! {
}
cast_to_value! {
- v: FontList => v.0.into()
+ v: FontList => if v.0.len() == 1 {
+ v.0.into_iter().next().unwrap().0.into()
+ } else {
+ v.0.into()
+ }
}
/// The size of text.