Release v0.1.2: embedded stdlib, docs, and extension branch policy.
Embed lib/*.mq.md in binary; marqdo version --check; public writeback/subtask pages; restore /vscode-extension/ ignore. VSIX built from branch vscode-extension only (see doc/design/vscode-extension-commit.md). Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
3da7b276d3
commit
2e65c055b8
23 files changed
+469
-53
No files matched your search
@@ -0,0 +1,32 @@
|
||||
//! Official `lib/*.mq.md` baked into the binary (fallback when disk `lib/` is absent).
|
||||
|
||||
use include_dir::{include_dir, Dir};
|
||||
|
||||
static LIB: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/lib");
|
||||
|
||||
/// Read `lib/<remainder>` from the embedded tree (e.g. `text.mq.md`).
|
||||
pub fn read_file(remainder: &str) -> Option<String> {
|
||||
let key = remainder.replace('\\', "/");
|
||||
LIB.get_file(&key)
|
||||
.and_then(|f| f.contents_utf8().map(|s| s.to_string()))
|
||||
}
|
||||
|
||||
pub fn has_file(remainder: &str) -> bool {
|
||||
let key = remainder.replace('\\', "/");
|
||||
LIB.get_file(&key).is_some()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn embedded_has_core_libs() {
|
||||
assert!(has_file("text.mq.md"));
|
||||
assert!(has_file("subtask.mq.md"));
|
||||
assert!(has_file("writeback.mq.md"));
|
||||
assert!(read_file("math.mq.md")
|
||||
.unwrap()
|
||||
.contains("host_math_add"));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user