mirror of
https://github.com/typst/typst
synced 2025-06-29 16:52:53 +08:00
Documentation fixes
This commit is contained in:
parent
998a3c44fd
commit
8ac7be95e6
@ -331,11 +331,8 @@ impl FigureElem {
|
|||||||
.cloned()
|
.cloned()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Builds the supplement and numbering of the figure.
|
/// Builds the supplement and numbering of the figure. Returns [`None`] if
|
||||||
/// If there is no numbering, returns [`None`].
|
/// there is no numbering.
|
||||||
///
|
|
||||||
/// # Errors
|
|
||||||
/// If a numbering is specified but the [`Self::data()`] is `None`.
|
|
||||||
pub fn show_supplement_and_numbering(
|
pub fn show_supplement_and_numbering(
|
||||||
&self,
|
&self,
|
||||||
vt: &mut Vt,
|
vt: &mut Vt,
|
||||||
@ -364,11 +361,8 @@ impl FigureElem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Builds the caption for the figure.
|
/// Builds the caption for the figure. If there is a numbering, will also
|
||||||
/// If there is a numbering, will also try to show the supplement and the numbering.
|
/// try to show the supplement and the numbering.
|
||||||
///
|
|
||||||
/// # Errors
|
|
||||||
/// If a numbering is specified but the [`Self::element`] is `None`.
|
|
||||||
pub fn show_caption(&self, vt: &mut Vt) -> SourceResult<Content> {
|
pub fn show_caption(&self, vt: &mut Vt) -> SourceResult<Content> {
|
||||||
let Some(mut caption) = self.caption(StyleChain::default()) else {
|
let Some(mut caption) = self.caption(StyleChain::default()) else {
|
||||||
return Ok(Content::empty());
|
return Ok(Content::empty());
|
||||||
|
@ -245,10 +245,9 @@ cast_to_value! {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Marks an element as being able to be referenced.
|
/// Marks an element as being able to be referenced. This is used to implement
|
||||||
/// This is used to implement the `@ref` macro.
|
/// the `@ref` element. It is expected to build the [`Content`] that gets linked
|
||||||
/// It is expected to build the [`Content`] that gets linked
|
/// by the [`RefElem`].
|
||||||
/// by the [`RefElement`].
|
|
||||||
pub trait Refable {
|
pub trait Refable {
|
||||||
/// Tries to build a reference content for this element.
|
/// Tries to build a reference content for this element.
|
||||||
///
|
///
|
||||||
|
@ -90,7 +90,7 @@ impl ShapedGlyph {
|
|||||||
matches!(self.c.script(), Hiragana | Katakana | Han) || self.c == '\u{30FC}'
|
matches!(self.c.script(), Hiragana | Katakana | Han) || self.c == '\u{30FC}'
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See https://www.w3.org/TR/clreq/#punctuation_width_adjustment
|
/// See <https://www.w3.org/TR/clreq/#punctuation_width_adjustment>
|
||||||
pub fn is_cjk_left_aligned_punctuation(&self) -> bool {
|
pub fn is_cjk_left_aligned_punctuation(&self) -> bool {
|
||||||
// CJK quotation marks shares codepoints with latin quotation marks.
|
// CJK quotation marks shares codepoints with latin quotation marks.
|
||||||
// But only the CJK ones have full width.
|
// But only the CJK ones have full width.
|
||||||
@ -101,7 +101,7 @@ impl ShapedGlyph {
|
|||||||
matches!(self.c, ',' | '。' | '、' | ':' | ';' | '》' | ')' | '』' | '」')
|
matches!(self.c, ',' | '。' | '、' | ':' | ';' | '》' | ')' | '』' | '」')
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See https://www.w3.org/TR/clreq/#punctuation_width_adjustment
|
/// See <https://www.w3.org/TR/clreq/#punctuation_width_adjustment>
|
||||||
pub fn is_cjk_right_aligned_punctuation(&self) -> bool {
|
pub fn is_cjk_right_aligned_punctuation(&self) -> bool {
|
||||||
// CJK quotation marks shares codepoints with latin quotation marks.
|
// CJK quotation marks shares codepoints with latin quotation marks.
|
||||||
// But only the CJK ones have full width.
|
// But only the CJK ones have full width.
|
||||||
|
@ -405,8 +405,10 @@ cast_from_value! {
|
|||||||
location: Location => Self::Location(location),
|
location: Location => Self::Location(location),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A selector that can be used with `query`. Hopefully, this is made obsolete
|
/// A selector that can be used with `query`.
|
||||||
/// by a more powerful query mechanism in the future.
|
///
|
||||||
|
/// Hopefully, this is made obsolete by a more powerful query mechanism in the
|
||||||
|
/// future.
|
||||||
#[derive(Clone, PartialEq, Hash)]
|
#[derive(Clone, PartialEq, Hash)]
|
||||||
pub struct LocatableSelector(pub Selector);
|
pub struct LocatableSelector(pub Selector);
|
||||||
|
|
||||||
@ -462,6 +464,9 @@ impl Cast for LocatableSelector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A selector that can be used with show rules.
|
/// A selector that can be used with show rules.
|
||||||
|
///
|
||||||
|
/// Hopefully, this is made obsolete by a more powerful showing mechanism in the
|
||||||
|
/// future.
|
||||||
#[derive(Clone, PartialEq, Hash)]
|
#[derive(Clone, PartialEq, Hash)]
|
||||||
pub struct ShowableSelector(pub Selector);
|
pub struct ShowableSelector(pub Selector);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user