1.4 KiB
zord-tree
Library for golang to build articles tree from file system. The file should be in specific format to hold meta data, id and content.
Process should go in two steps:
- populate existing
source
directory with formatting files, add missingid
and meta data - build
Tree
to operate on object for your app - read file content without meta data by path
File and tree format
Category
During building Tree
directory path is converted into array of categories. So, file in path linux/command/video
will get
categories: linux
, command
, video
.
Split line
File meta should be split by ---
line. If there is markdown formating to mark header, first such case (---
) will be formatted
to contain empty line. Example:
Text
---
will become
Text
---
Meta data
Meta data separated by lines and in format * name: value
. By default library supports tags
as comma separated array.
During populating tree it adds missing id
in abcex
format and empty meta data lines and saves in source
directory then copy
to destination
directory.
File structure
* tags: linux,command,video
* meta1: example
* meta2: some long description
---
Hear goes content. It can be written in html, markdown or whatever what can be processed later
Notes
Future plans
- add meta as function, ex. today date
- add meta with default value that should be used if other value is not set, ex. license
- add search on Tree