Skip to content

Commit

Permalink
refactor: ♻️ cleaned up macros
Browse files Browse the repository at this point in the history
  • Loading branch information
arctic-hen7 committed Sep 20, 2021
1 parent 39b3ce1 commit 30345f0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/perseus/src/macros.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/// An internal macro used for defining a function to get the user's preferred config manager (which requires multiple branches).
#[doc(hidden)]
#[macro_export]
macro_rules! define_get_config_manager {
() => {
Expand All @@ -15,6 +16,7 @@ macro_rules! define_get_config_manager {
}
/// An internal macro used for defining the HTML `id` at which to render the Perseus app (which requires multiple branches). The default
/// is `root`.
#[doc(hidden)]
#[macro_export]
macro_rules! define_app_root {
() => {
Expand All @@ -25,6 +27,7 @@ macro_rules! define_app_root {
};
}
/// An internal macro used for defining a function to get the user's preferred translations manager (which requires multiple branches).
#[doc(hidden)]
#[macro_export]
macro_rules! define_get_translations_manager {
($locales:expr) => {
Expand Down Expand Up @@ -65,6 +68,7 @@ macro_rules! define_get_translations_manager {
};
}
/// An internal macro used for defining locales data. This is abstracted because it needs multiple branches.
#[doc(hidden)]
#[macro_export]
macro_rules! define_get_locales {
{
Expand Down Expand Up @@ -96,9 +100,9 @@ macro_rules! define_get_locales {
}
};
}

/// An internal macro for defining a function that gets the user's static content aliases (abstracted because it needs multiple
/// branches).
#[doc(hidden)]
#[macro_export]
macro_rules! define_get_static_aliases {
(
Expand Down Expand Up @@ -154,7 +158,6 @@ macro_rules! define_app {
default: $default_locale:literal,
// The user doesn't have to define any other locales
other: [$($other_locale:literal),*]
$(,no_i18n: $no_i18n:literal)?
}
$(,static_aliases: {
$($url:literal => $resource:literal)*
Expand Down Expand Up @@ -194,7 +197,6 @@ macro_rules! define_app {
$($url:literal => $resource:literal)*
})?
$(,config_manager: $config_manager:expr)?
$(,translations_manager: $translations_manager:expr)?
} => {
$crate::define_app!(
@define_app,
Expand All @@ -214,7 +216,6 @@ macro_rules! define_app {
$($url => $resource)*
})?
$(,config_manager: $config_manager)?
$(,translations_manager: $translations_manager)?
}
);
};
Expand Down

0 comments on commit 30345f0

Please sign in to comment.