diff --git a/doctree/src/collection.rs b/doctree/src/collection.rs index cfc197e..5948553 100644 --- a/doctree/src/collection.rs +++ b/doctree/src/collection.rs @@ -63,9 +63,14 @@ impl Collection { // Delete existing collection data if any println!("DEBUG: Deleting existing collection data from Redis key 'collections:{}'", self.name); self.storage.delete_collection(&self.name)?; - - // Store the collection's path in Redis + // Store the collection's full absolute path in Redis + let absolute_path = std::fs::canonicalize(&self.path) + .unwrap_or_else(|_| self.path.clone()) + .to_string_lossy() + .to_string(); + println!("DEBUG: Storing collection path in Redis key 'collections:{}:path'", self.name); + self.storage.store_collection_path(&self.name, &absolute_path)?; self.storage.store_collection_path(&self.name, &self.path.to_string_lossy())?; // Walk through the directory diff --git a/examples/grid1/.collection b/examples/grid1/.collection index 7d30e20..e69de29 100644 --- a/examples/grid1/.collection +++ b/examples/grid1/.collection @@ -1 +0,0 @@ -name = "Grid Documentation" diff --git a/examples/grid1/include_example.md b/examples/grid1/include_example.md new file mode 100644 index 0000000..db43f85 --- /dev/null +++ b/examples/grid1/include_example.md @@ -0,0 +1,8 @@ +# Include Example + +This file demonstrates the include functionality of doctree. + +## Including content from Introduction.md + +!!include grid1:introduction.md + diff --git a/include_example.sh b/include_example.sh new file mode 100755 index 0000000..4a8e096 --- /dev/null +++ b/include_example.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# Change to the directory where the script is located +cd "$(dirname "$0")" +# Exit immediately if a command exits with a non-zero status +set -e + +cd doctreecmd + +# First, scan the collections with a specific doctree name +echo "=== Scanning Collections with doctree name 'include_demo' ===" +cargo run -- scan ../examples --doctree include_demo + +# List the collections +echo -e "\n=== Listing Collections ===" +cargo run -- list --doctree include_demo + +# Get the document with includes in markdown format +echo -e "\n=== Getting Document with Includes (Markdown) ===" +cargo run -- get -c grid1 -p include_example.md --doctree include_demo