Wraith.Ghost (Wraith v0.1.0)

View Source

Ghost's shapes, both ways.

post_json/2, author_json/1, tag_json/1 render our items the way Ghost's Content API does (html, feature_image, primary_author, tags, reading_time, …) so clients written for Ghost mostly work.

export/0 writes a Ghost-compatible export (db[0].data.{posts, tags, posts_tags, users, posts_authors, settings} plus Wraith's own widgets and members); import/2 reads one — Ghost's own export JSON or ours — and creates what is missing: users (with a random password, to be reset), tags, posts (Ghost's html/lexical/mobiledoc bodies are turned into Markdown when they are plain HTML; plaintext otherwise), members.

Summary

Functions

A Ghost-compatible export of the whole site.

Import a Ghost or Wraith export (decoded JSON). Existing slugs/emails are skipped. Returns counts. opts[:author] is the user to own posts whose author is unknown.

A post as Ghost's Content/Admin API would serialise it.

Functions

author_json(user)

export()

A Ghost-compatible export of the whole site.

import(arg1, opts)

Import a Ghost or Wraith export (decoded JSON). Existing slugs/emails are skipped. Returns counts. opts[:author] is the user to own posts whose author is unknown.

post_json(post, opts \\ [])

A post as Ghost's Content/Admin API would serialise it.

The body honours the paywall: unless access: true is passed (the caller checked Members.can_read?/2, or is staff/export), a members/paid post yields only the part above <!--members-only--> for html, plaintext and markdown, and carries "access" => false like Ghost does.

settings_json()

tag_json(tag)