Skip to content

Commit

Permalink
docs: Fix and improve Markdown usage (#355)
Browse files Browse the repository at this point in the history
  • Loading branch information
waywardmonkeys authored May 6, 2024
1 parent 41d8b0a commit eca819a
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion fluent-bundle/src/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ impl<R> Default for FluentBundle<R, IntlLangMemoizer> {
}

impl<R> FluentBundle<R, IntlLangMemoizer> {
/// 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
Expand Down
4 changes: 2 additions & 2 deletions fluent-bundle/src/memoizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion fluent-bundle/src/resolver/scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions fluent-bundle/src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ pub trait FluentType: fmt::Debug + AnyEq + 'static {
/// Create a clone of the underlying type.
fn duplicate(&self) -> Box<dyn FluentType + Send>;

/// 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,
Expand Down
2 changes: 1 addition & 1 deletion fluent-fallback/examples/simple-fallback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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: <Vec<LanguageIdentifier> as IntoIterator>::IntoIter,
Expand Down
2 changes: 1 addition & 1 deletion fluent-resmgr/src/resource_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fn read_file(path: &str) -> Result<String, io::Error> {
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<String, Box<FluentResource>>,
Expand Down
2 changes: 1 addition & 1 deletion fluent-syntax/src/ast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ pub struct Pattern<S> {
pub elements: Vec<PatternElement<S>>,
}

/// 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
Expand Down
6 changes: 3 additions & 3 deletions fluent-syntax/tests/serializer_fixtures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`: <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
/// text separated by CRLF do not roundtrip correctly.
const IGNORE_LIST: [&str; 2] = ["crlf.ftl", "multiline_values.ftl"];

Expand Down
2 changes: 1 addition & 1 deletion fluent/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
///
Expand Down
8 changes: 4 additions & 4 deletions intl-memoizer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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`].
///
Expand Down Expand Up @@ -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.
///
Expand Down

0 comments on commit eca819a

Please sign in to comment.