pub fn generate_bare_examples<P: AsRef<Path>>(dir: P) -> Result<()>Expand description
Takes the path to a directory and creates a directory structure with set of example files inside it.
The result can be represented as follows:
examples
└── Zettelkasten
└── file1.md
└── file2.md
└── file3.md
└── subdir
└── file4.md
└── file5.md
└── onlies
└── markdown-only.md
└── pure-yaml.yaml
└── .hiddendir
└── .hiddenfile2.txt
└── a-file.txt
└── .gitignore
└── .zettelsignore
└── configA few notes:
- The zettel files in
examples/Zettelkastencontain nonsense text and are (probably just as nonsensically) interlinked with each other in various ways. .gitignore’s contents are simply/.*, which means all hidden files and directories are ignored.- The subdirectory
onliescontains files that are not proper zettel files. One is a markdown file without a YAML-header, the other a YAML-file (might be a pandoc metadata file). They are still added to the index, with making the best of the present data and sensible defaults:- The entry for
markdown-only.mdlooks like this:Everything was filled with empty or default values, but the one link in the markdown was parsed and correctly added to the zettels links.onlies/markdown-only.md: title: untitled links: - file2.md followups: [] keywords: [] - The entry for
pure-yaml.yamllooks like this:All YAML-fields that make sense for a Zettel, were used, the rest was filled with empty values.onlies/pure-yaml.yaml: title: Pure Yaml links: [] followups: [] keywords: - example - pureyaml
- The entry for
§Errors
std::io::Errorof theInvalidInputkind if the provided path is not a directory or cannot be accessed.- A variety of other
std::io::Errors for problems with creating and writing to the files in the directory.