aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorBen Beltran <ben@nsovocal.com>2020-06-01 18:53:59 +0200
committerBen Beltran <ben@nsovocal.com>2020-06-01 18:53:59 +0200
commitae442b8f192ab0f9d4de483462d5d18c43d9ec23 (patch)
tree473608a333db1fdf0ceefc61801867226aebb03e /doc
parentcce07b52712ea6f3b8a9e8e5f4b072c4278bd023 (diff)
Update spec witth the metadata step
Diffstat (limited to 'doc')
-rw-r--r--doc/specs/20200601-serving-different-versions.md82
1 files changed, 60 insertions, 22 deletions
diff --git a/doc/specs/20200601-serving-different-versions.md b/doc/specs/20200601-serving-different-versions.md
index 351cc8c..545febb 100644
--- a/doc/specs/20200601-serving-different-versions.md
+++ b/doc/specs/20200601-serving-different-versions.md
@@ -73,8 +73,9 @@ Given I add a new entry to the blog, the entries will be updated.
# Solution Proposal
-(Note: This solution is incomplete. We need to add guid and pubDate
-generation, as this is required for the RSS to be usable)
+We will add a new step in the creation process to create metadata for the
+post that will allow each post to be uniquely identified, as well as
+having a publish date related to them.
We will split the current generator function into generators, and create
a new generator that will generate an RSS 2.0 file
@@ -82,30 +83,56 @@ a new generator that will generate an RSS 2.0 file
# Blackbox
```
- ┌─────────────────┐ ┌───────────────┐
- │ │ │ │
- ┌─────▶│ StaticGenerator │──────────▶│ Static Assets │
- │ │ │ │ │
- │ └─────────────────┘ └───────────────┘
-┌───────┐ │ ┌───────────────┐ ┌───────────┐
-│ │ │ │ │ │ │
-│ Blog │──────┼─────▶│ HTMLGenerator │────────────▶│ HTML File │
-│ │ │ │ │ │ │
-└───────┘ │ └───────────────┘ └───────────┘
- │ ┌──────────────┐ ┌──────────┐
- │ │ │ │ │
- └─────▶│ RSSGenerator │─────────────▶│ RSS File │
- │ │ │ │
- └──────────────┘ └──────────┘
+ ╔══════════════════════╗
+ ║ When Adding a Post ║
+ ╚══════════════════════╝
+ ┌───────────────┐ ┌───────────────┐
+ │ │ │ │
+ ┌────────────────▶│ writeMetadata │─────────▶│ Metadata File │
+ │ │ │ │ │
+ │ └───────────────┘ └───────────────┘
+ │
+ │
+ │ ╔════════════════════════╗
+ │ ║ When Generating Output ║
+ │ ╚════════════════════════╝
+ │ ┌─────────────────┐ ┌───────────────┐
+ │ │ │ │ │
+ │ ┌─────▶│ StaticGenerator │───────▶│ Static Assets │
+ │ │ │ │ │ │
+ │ │ └─────────────────┘ └───────────────┘
+┌───────┐ │ ┌───────────────┐ ┌───────────┐
+│ │ │ │ │ │ │
+│ Blog │──────┼─────▶│ HTMLGenerator │─────────▶│ HTML File │
+│ │ │ │ │ │ │
+└───────┘ │ └───────────────┘ └───────────┘
+ │ ┌──────────────┐ ┌──────────┐
+ │ │ │ │ │
+ └─────▶│ RSSGenerator │──────────▶│ RSS File │
+ │ │ │ │
+ └──────────────┘ └──────────┘
```
# Theory of Operation
-When the generate function of the blog is triggered, it will iterate over
-a list of generator functions and call them with the source and target
-directories, and an array containing the parsed markdown from the post.
-Each generator function will do its work, throwing an exception if they
-encounter an error.
+## When Adding a Post
+
+When the add function of the blog is triggered, it will shift the posts
+as it currently does and then will generate a new UUID and take the
+current timestamp. This will be saved in a JSON file in the output
+directory called "metadata.json"
+
+## When Generating Output
+
+When the generate function of the blog is triggered, it will iterate
+over every post. For each of them it will parse the markdown content,
+and the metadata, creating an object of type `tPost` and pushing it
+to an array.
+
+Next, it will iterate from a list of generator functions and call them
+with the source and target directories, and an array containing the `tPost`
+objects. Each generator function will do its work, throwing an exception
+if they encounter an error.
When the static generator is called, it will remove the current assets
directory in the target directory, and recursively copy the assets from
@@ -121,6 +148,17 @@ directory.
# Technical Specification
+## The Post Data Structure
+
+This spec introduces a data structure to help generate output.
+
+```
+tPost <Object>
+ +html <String> // The markup of the post
+ +publishedOn <Number> // The timestamp when this post was added
+ +uuid <String> // The UUID for this post
+```
+
## The Generator Interface
Every generator must implement this interface in order to work with