PencakeUtils

main

Tools for PenCake's articles and stories
Harumaru169/PencakeUtils

PencakeUtils

pencake is a CLI tool that converts articles or stories of PenCake app into JSON format.

PencakeParser is a library for converting stories or articles into in-memory representations.

Usage

pencake Command

$ pencake story path_to_story_directory --pretty-printed 
{
  "exportedDate" : 2022-01-19T07:44:27Z,
  "createdDate" : 2022-01-19T07:28:10Z,
  "title" : "My Story",
  "subtitle" : "Subtitle",
  "articles" : [
    ...
  ]
}

$ pencake story path_to_story_zipfile -p >> story.json

$ pencake article path_to_article_file --language ja >> Article_001.json

Run pencake --help to show help information.

PencakeParser Library

import PencakeParser

let storyURL = URL(fileURLWithPath: "path_to_story_directory")

let storyParser = ParallelStoryParser()

let options = ParseOptions(language: .english, newline: .lf)

let story = try await storyParser.parse(directoryURL: storyURL, options: options)

print("article count: \(story.articles.count)")

let jsonEncoder = JSONEncoder()
let jsonData = try jsonEncoder.encode(story)
print(String(data: jsonData, encoding: .utf8) ?? "nil")

Installation

pencake Command

Download source code and run make install in the project directory.

Package Dependency

via SwiftPM:

dependencies: [
    .package(url: "https://github.com/Harumaru169/PencakeUtils", from: "0.8.0")
]

Description

  • Swift Tools
View More Packages from this Author

Dependencies

  • None
Last updated: Thu Nov 10 2022 12:22:03 GMT-0500 (GMT-05:00)