use serde::{Deserialize, Serialize};
use crate::fingerprint::BlockId;
use crate::range::ByteRange;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum RawIslandType {
FrontMatter,
HtmlBlock,
ComplexTable,
MathBlock,
Directive,
ComplexList,
ComplexBlockquote,
UnknownExtension,
MalformedRegion,
Footnote,
}
impl RawIslandType {
pub fn label_key(&self) -> &'static str {
match self {
RawIslandType::FrontMatter => "island.front_matter",
RawIslandType::HtmlBlock => "island.html_block",
RawIslandType::ComplexTable => "island.complex_table",
RawIslandType::Footnote => "island.footnote",
RawIslandType::MathBlock => "island.math_block",
RawIslandType::Directive => "island.directive",
RawIslandType::ComplexList => "island.complex_list",
RawIslandType::ComplexBlockquote => "island.complex_blockquote",
RawIslandType::UnknownExtension => "island.unknown_extension",
RawIslandType::MalformedRegion => "island.malformed_region",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum RawIslandEditPolicy {
RawEditable,
ReadOnlyWithTextModeEscape,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct RawIsland {
pub block_id: BlockId,
pub island_type: RawIslandType,
pub source_range: ByteRange,
pub edit_policy: RawIslandEditPolicy,
pub reason: String,
}