Skip to content

Move entry creation logic from Parser to ContentManager #28

@brass75

Description

@brass75

When RE was created as solely file system based it was decided that the Parser would handle conversion to and from frontmatter/markdown. The Parser would prepare the content and metadata as a string and return that to the CLI tool to put into the filesystem.

With the addition of the ContentManager it makes sense that that ContentManager would handle the actual storage. The flow would be:

  1. CLI tool for new_entry is called.
  2. CLI tool processes metadata (dates, validation, etc.)
  3. CLI tool calls collection.add_entry with all the relevant parameters (metadata, content, whether or not to open the editor, filename, etc.)
  4. ContentManager handles the business logic of creating the entry, opening the editor, etc. May or may not use the Parser to handle metadata formatting for frontmatter.

This flow will allow for custom ContentManager implementations to handle the creation and storage of entries in the appropriate manner. So a DB based ContentManager could collect all the data (including letting the user edit the content and metadata in the editor) and then insert the row into the DB while a file based ContentManager would create the file and, if necessary, open the editor.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions