pub mod tags;
pub mod translator;
use docspec_core::TextStyleKind;
use self::tags::TagIntent;
pub(crate) const MARK_COLOR: docspec_core::Color = docspec_core::Color::Rgb {
r: 255,
g: 255,
b: 0,
};
pub(crate) fn tag_intent_to_style_kind(intent: &TagIntent) -> Option<TextStyleKind> {
Some(match *intent {
TagIntent::Bold => TextStyleKind::Bold,
TagIntent::Italic => TextStyleKind::Italic,
TagIntent::Underline => TextStyleKind::Underline,
TagIntent::Strikethrough => TextStyleKind::Strikethrough,
TagIntent::Code => TextStyleKind::Code,
TagIntent::Subscript => TextStyleKind::Subscript,
TagIntent::Superscript => TextStyleKind::Superscript,
TagIntent::Mark => TextStyleKind::Mark(MARK_COLOR),
TagIntent::LineBreak
| TagIntent::ThematicBreak
| TagIntent::Heading(_)
| TagIntent::Ignored => return None,
})
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn mark_color_is_yellow() {
assert_eq!(
MARK_COLOR,
docspec_core::Color::Rgb {
r: 255,
g: 255,
b: 0
}
);
}
}