From eca819a06523d0ab94c556cd7366f730c5003e44 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Mon, 6 May 2024 14:17:30 +0700 Subject: [PATCH] docs: Fix and improve Markdown usage (#355) --- fluent-bundle/src/bundle.rs | 2 +- fluent-bundle/src/memoizer.rs | 4 ++-- fluent-bundle/src/resolver/scope.rs | 2 +- fluent-bundle/src/types/mod.rs | 6 +++--- fluent-fallback/examples/simple-fallback.rs | 2 +- fluent-resmgr/src/resource_manager.rs | 2 +- fluent-syntax/src/ast/mod.rs | 2 +- fluent-syntax/tests/serializer_fixtures.rs | 6 +++--- fluent/src/lib.rs | 2 +- intl-memoizer/src/lib.rs | 8 ++++---- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/fluent-bundle/src/bundle.rs b/fluent-bundle/src/bundle.rs index 1e2a8bd7..d198004d 100644 --- a/fluent-bundle/src/bundle.rs +++ b/fluent-bundle/src/bundle.rs @@ -556,7 +556,7 @@ impl Default for FluentBundle { } impl FluentBundle { - /// Constructs a FluentBundle. The first element in `locales` should be the + /// Constructs a `FluentBundle`. The first element in `locales` should be the /// language this bundle represents, and will be used to determine the /// correct plural rules for this bundle. You can optionally provide extra /// languages in the list; they will be used as fallback date and time diff --git a/fluent-bundle/src/memoizer.rs b/fluent-bundle/src/memoizer.rs index 1d6d4918..1f03e308 100644 --- a/fluent-bundle/src/memoizer.rs +++ b/fluent-bundle/src/memoizer.rs @@ -2,14 +2,14 @@ use crate::types::FluentType; use intl_memoizer::Memoizable; use unic_langid::LanguageIdentifier; -/// This trait contains thread-safe methods which extend [intl_memoizer::IntlLangMemoizer]. +/// This trait contains thread-safe methods which extend [`intl_memoizer::IntlLangMemoizer`]. /// It is used as the generic bound in this crate when a memoizer is needed. pub trait MemoizerKind: 'static { fn new(lang: LanguageIdentifier) -> Self where Self: Sized; - /// A threadsafe variant of `with_try_get` from [intl_memoizer::IntlLangMemoizer]. + /// A threadsafe variant of `with_try_get` from [`intl_memoizer::IntlLangMemoizer`]. /// The generics enforce that `Self` and its arguments are actually threadsafe. /// /// `I` - The [Memoizable](intl_memoizer::Memoizable) internationalization formatter. diff --git a/fluent-bundle/src/resolver/scope.rs b/fluent-bundle/src/resolver/scope.rs index 8630ff5b..1ddff1a4 100644 --- a/fluent-bundle/src/resolver/scope.rs +++ b/fluent-bundle/src/resolver/scope.rs @@ -50,7 +50,7 @@ impl<'bundle, 'ast, 'args, 'errors, R, M> Scope<'bundle, 'ast, 'args, 'errors, R } /// This method allows us to lazily add Pattern on the stack, only if the - /// Pattern::resolve has been called on an empty stack. + /// `Pattern::resolve` has been called on an empty stack. /// /// This is the case when pattern is called from Bundle and it allows us to fast-path /// simple resolutions, and only use the stack for placeables. diff --git a/fluent-bundle/src/types/mod.rs b/fluent-bundle/src/types/mod.rs index a789f385..24ec8c08 100644 --- a/fluent-bundle/src/types/mod.rs +++ b/fluent-bundle/src/types/mod.rs @@ -34,13 +34,13 @@ pub trait FluentType: fmt::Debug + AnyEq + 'static { /// Create a clone of the underlying type. fn duplicate(&self) -> Box; - /// Convert the custom type into a string value, for instance a custom DateTime + /// Convert the custom type into a string value, for instance a custom `DateTime` /// type could return "Oct. 27, 2022". fn as_string(&self, intls: &intl_memoizer::IntlLangMemoizer) -> Cow<'static, str>; - /// Convert the custom type into a string value, for instance a custom DateTime + /// Convert the custom type into a string value, for instance a custom `DateTime` /// type could return "Oct. 27, 2022". This operation is provided the threadsafe - /// [IntlLangMemoizer](intl_memoizer::concurrent::IntlLangMemoizer). + /// [`IntlLangMemoizer`](intl_memoizer::concurrent::IntlLangMemoizer). fn as_string_threadsafe( &self, intls: &intl_memoizer::concurrent::IntlLangMemoizer, diff --git a/fluent-fallback/examples/simple-fallback.rs b/fluent-fallback/examples/simple-fallback.rs index 523013b6..33fc4e82 100644 --- a/fluent-fallback/examples/simple-fallback.rs +++ b/fluent-fallback/examples/simple-fallback.rs @@ -165,7 +165,7 @@ fn collatz(n: isize) -> isize { } } -/// Bundle iterator used by BundleGeneratorSync implementation for Locales. +/// Bundle iterator used by `BundleGeneratorSync` implementation for `Locales`. struct BundleIter { res_path_scheme: String, locales: as IntoIterator>::IntoIter, diff --git a/fluent-resmgr/src/resource_manager.rs b/fluent-resmgr/src/resource_manager.rs index 1de04eda..9f2cfc57 100644 --- a/fluent-resmgr/src/resource_manager.rs +++ b/fluent-resmgr/src/resource_manager.rs @@ -15,7 +15,7 @@ fn read_file(path: &str) -> Result { fs::read_to_string(path) } -/// [ResourceManager] provides a standalone solution for managing localization resources which +/// [`ResourceManager`] provides a standalone solution for managing localization resources which /// can be used by `fluent-fallback` or other higher level bindings. pub struct ResourceManager { resources: FrozenMap>, diff --git a/fluent-syntax/src/ast/mod.rs b/fluent-syntax/src/ast/mod.rs index 12e6f751..273aceaf 100644 --- a/fluent-syntax/src/ast/mod.rs +++ b/fluent-syntax/src/ast/mod.rs @@ -393,7 +393,7 @@ pub struct Pattern { pub elements: Vec>, } -/// PatternElement is an element of a [`Pattern`]. +/// `PatternElement` is an element of a [`Pattern`]. /// /// Each [`PatternElement`] node represents /// either a simple textual value, or a combination of text literals diff --git a/fluent-syntax/tests/serializer_fixtures.rs b/fluent-syntax/tests/serializer_fixtures.rs index 85af4dc5..4af214a7 100644 --- a/fluent-syntax/tests/serializer_fixtures.rs +++ b/fluent-syntax/tests/serializer_fixtures.rs @@ -9,9 +9,9 @@ use fluent_syntax::serializer::{serialize, serialize_with_options, Options}; /// List of files that currently do not roundtrip correctly. /// -/// - `multiline_values.ftl`: https://github.com/projectfluent/fluent-rs/issues/286 -/// - `crlf.ftl`: Parsing `foo =\r\n bar\r\n baz\r\n` results in a TextElement "bar" and a TextElement "\n", -/// whereas parsing `foo =\n bar\n baz\n` results in a single TextElement "bar\n". That means resources with +/// - `multiline_values.ftl`: +/// - `crlf.ftl`: Parsing `foo =\r\n bar\r\n baz\r\n` results in a `TextElement` "bar" and a `TextElement` "\n", +/// whereas parsing `foo =\n bar\n baz\n` results in a single `TextElement` "bar\n". That means resources with /// text separated by CRLF do not roundtrip correctly. const IGNORE_LIST: [&str; 2] = ["crlf.ftl", "multiline_values.ftl"]; diff --git a/fluent/src/lib.rs b/fluent/src/lib.rs index 1cbefc00..d91e9c52 100644 --- a/fluent/src/lib.rs +++ b/fluent/src/lib.rs @@ -77,7 +77,7 @@ pub use fluent_bundle::*; -/// A helper macro to simplify creation of FluentArgs. +/// A helper macro to simplify creation of `FluentArgs`. /// /// # Example /// diff --git a/intl-memoizer/src/lib.rs b/intl-memoizer/src/lib.rs index a4604e1a..d9986571 100644 --- a/intl-memoizer/src/lib.rs +++ b/intl-memoizer/src/lib.rs @@ -2,7 +2,7 @@ //! expensive (in terms of performance and memory) to construct a formatter, but then //! relatively cheap to run the format operation. //! -//! The [IntlMemoizer] is the main struct that creates a per-locale [IntlLangMemoizer]. +//! The [`IntlMemoizer`] is the main struct that creates a per-locale [`IntlLangMemoizer`]. use std::cell::RefCell; use std::collections::hash_map::Entry; @@ -31,7 +31,7 @@ pub trait Memoizable { /// The [`IntlLangMemoizer`] can memoize multiple constructed internationalization /// formatters, and their configuration for a single locale. For instance, given "en-US", -/// a memorizer could retain 3 DateTimeFormat instances, and a PluralRules. +/// a memorizer could retain 3 `DateTimeFormat` instances, and a `PluralRules`. /// /// For memoizing with multiple locales, see [`IntlMemoizer`]. /// @@ -190,8 +190,8 @@ impl IntlLangMemoizer { } /// `with_try_get` means `with` an internationalization formatter, `try` and `get` a result. - /// The (potentially expensive) constructor for the formatter (such as PluralRules or - /// DateTimeFormat) will be memoized and only constructed once for a given + /// The (potentially expensive) constructor for the formatter (such as `PluralRules` or + /// `DateTimeFormat`) will be memoized and only constructed once for a given /// `construct_args`. After that the format operation can be run multiple times /// inexpensively. ///