Skip to content

This is THE data library of the ecosystem. It serialises and deserialises the post JSON and is being relied upon by the rest of the ecosystem: namely by the blog.engine and the blog.generator.

Notifications You must be signed in to change notification settings

jakub-stastny/blog.parser.post.json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

https://github.com/jakub-stastny/blog.parser.post.json/actions/workflows/test.yml/badge.svg

This is THE data library of the ecosystem. It serialises and deserialises the post JSON and is being relied upon by the rest of the ecosystem: namely by the blog.engine and the blog.generator.

Why Elm?

Given that the blog.engine is written in Elm, using anything but Elm is difficult. In theory we could possibly use ports, but sending messages back and forth just to decode JSON doesn’t make sense, especially for something that needs to happen really fast.

Usage

From an Elm app

Since Elm doesn’t support private packages, the best way to go about this is to add the library as a git submodule and extend the compile function to tangle blocks from src/Post.org into src/Post.elm of the host repository.

From JavaScript

Elm itself doesn’t allow exporting JavaScript functions. The closest we get is a headless program (based on messaging, just like Browser.application), which is an overkill for a few functions.

Fortunatelly there is elm2node. It is a fork of Elm 0.19.1 compiler, but generates normal JS code as the output. It has limitations however, for instance the exported functions has to have arity 1.

Resources and community

This repository is only one of many packages that I wrote for my blog. For the overall architecture and documentation please see the blog meta repo. That’s also the place to raise any issues if you encounter any and to discuss the project and ask questions.

Understanding the code base

Where’s all the source code?

Literate programming

In case you’re wondering where are all the Elm files, you have to tangle code blocks from Org mode files in src into actual Elm files using Org mode in Emacs.

Don’t worry about it though – unless you want to set up the code locally, there is no need. Just read the Org mode files in the src directory, it contains well-documented code.

If you’re curious why am I doing this, you can check my post on literate programming.

Setup

If you want to contribute or just play around with it, check out how to set up the repository.

About

This is THE data library of the ecosystem. It serialises and deserialises the post JSON and is being relied upon by the rest of the ecosystem: namely by the blog.engine and the blog.generator.

Topics

Resources

Stars

Watchers

Forks