Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ghost_parser

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ghost_parser

  • 0.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

GhostParser

A ruby plugin used to help evaluate the exported Ghost posts

Installation

Install the gem and add to the application's Gemfile by executing:

$ bundle add ghost_parser

If bundler is not being used to manage dependencies, install the gem by executing:

$ gem installghost_parser

Usage

To parse the export:

parser = GhostParser.new("path/to/export.json").parse

[
    {
        id: "id",
        title: "title",
        slug: "slug",
        html: "html",
        feature_image: "feature_image",
        created_at: "created_at",
        updated_at: "updated_at",
        published_at: "published_at",
        status: "status"
    }, ......
]

Ghost export content will have their links modified like __GHOST_URL__/image.jpg. If you want the content with active links provide your ghost url.

GhostParser.set_ghost_url("your ghost url")

Instead of getting all the fields we can define the necessary params with necessary keys

GhostParser.set_config({
  new_id: "id",
  name: "title",
  new_slug: "slug"
})

parser = GhostParser.new("path/to/export.json").parse

[
    {
        new_id: "id",
        name: "title",
        new_slug: "slug"
    }, ......
]

GhostParser.unset_config # Reverts back to default

Also supports the option of adding extra fields to parsed data


# Using blocks
parser = GhostParser.new(file_path).parse do |t|
          t[:user_id] = 12
        end

[
    {
        id: "id",
        title: "title",
        slug: "slug",
        html: "html",
        feature_image: "feature_image",
        created_at: "created_at",
        updated_at: "updated_at",
        published_at: "published_at",
        status: "status",
        user_id: 12
    }, ......
]

# Inline
parser = GhostParser.new(file_path).parse(
            {param_key: "123"}
          )

[
    {
        id: "id",
        title: "title",
        slug: "slug",
        html: "html",
        feature_image: "feature_image",
        created_at: "created_at",
        updated_at: "updated_at",
        published_at: "published_at",
        status: "status",
        param_key: "123"
    }, ......
]

FAQs

Package last updated on 23 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc