123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- #[macro_export]
- macro_rules! inline_attribute {
- (
- $key: ident,
- $value: ty
- ) => {
- pub fn $key(value: $value) -> Self {
- Self {
- key: RichTextAttributeKey::$key,
- value: value.into(),
- scope: AttributeScope::Inline,
- }
- }
- };
- }
- #[macro_export]
- macro_rules! block_attribute {
- (
- $key: ident,
- $value: ty
- ) => {
- pub fn $key(value: $value) -> Self {
- Self {
- key: RichTextAttributeKey::$key,
- value: value.into(),
- scope: AttributeScope::Block,
- }
- }
- };
- }
- #[macro_export]
- macro_rules! list_attribute {
- (
- $key: ident,
- $value: expr
- ) => {
- pub fn $key(b: bool) -> Self {
- let value = match b {
- true => $value,
- false => "",
- };
- RichTextAttribute::List(value)
- }
- };
- }
- #[macro_export]
- macro_rules! ignore_attribute {
- (
- $key: ident,
- $value: ident
- ) => {
- pub fn $key(value: $value) -> Self {
- Self {
- key: RichTextAttributeKey::$key,
- value: value.into(),
- scope: AttributeScope::Ignore,
- }
- }
- };
- }
|