summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2020-11-24 16:12:41 +0100
committerLaurenz <laurmaedje@gmail.com>2020-11-24 16:12:41 +0100
commit761931405c68efe0a35d96524df797dda7155723 (patch)
tree31ac2153dc0e5a5dc4fb4f46f839caed8066542a /src
parentf105663037c44740b5aa02dea72a9b368bc003e0 (diff)
Use newly stabilized intra doc links ↩
Diffstat (limited to 'src')
-rw-r--r--src/diag.rs12
-rw-r--r--src/eval/args.rs4
-rw-r--r--src/eval/convert.rs5
-rw-r--r--src/eval/mod.rs13
-rw-r--r--src/eval/value.rs1
-rw-r--r--src/export/pdf.rs3
-rw-r--r--src/geom/relative.rs4
-rw-r--r--src/layout/document.rs4
-rw-r--r--src/layout/mod.rs4
-rw-r--r--src/layout/node.rs3
-rw-r--r--src/layout/spacing.rs4
-rw-r--r--src/lib.rs24
-rw-r--r--src/shaping.rs2
-rw-r--r--src/syntax/lit.rs4
-rw-r--r--src/syntax/token.rs4
15 files changed, 25 insertions, 66 deletions
diff --git a/src/diag.rs b/src/diag.rs
index 9f109be9..c3bef75e 100644
--- a/src/diag.rs
+++ b/src/diag.rs
@@ -7,9 +7,7 @@
use crate::syntax::SpanVec;
use std::fmt::{self, Display, Formatter};
-/// The result of some pass: Some output `T` and [feedback] data.
-///
-/// [feedback]: struct.Feedback.html
+/// The result of some pass: Some output `T` and [`Feedback`] data.
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct Pass<T> {
/// The output of this compilation pass.
@@ -118,7 +116,7 @@ pub enum Deco {
DictKey,
}
-/// Construct a diagnostic with [`Error`] level.
+/// Construct a diagnostic with [`Error`](Level::Error) level.
///
/// ```
/// # use typst::error;
@@ -131,8 +129,6 @@ pub enum Deco {
/// // Create spanned errors.
/// let spanned = error!(span, "there is an error here");
/// ```
-///
-/// [`Error`]: diag/enum.Level.html#variant.Error
#[macro_export]
macro_rules! error {
($($tts:tt)*) => {
@@ -140,12 +136,10 @@ macro_rules! error {
};
}
-/// Construct a diagnostic with [`Warning`] level.
+/// Construct a diagnostic with [`Warning`](Level::Warning) level.
///
/// This works exactly like `error!`. See its documentation for more
/// information.
-///
-/// [`Warning`]: diag/enum.Level.html#variant.Warning
#[macro_export]
macro_rules! warning {
($($tts:tt)*) => {
diff --git a/src/eval/args.rs b/src/eval/args.rs
index dda6fedf..e9bf378b 100644
--- a/src/eval/args.rs
+++ b/src/eval/args.rs
@@ -28,10 +28,8 @@ impl Args {
})
}
- /// This is the same as [`get`], except that it generates an error about a
+ /// This is the same as [`get`](Self::get), except that it generates an error about a
/// missing argument with the given `name` if the key does not exist.
- ///
- /// [`get`]: #method.get
pub fn need<'a, K, T>(
&mut self,
ctx: &mut EvalContext,
diff --git a/src/eval/convert.rs b/src/eval/convert.rs
index 4885b72f..81e42694 100644
--- a/src/eval/convert.rs
+++ b/src/eval/convert.rs
@@ -85,10 +85,7 @@ macro_rules! convert_ident {
};
}
-/// A value type that matches [identifier] and [string] values.
-///
-/// [identifier]: enum.Value.html#variant.Ident
-/// [string]: enum.Value.html#variant.Str
+/// A value type that matches [identifier](Value::Ident) and [string](Value::Str) values.
pub struct StringLike(pub String);
impl From<StringLike> for String {
diff --git a/src/eval/mod.rs b/src/eval/mod.rs
index 5a8b857a..c45e46ae 100644
--- a/src/eval/mod.rs
+++ b/src/eval/mod.rs
@@ -91,8 +91,6 @@ impl EvalContext {
/// Push a layout node to the active group.
///
/// Spacing nodes will be handled according to their [`Softness`].
- ///
- /// [`Softness`]: ../layout/nodes/enum.Softness.html
pub fn push(&mut self, node: impl Into<LayoutNode>) {
let node = node.into();
@@ -196,21 +194,16 @@ impl EvalContext {
/// Start a layouting group.
///
- /// All further calls to [`push`] will collect nodes for this group.
+ /// All further calls to [`push`](Self::push) will collect nodes for this group.
/// The given metadata will be returned alongside the collected nodes
- /// in a matching call to [`end_group`].
- ///
- /// [`push`]: #method.push
- /// [`end_group`]: #method.end_group
+ /// in a matching call to [`end_group`](Self::end_group).
fn start_group<T: 'static>(&mut self, meta: T) {
self.groups.push((Box::new(meta), std::mem::take(&mut self.inner)));
}
- /// End a layouting group started with [`start_group`].
+ /// End a layouting group started with [`start_group`](Self::start_group).
///
/// This returns the stored metadata and the collected nodes.
- ///
- /// [`start_group`]: #method.start_group
fn end_group<T: 'static>(&mut self) -> (T, Vec<LayoutNode>) {
if let Some(&LayoutNode::Spacing(spacing)) = self.inner.last() {
if spacing.softness == Softness::Soft {
diff --git a/src/eval/value.rs b/src/eval/value.rs
index c6850f43..e897fa75 100644
--- a/src/eval/value.rs
+++ b/src/eval/value.rs
@@ -134,7 +134,6 @@ pub type ValueDict = Dict<SpannedEntry<Value>>;
/// [`Value`] when directly putting the `Rc` in there, see the [Rust
/// Issue].
///
-/// [`Value`]: enum.Value.html
/// [Rust Issue]: https://github.com/rust-lang/rust/issues/31740
#[derive(Clone)]
pub struct ValueFunc(pub Rc<Func>);
diff --git a/src/export/pdf.rs b/src/export/pdf.rs
index cb05dee0..c5d8d871 100644
--- a/src/export/pdf.rs
+++ b/src/export/pdf.rs
@@ -18,8 +18,7 @@ use crate::layout::{BoxLayout, LayoutElement};
/// pass in the font loader used for typesetting such that the fonts can be
/// included in the _PDF_.
///
-/// The raw _PDF_ is written into the `target` writable, returning the number of
-/// bytes written.
+/// Returns the raw bytes making up the _PDF_ document.
pub fn export(layouts: &[BoxLayout], loader: &FontLoader) -> Vec<u8> {
PdfExporter::new(layouts, loader).write()
}
diff --git a/src/geom/relative.rs b/src/geom/relative.rs
index d87cfac7..ce473e3d 100644
--- a/src/geom/relative.rs
+++ b/src/geom/relative.rs
@@ -3,9 +3,7 @@ use super::*;
/// A relative length.
///
/// _Note_: `50%` is represented as `0.5` here, but stored as `50.0` in the
-/// corresponding [literal].
-///
-/// [literal]: ../syntax/ast/enum.Lit.html#variant.Percent
+/// corresponding [literal](crate::syntax::Lit::Percent).
#[derive(Default, Copy, Clone, PartialEq, PartialOrd)]
pub struct Relative(f64);
diff --git a/src/layout/document.rs b/src/layout/document.rs
index 52d0d124..112457d6 100644
--- a/src/layout/document.rs
+++ b/src/layout/document.rs
@@ -23,9 +23,7 @@ impl Document {
pub struct Pages {
/// The size of the pages.
pub size: Size,
- /// The layout node that produces the actual pages (typically a [stack]).
- ///
- /// [stack]: struct.Stack.html
+ /// The layout node that produces the actual pages (typically a [`Stack`]).
pub child: LayoutNode,
}
diff --git a/src/layout/mod.rs b/src/layout/mod.rs
index 5586a1fd..2d4553b4 100644
--- a/src/layout/mod.rs
+++ b/src/layout/mod.rs
@@ -124,9 +124,7 @@ impl Expansion {
}
}
-/// The result of [layouting] a node.
-///
-/// [layouting]: trait.Layout.html#method.layout
+/// The result of [layouting](Layout::layout) a node.
#[derive(Debug, Clone, PartialEq)]
pub enum Layouted {
/// Spacing that should be added to the parent.
diff --git a/src/layout/node.rs b/src/layout/node.rs
index 6b264eb0..35e742a5 100644
--- a/src/layout/node.rs
+++ b/src/layout/node.rs
@@ -50,7 +50,6 @@ impl Debug for LayoutNode {
/// [`LayoutNode`] when directly putting the `Box` in there, see the
/// [Rust Issue].
///
-/// [`LayoutNode`]: enum.LayoutNode.html
/// [Rust Issue]: https://github.com/rust-lang/rust/issues/31740
pub struct Dynamic(pub Box<dyn DynNode>);
@@ -102,8 +101,6 @@ impl PartialEq for Dynamic {
/// DynNode>` able to implement `Clone` and `PartialEq`. However, these are
/// automatically provided by a blanket impl as long as the type in question
/// implements[`Layout`], `Debug`, `PartialEq`, `Clone` and is `'static`.
-///
-/// [`Layout`]: ../trait.Layout.html
pub trait DynNode: Debug + Layout + 'static {
/// Convert into a `dyn Any` to enable downcasting.
fn as_any(&self) -> &dyn Any;
diff --git a/src/layout/spacing.rs b/src/layout/spacing.rs
index c44f92e4..1ba3b54a 100644
--- a/src/layout/spacing.rs
+++ b/src/layout/spacing.rs
@@ -7,10 +7,8 @@ use super::*;
pub struct Spacing {
/// The amount of spacing to insert.
pub amount: Length,
- /// Spacing interaction, see [Softness's] documentation for more
+ /// Spacing interaction, see [`Softness`]'s documentation for more
/// information.
- ///
- /// [Softness's]: enum.Softness.html
pub softness: Softness,
}
diff --git a/src/lib.rs b/src/lib.rs
index a4e0ef3f..7d54da4c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -3,30 +3,26 @@
//! # Steps
//! - **Parsing:** The parsing step first transforms a plain string into an
//! [iterator of tokens][tokens]. This token stream is [parsed] into a [syntax
-//! tree]. The structures describing the tree can be found in the [AST]
+//! tree]. The structures describing the tree can be found in the [syntax]
//! module.
//! - **Evaluation:** The next step is to [evaluate] the parsed "script" to a
-//! [document], a high-level, fully styled representation. The [nodes] of the
+//! [document], a high-level, fully styled representation. The nodes of the
//! document tree are fully self-contained and order-independent and thus much
//! better suited for layouting than the syntax tree.
//! - **Layouting:** The next step is to [layout] the document into a portable
//! version of the typeset document. The output of this is a vector of
-//! [`BoxLayouts`] (corresponding to pages), ready for exporting.
+//! [`BoxLayout`]s (corresponding to pages), ready for exporting.
//! - **Exporting:** The finished layout can be exported into a supported
//! format. Submodules for these formats are located in the [export] module.
//! Currently, the only supported output format is [_PDF_].
//!
-//! [tokens]: parse/struct.Tokens.html
-//! [parsed]: parse/fn.parse.html
-//! [syntax tree]: syntax/ast/type.SynTree.html
-//! [AST]: syntax/ast/index.html
-//! [evaluate]: eval/fn.eval.html
-//! [document]: layout/nodes/struct.Document.html
-//! [nodes]: layout/nodes/index.html
-//! [layout]: layout/fn.layout.html
-//! [`BoxLayouts`]: layout/struct.BoxLayout.html
-//! [export]: export/index.html
-//! [_PDF_]: export/pdf/index.html
+//! [tokens]: parse::Tokens
+//! [parsed]: parse::parse
+//! [syntax tree]: syntax::SynTree
+//! [evaluate]: eval::eval
+//! [document]: layout::Document
+//! [layout]: layout::layout
+//! [_PDF_]: export::pdf
#[macro_use]
pub mod diag;
diff --git a/src/shaping.rs b/src/shaping.rs
index 45ab6ff8..efc24d07 100644
--- a/src/shaping.rs
+++ b/src/shaping.rs
@@ -59,8 +59,6 @@ impl Debug for Shaped {
}
/// Shape text into a box containing [`Shaped`] runs.
-///
-/// [`Shaped`]: struct.Shaped.html
pub fn shape(
loader: &mut FontLoader,
text: &str,
diff --git a/src/syntax/lit.rs b/src/syntax/lit.rs
index 40b360da..e8647965 100644
--- a/src/syntax/lit.rs
+++ b/src/syntax/lit.rs
@@ -21,9 +21,7 @@ pub enum Lit {
/// A percent literal: `50%`.
///
/// _Note_: `50%` is stored as `50.0` here, but as `0.5` in the
- /// corresponding [value].
- ///
- /// [value]: ../../geom/struct.Relative.html
+ /// corresponding [value](crate::geom::Relative).
Percent(f64),
/// A color literal: `#ffccee`.
Color(RgbaColor),
diff --git a/src/syntax/token.rs b/src/syntax/token.rs
index 5b055e39..e630c50c 100644
--- a/src/syntax/token.rs
+++ b/src/syntax/token.rs
@@ -76,9 +76,7 @@ pub enum Token<'s> {
/// A percentage: `50%`.
///
/// _Note_: `50%` is stored as `50.0` here, as in the corresponding
- /// [literal].
- ///
- /// [literal]: ../ast/enum.Lit.html#variant.Percent
+ /// [literal](super::Lit::Percent).
Percent(f64),
/// A hex value: `#20d82a`.
Hex(&'s str),