summaryrefslogtreecommitdiff
path: root/src/library/text/mod.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-10-18 00:02:38 +0200
committerLaurenz <laurmaedje@gmail.com>2022-10-18 00:04:12 +0200
commitc0e972b91a7bf8d22cd24a38fc92a9c6214c8a0c (patch)
tree19362eb993f15ef1b9bceeac821852bb6edfe955 /src/library/text/mod.rs
parente21822665591dc19766275da1e185215a6b945ef (diff)
Reduce dependencies from compiler on library
Diffstat (limited to 'src/library/text/mod.rs')
-rw-r--r--src/library/text/mod.rs16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/library/text/mod.rs b/src/library/text/mod.rs
index c9bf2e57..299357de 100644
--- a/src/library/text/mod.rs
+++ b/src/library/text/mod.rs
@@ -1,7 +1,6 @@
//! Text handling and paragraph layout.
mod deco;
-mod lang;
mod link;
mod par;
mod quotes;
@@ -11,7 +10,6 @@ mod shaping;
mod shift;
pub use deco::*;
-pub use lang::*;
pub use link::*;
pub use par::*;
pub use quotes::*;
@@ -290,6 +288,20 @@ castable! {
}),
}
+castable! {
+ Lang,
+ Expected: "string",
+ Value::Str(string) => Self::from_str(&string)
+ .ok_or("expected two or three letter language code (ISO 639-1/2/3)")?,
+}
+
+castable! {
+ Region,
+ Expected: "string",
+ Value::Str(string) => Self::from_str(&string)
+ .ok_or("expected two letter region code (ISO 3166-1 alpha-2)")?,
+}
+
/// The direction of text and inline objects in their line.
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
pub struct HorizontalDir(pub Dir);