use crate::datatypes::values::Value;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Dialect {
Okf,
Loose,
}
impl Dialect {
pub fn parse(name: Option<&str>) -> Self {
match name.map(|s| s.to_ascii_lowercase()).as_deref() {
Some("loose") | Some("obsidian") => Dialect::Loose,
_ => Dialect::Okf,
}
}
pub fn wikilinks(self) -> bool {
matches!(self, Dialect::Loose)
}
}
#[derive(Debug, Clone)]
pub struct BuildOptions {
pub dialect: Dialect,
pub with_body: bool,
pub embed: bool,
}
impl Default for BuildOptions {
fn default() -> Self {
BuildOptions {
dialect: Dialect::Okf,
with_body: false,
embed: false,
}
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Link {
pub target: String,
pub conn_type: String,
pub is_wikilink: bool,
pub is_external: bool,
}
#[derive(Debug, Clone)]
pub struct ConceptDoc {
pub concept_id: String,
pub file_path: String,
pub label: String,
pub title: String,
pub props: Vec<(String, Value)>,
pub links: Vec<Link>,
pub body: Option<String>,
}
pub const DEFAULT_CONN_TYPE: &str = "LINKS_TO";
pub const CONTAINS_CONN_TYPE: &str = "CONTAINS";
pub const DEFAULT_LABEL: &str = "Concept";
pub const TAG_LABEL: &str = "Tag";
pub const TAGGED_CONN_TYPE: &str = "TAGGED";
pub const SOURCE_LABEL: &str = "Source";
pub const FOLDER_LABEL: &str = "Folder";